Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions public/app/features/panel/components/PanelDataErrorView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<PanelDataErrorViewProps>) {
Expand Down
9 changes: 8 additions & 1 deletion public/app/features/panel/components/PanelDataErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading