|
|
|
@ -64,7 +64,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
text: t('panel.header-menu.view', `View`), |
|
|
|
|
iconClassName: 'eye', |
|
|
|
|
shortcut: 'v', |
|
|
|
|
onClick: () => DashboardInteractions.panelMenuItemClicked('view'), |
|
|
|
|
href: getViewPanelUrl(panel), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -76,7 +75,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
text: t('panel.header-menu.edit', `Edit`), |
|
|
|
|
iconClassName: 'edit', |
|
|
|
|
shortcut: 'e', |
|
|
|
|
onClick: () => DashboardInteractions.panelMenuItemClicked('edit'), |
|
|
|
|
href: getEditPanelUrl(getPanelIdForVizPanel(panel)), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -111,7 +109,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
text: t('panel.header-menu.share', 'Share'), |
|
|
|
|
iconClassName: 'share-alt', |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('share'); |
|
|
|
|
dashboard.showModal(new ShareModal({ panelRef: panel.getRef() })); |
|
|
|
|
}, |
|
|
|
|
shortcut: 'p s', |
|
|
|
@ -122,7 +119,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
moreSubMenu.push({ |
|
|
|
|
text: t('panel.header-menu.duplicate', `Duplicate`), |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('duplicate'); |
|
|
|
|
dashboard.duplicatePanel(panel); |
|
|
|
|
}, |
|
|
|
|
shortcut: 'p d', |
|
|
|
@ -133,7 +129,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
moreSubMenu.push({ |
|
|
|
|
text: t('panel.header-menu.copy', `Copy`), |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('copy'); |
|
|
|
|
dashboard.copyPanel(panel); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
@ -144,7 +139,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
moreSubMenu.push({ |
|
|
|
|
text: t('panel.header-menu.unlink-library-panel', `Unlink library panel`), |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('unlinkLibraryPanel'); |
|
|
|
|
dashboard.showModal( |
|
|
|
|
new UnlinkLibraryPanelModal({ |
|
|
|
|
panelRef: parent.getRef(), |
|
|
|
@ -156,7 +150,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
moreSubMenu.push({ |
|
|
|
|
text: t('panel.header-menu.replace-library-panel', `Replace library panel`), |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('replaceLibraryPanel'); |
|
|
|
|
dashboard.onShowAddLibraryPanelDrawer(parent.getRef()); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
@ -164,7 +157,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
moreSubMenu.push({ |
|
|
|
|
text: t('panel.header-menu.create-library-panel', `Create library panel`), |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('createLibraryPanel'); |
|
|
|
|
dashboard.showModal( |
|
|
|
|
new ShareModal({ |
|
|
|
|
panelRef: panel.getRef(), |
|
|
|
@ -253,7 +245,6 @@ export function panelMenuBehavior(menu: VizPanelMenu, isRepeat = false) { |
|
|
|
|
text: t('panel.header-menu.remove', `Remove`), |
|
|
|
|
iconClassName: 'trash-alt', |
|
|
|
|
onClick: () => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('remove'); |
|
|
|
|
onRemovePanel(dashboard, panel); |
|
|
|
|
}, |
|
|
|
|
shortcut: 'p r', |
|
|
|
@ -278,7 +269,6 @@ async function getExploreMenuItem(panel: VizPanel): Promise<PanelMenuItem | unde |
|
|
|
|
text: t('panel.header-menu.explore', `Explore`), |
|
|
|
|
iconClassName: 'compass', |
|
|
|
|
shortcut: 'p x', |
|
|
|
|
onClick: () => DashboardInteractions.panelMenuItemClicked('explore'), |
|
|
|
|
href: exploreUrl, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
@ -297,7 +287,6 @@ function getInspectMenuItem( |
|
|
|
|
onClick: (e) => { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
locationService.partial({ inspect: panel.state.key, inspectTab: InspectTab.Data }); |
|
|
|
|
DashboardInteractions.panelMenuInspectClicked(InspectTab.Data); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -308,7 +297,6 @@ function getInspectMenuItem( |
|
|
|
|
onClick: (e) => { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
locationService.partial({ inspect: panel.state.key, inspectTab: InspectTab.Query }); |
|
|
|
|
DashboardInteractions.panelMenuInspectClicked(InspectTab.Query); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -320,7 +308,6 @@ function getInspectMenuItem( |
|
|
|
|
onClick: (e) => { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
locationService.partial({ inspect: panel.state.key, inspectTab: InspectTab.JSON }); |
|
|
|
|
DashboardInteractions.panelMenuInspectClicked(InspectTab.JSON); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -332,7 +319,6 @@ function getInspectMenuItem( |
|
|
|
|
onClick: (e) => { |
|
|
|
|
if (!e.isDefaultPrevented()) { |
|
|
|
|
locationService.partial({ inspect: panel.state.key, inspectTab: InspectTab.Data }); |
|
|
|
|
DashboardInteractions.panelMenuInspectClicked(InspectTab.Data); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
subMenu: inspectSubMenu.length > 0 ? inspectSubMenu : undefined, |
|
|
|
@ -447,17 +433,12 @@ export function onRemovePanel(dashboard: DashboardScene, panel: VizPanel) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const onCreateAlert = async (panel: VizPanel) => { |
|
|
|
|
DashboardInteractions.panelMenuItemClicked('create-alert'); |
|
|
|
|
|
|
|
|
|
const formValues = await scenesPanelToRuleFormValues(panel); |
|
|
|
|
const ruleFormUrl = urlUtil.renderUrl('/alerting/new', { |
|
|
|
|
defaults: JSON.stringify(formValues), |
|
|
|
|
returnTo: location.pathname + location.search, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
locationService.push(ruleFormUrl); |
|
|
|
|
|
|
|
|
|
DashboardInteractions.panelMenuItemClicked('create-alert'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export function toggleVizPanelLegend(vizPanel: VizPanel): void { |
|
|
|
@ -469,8 +450,6 @@ export function toggleVizPanelLegend(vizPanel: VizPanel): void { |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DashboardInteractions.panelMenuItemClicked('toggleLegend'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function hasLegendOptions(optionsWithLegend: unknown): optionsWithLegend is OptionsWithLegend { |
|
|
|
@ -482,5 +461,4 @@ const onInspectPanel = (vizPanel: VizPanel, tab?: InspectTab) => { |
|
|
|
|
inspect: vizPanel.state.key, |
|
|
|
|
inspectTab: tab, |
|
|
|
|
}); |
|
|
|
|
DashboardInteractions.panelMenuInspectClicked(tab ?? InspectTab.Data); |
|
|
|
|
}; |
|
|
|
|