|
|
|
@ -17,7 +17,7 @@ import { Unsubscribable } from 'rxjs'; |
|
|
|
|
import { DisplayMode, displayModes, PanelEditorTab } from './types'; |
|
|
|
|
import { PanelEditorTabs } from './PanelEditorTabs'; |
|
|
|
|
import { DashNavTimeControls } from '../DashNav/DashNavTimeControls'; |
|
|
|
|
import { LocationState } from 'app/types'; |
|
|
|
|
import { LocationState, CoreEvents } from 'app/types'; |
|
|
|
|
import { calculatePanelSize } from './utils'; |
|
|
|
|
import { initPanelEditor, panelEditorCleanUp, updatePanelEditorUIState } from './state/actions'; |
|
|
|
|
import { PanelEditorUIState, setDiscardChanges } from './state/reducers'; |
|
|
|
@ -29,6 +29,8 @@ import { VariableModel } from 'app/features/templating/types'; |
|
|
|
|
import { getVariables } from 'app/features/variables/state/selectors'; |
|
|
|
|
import { SubMenuItems } from 'app/features/dashboard/components/SubMenu/SubMenuItems'; |
|
|
|
|
import { BackButton } from 'app/core/components/BackButton/BackButton'; |
|
|
|
|
import { appEvents } from 'app/core/core'; |
|
|
|
|
import { SaveDashboardModalProxy } from '../SaveDashboard/SaveDashboardModalProxy'; |
|
|
|
|
|
|
|
|
|
interface OwnProps { |
|
|
|
|
dashboard: DashboardModel; |
|
|
|
@ -82,6 +84,17 @@ export class PanelEditorUnconnected extends PureComponent<Props> { |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onOpenDashboardSettings = () => { |
|
|
|
|
this.props.updateLocation({ query: { editview: 'settings' }, partial: true }); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onSaveDashboard = () => { |
|
|
|
|
appEvents.emit(CoreEvents.showModalReact, { |
|
|
|
|
component: SaveDashboardModalProxy, |
|
|
|
|
props: { dashboard: this.props.dashboard }, |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onChangeTab = (tab: PanelEditorTab) => { |
|
|
|
|
this.props.updateLocation({ query: { tab: tab.id }, partial: true }); |
|
|
|
|
}; |
|
|
|
@ -107,8 +120,14 @@ export class PanelEditorUnconnected extends PureComponent<Props> { |
|
|
|
|
this.forceUpdate(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onDragFinished = (pane: Pane, size: number) => { |
|
|
|
|
onDragFinished = (pane: Pane, size?: number) => { |
|
|
|
|
document.body.style.cursor = 'auto'; |
|
|
|
|
|
|
|
|
|
// When the drag handle is just clicked size is undefined
|
|
|
|
|
if (!size) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const targetPane = pane === Pane.Top ? 'topPaneSize' : 'rightPaneSize'; |
|
|
|
|
const { updatePanelEditorUIState } = this.props; |
|
|
|
|
updatePanelEditorUIState({ |
|
|
|
@ -228,12 +247,27 @@ export class PanelEditorUnconnected extends PureComponent<Props> { |
|
|
|
|
</div> |
|
|
|
|
<div className={styles.toolbarLeft}> |
|
|
|
|
<div className={styles.toolbarItem}> |
|
|
|
|
<Button onClick={this.onDiscard} variant="secondary"> |
|
|
|
|
Discard changes |
|
|
|
|
<Button |
|
|
|
|
icon="cog" |
|
|
|
|
onClick={this.onOpenDashboardSettings} |
|
|
|
|
variant="secondary" |
|
|
|
|
title="Open dashboad settings" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div className={styles.toolbarItem}> |
|
|
|
|
<Button onClick={this.onDiscard} variant="secondary" title="Undo all changes"> |
|
|
|
|
Discard |
|
|
|
|
</Button> |
|
|
|
|
</div> |
|
|
|
|
<div className={styles.toolbarItem}> |
|
|
|
|
<Button onClick={this.onPanelExit}>Apply</Button> |
|
|
|
|
<Button onClick={this.onSaveDashboard} variant="secondary" title="Apply changes and save dashboard"> |
|
|
|
|
Save |
|
|
|
|
</Button> |
|
|
|
|
</div> |
|
|
|
|
<div className={styles.toolbarItem}> |
|
|
|
|
<Button onClick={this.onPanelExit} title="Apply changes and go back to dashboard"> |
|
|
|
|
Apply |
|
|
|
|
</Button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -335,7 +369,7 @@ enum Pane { |
|
|
|
|
/* |
|
|
|
|
* Styles |
|
|
|
|
*/ |
|
|
|
|
const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => { |
|
|
|
|
export const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => { |
|
|
|
|
const { uiState } = props; |
|
|
|
|
const handleColor = theme.palette.blue95; |
|
|
|
|
const paneSpaceing = theme.spacing.md; |
|
|
|
@ -361,7 +395,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => { |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
position: fixed; |
|
|
|
|
z-index: ${theme.zIndex.modal}; |
|
|
|
|
z-index: ${theme.zIndex.sidemenu}; |
|
|
|
|
top: 0; |
|
|
|
|
left: 0; |
|
|
|
|
right: 0; |
|
|
|
|