From 35b48066cab2068c15e0026f9b7b354d4375eb9d Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Tue, 3 Oct 2023 20:10:51 +0200 Subject: [PATCH] Stat: Disable wide layout (#75556) update stat panel to disable the wide layout --- packages/grafana-ui/src/components/BigValue/BigValue.tsx | 5 +++++ .../grafana-ui/src/components/BigValue/BigValueLayout.tsx | 2 +- public/app/plugins/panel/stat/StatPanel.tsx | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.tsx index 3019977bf75..762cd2e893b 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.tsx @@ -74,6 +74,11 @@ export interface Props extends Themeable2 { * Used by BigValueTextMode.Auto text mode. */ count?: number; + + /** + * Disable the wide layout for the BigValue + */ + disableWideLayout?: boolean; } export class BigValue extends PureComponent { diff --git a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx index 8e52e9f379b..15ff7a04b69 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx @@ -445,7 +445,7 @@ export class StackedWithNoChartLayout extends BigValueLayout { export function buildLayout(props: Props): BigValueLayout { const { width, height, sparkline } = props; - const useWideLayout = width / height > 2.5; + const useWideLayout = width / height > 2.5 && !props.disableWideLayout; if (useWideLayout) { if (height > 50 && !!sparkline && sparkline.y.values.length > 1) { diff --git a/public/app/plugins/panel/stat/StatPanel.tsx b/public/app/plugins/panel/stat/StatPanel.tsx index 25750a7aaee..2300fc20dcd 100644 --- a/public/app/plugins/panel/stat/StatPanel.tsx +++ b/public/app/plugins/panel/stat/StatPanel.tsx @@ -48,6 +48,7 @@ export class StatPanel extends PureComponent> { theme={config.theme2} onClick={openMenu} className={targetClassName} + disableWideLayout={true} /> ); };