Skip to content

Commit

Permalink
feat(dashboard): add widget count to collapsed section rows
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi12299 authored and YounixM committed Sep 6, 2024
1 parent 47d1caf commit 8e22d2d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions frontend/src/container/GridCardLayout/GridCardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,15 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {

if (currentWidget?.panelTypes === PANEL_GROUP_TYPES.ROW) {
const rowWidgetProperties = currentPanelMap[id] || {};
let { title } = currentWidget;
if (rowWidgetProperties.collapsed) {
const widgetCount = rowWidgetProperties.widgets?.length || 0;
const collapsedText = `(${widgetCount} widget${
widgetCount > 1 ? 's' : ''
})`;
title += ` ${collapsedText}`;
}

return (
<CardContainer
className="row-card"
Expand All @@ -489,9 +498,7 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
cursor="move"
/>
)}
<Typography.Text className="section-title">
{currentWidget.title}
</Typography.Text>
<Typography.Text className="section-title">{title}</Typography.Text>
{rowWidgetProperties.collapsed ? (
<ChevronDown
size={14}
Expand Down

0 comments on commit 8e22d2d

Please sign in to comment.