From 02fd8981a0ea82b82b3db82db35be12c7d67350f Mon Sep 17 00:00:00 2001 From: Sergej-Vlasov <37613182+Sergej-Vlasov@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:41:46 +0300 Subject: [PATCH] DashboardGridItem: Adjust panel count logic (#110212) * adjust dashboard grid item panel count logic * update packages --- .../scene/layout-default/DashboardGridItem.tsx | 6 +++--- .../scene/layout-default/DashboardGridItemRenderer.tsx | 2 +- public/app/features/dashboard-scene/utils/utils.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItem.tsx b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItem.tsx index 9fbaf7f9cfa..86b67303f8e 100644 --- a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItem.tsx +++ b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItem.tsx @@ -85,9 +85,9 @@ export class DashboardGridItem const stateChange: Partial = {}; if (this.getRepeatDirection() === 'v') { - stateChange.itemHeight = Math.ceil(newState.height! / this.getPanelCount()); + stateChange.itemHeight = Math.ceil(newState.height! / this.getChildCount()); } else { - const rowCount = Math.ceil(this.getPanelCount() / this.getMaxPerRow()); + const rowCount = Math.ceil(this.getChildCount() / this.getMaxPerRow()); stateChange.itemHeight = Math.ceil(newState.height! / rowCount); } @@ -96,7 +96,7 @@ export class DashboardGridItem } } - public getPanelCount() { + public getChildCount() { return (this.state.repeatedPanels?.length ?? 0) + 1; } diff --git a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemRenderer.tsx b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemRenderer.tsx index d99fa8db38e..7fa8ca8e211 100644 --- a/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemRenderer.tsx +++ b/public/app/features/dashboard-scene/scene/layout-default/DashboardGridItemRenderer.tsx @@ -14,7 +14,7 @@ export function DashboardGridItemRenderer({ model }: SceneComponentProps