DashboardSettings: Fixing container styles for the json mode view (#33789)

This commit is contained in:
Torkel Ödegaard 2021-05-06 21:27:14 +02:00 committed by GitHub
parent 9e2e7b66a1
commit f929b29b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 15 deletions

View File

@ -27,7 +27,6 @@ export interface SettingsPage {
title: string; title: string;
icon: IconName; icon: IconName;
render: () => React.ReactNode; render: () => React.ReactNode;
fullWidth?: boolean;
} }
export class DashboardSettings extends PureComponent<Props> { export class DashboardSettings extends PureComponent<Props> {
@ -99,7 +98,6 @@ export class DashboardSettings extends PureComponent<Props> {
title: 'JSON Model', title: 'JSON Model',
id: 'dashboard_json', id: 'dashboard_json',
icon: 'arrow', icon: 'arrow',
fullWidth: true,
render: () => <JsonEditorSettings dashboard={dashboard} />, render: () => <JsonEditorSettings dashboard={dashboard} />,
}); });
@ -172,9 +170,7 @@ export class DashboardSettings extends PureComponent<Props> {
)} )}
</div> </div>
</aside> </aside>
<div className={currentPage.fullWidth ? styles.settingsContentFullWidth : styles.settingsContent}> <div className={styles.settingsContent}>{currentPage.render()}</div>
{currentPage.render()}
</div>
</div> </div>
</div> </div>
</CustomScrollbar> </CustomScrollbar>
@ -202,12 +198,4 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
background: ${theme.colors.background.primary}; background: ${theme.colors.background.primary};
border-radius: ${theme.shape.borderRadius()}; border-radius: ${theme.shape.borderRadius()};
`, `,
settingsContentFullWidth: css`
flex-grow: 1;
height: 100%;
padding: 32px;
min-width: 600px;
width: 100%;
height: 100%;
`,
})); }));

View File

@ -26,7 +26,7 @@ export const JsonEditorSettings: React.FC<Props> = ({ dashboard }) => {
const styles = useStyles2(getStyles); const styles = useStyles2(getStyles);
return ( return (
<> <div>
<h3 className="dashboard-settings__header">JSON Model</h3> <h3 className="dashboard-settings__header">JSON Model</h3>
<div className="dashboard-settings__subheader"> <div className="dashboard-settings__subheader">
The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel
@ -53,7 +53,7 @@ export const JsonEditorSettings: React.FC<Props> = ({ dashboard }) => {
<Button onClick={onClick}>Save changes</Button> <Button onClick={onClick}>Save changes</Button>
</HorizontalGroup> </HorizontalGroup>
)} )}
</> </div>
); );
}; };