From cc7a39a3123fd306ba104651346b28e3012d112b Mon Sep 17 00:00:00 2001 From: Gurinder Singh Date: Fri, 25 Sep 2026 15:55:35 -0400 Subject: [PATCH] fix(mfe): contain panel no-data messages --- .../components/PanelDataErrorView.test.tsx | 22 +++++++++++++++++++ .../panel/components/PanelDataErrorView.tsx | 9 +++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/public/app/features/panel/components/PanelDataErrorView.test.tsx b/public/app/features/panel/components/PanelDataErrorView.test.tsx index 7040b80418fb8..558a733dcd87c 100644 --- a/public/app/features/panel/components/PanelDataErrorView.test.tsx +++ b/public/app/features/panel/components/PanelDataErrorView.test.tsx @@ -70,6 +70,28 @@ describe('PanelDataErrorView', () => { expect(screen.getByText('Query returned nothing')).toBeInTheDocument(); }); + + it('keeps long no-data messages inside the panel', () => { + renderWithProps({ + fieldConfig: { + overrides: [], + defaults: { + noValue: 'A-continuous-no-data-message-that-is-wider-than-the-panel', + }, + }, + }); + + const message = screen.getByTestId('data-testid Panel data error message'); + const wrapper = message.parentElement; + + expect(message).toHaveStyle({ + maxHeight: '100%', + maxWidth: '100%', + overflow: 'hidden', + overflowWrap: 'anywhere', + }); + expect(wrapper).toHaveStyle({ minHeight: '0', minWidth: '0', overflow: 'hidden' }); + }); }); function renderWithProps(overrides?: Partial) { diff --git a/public/app/features/panel/components/PanelDataErrorView.tsx b/public/app/features/panel/components/PanelDataErrorView.tsx index c8aed62734436..b879822f416de 100644 --- a/public/app/features/panel/components/PanelDataErrorView.tsx +++ b/public/app/features/panel/components/PanelDataErrorView.tsx @@ -127,13 +127,20 @@ const getStyles = (theme: GrafanaTheme2) => { justifyContent: 'center', alignItems: 'center', height: '100%', + minHeight: 0, + minWidth: 0, + overflow: 'hidden', + padding: theme.spacing(1), width: '100%', }), message: css({ textAlign: 'center', color: theme.colors.text.secondary, fontSize: theme.typography.size.lg, - width: '100%', + maxHeight: '100%', + maxWidth: '100%', + overflow: 'hidden', + overflowWrap: 'anywhere', }), actions: css({ marginTop: theme.spacing(2),