From ac0beb690bb5754302271ef97b240b9e1cfcf445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 4 Apr 2020 14:25:06 +0200 Subject: [PATCH] NewPanelEditor: Update layout with a top bar, and panel bar (#23336) * NewPanelEdit: Layout experiments * Progress on new layout * Fixed ts issue --- .../PanelEditor/OptionsPaneContent.tsx | 2 +- .../components/PanelEditor/PanelEditor.tsx | 88 ++++++++++++------- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/public/app/features/dashboard/components/PanelEditor/OptionsPaneContent.tsx b/public/app/features/dashboard/components/PanelEditor/OptionsPaneContent.tsx index 4447c9cde16..3370b9fcec2 100644 --- a/public/app/features/dashboard/components/PanelEditor/OptionsPaneContent.tsx +++ b/public/app/features/dashboard/components/PanelEditor/OptionsPaneContent.tsx @@ -219,7 +219,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => { display: flex; flex-direction: column; height: 100%; - padding-top: ${theme.spacing.sm}; + padding-top: ${theme.spacing.md}; `, panelOptionsPane: css` height: 100%; diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx index cd199eabd58..402514bd69e 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; -import { FieldConfigSource, GrafanaTheme, PanelData, PanelPlugin, SelectableValue } from '@grafana/data'; -import { Select, stylesFactory, Icon } from '@grafana/ui'; +import { FieldConfigSource, GrafanaTheme, PanelData, PanelPlugin } from '@grafana/data'; +import { Button, stylesFactory, Icon, Forms } from '@grafana/ui'; import { css, cx } from 'emotion'; import config from 'app/core/config'; import AutoSizer from 'react-virtualized-auto-sizer'; @@ -133,10 +133,10 @@ export class PanelEditorUnconnected extends PureComponent { this.forceUpdate(); }; - onDiplayModeChange = (mode: SelectableValue) => { + onDiplayModeChange = (mode: DisplayMode) => { const { updatePanelEditorUIState } = this.props; updatePanelEditorUIState({ - mode: mode.value, + mode: mode, }); }; @@ -161,8 +161,7 @@ export class PanelEditorUnconnected extends PureComponent { onDragFinished={size => this.onDragFinished(Pane.Top, size)} >
- {this.renderToolbar(styles)} - {this.renderTemplateVariables(styles)} + {this.renderPanelToolbar(styles)}
{({ width, height }) => { @@ -208,42 +207,48 @@ export class PanelEditorUnconnected extends PureComponent { ); } - renderToolbar(styles: EditorStyles) { + renderPanelToolbar(styles: EditorStyles) { const { dashboard, location, uiState } = this.props; return ( -
+
+ {this.renderTemplateVariables(styles)} +
+
+ +
+
+ +
+ {!uiState.isPanelOptionsVisible && ( +
+ + Show options + +
+ )} +
+ ); + } + + editorToolbar(styles: EditorStyles) { + const { dashboard } = this.props; + + return ( +
{dashboard.title} / Edit Panel
- +
-