|
|
|
|
@ -109,9 +109,8 @@ export function getPanelMenu( |
|
|
|
|
const menu: PanelMenuItem[] = []; |
|
|
|
|
|
|
|
|
|
if (!panel.isEditing) { |
|
|
|
|
const viewTextTranslation = t('panel.header-menu.view', `View`); |
|
|
|
|
menu.push({ |
|
|
|
|
text: viewTextTranslation, |
|
|
|
|
text: t('panel.header-menu.view', `View`), |
|
|
|
|
iconClassName: 'eye', |
|
|
|
|
onClick: onViewPanel, |
|
|
|
|
shortcut: 'v', |
|
|
|
|
@ -120,7 +119,7 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
if (dashboard.canEditPanel(panel) && !panel.isEditing) { |
|
|
|
|
menu.push({ |
|
|
|
|
text: 'Edit', |
|
|
|
|
text: t('panel.header-menu.edit', `Edit`), |
|
|
|
|
iconClassName: 'edit', |
|
|
|
|
onClick: onEditPanel, |
|
|
|
|
shortcut: 'e', |
|
|
|
|
@ -138,10 +137,8 @@ export function getPanelMenu( |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const shareTextTranslation = t('panel.header-menu.share', `Share`); |
|
|
|
|
|
|
|
|
|
menu.push({ |
|
|
|
|
text: shareTextTranslation, |
|
|
|
|
text: t('panel.header-menu.share', `Share`), |
|
|
|
|
iconClassName: 'share-alt', |
|
|
|
|
onClick: onSharePanel, |
|
|
|
|
shortcut: 'p s', |
|
|
|
|
@ -149,7 +146,7 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
if (contextSrv.hasAccessToExplore() && !(panel.plugin && panel.plugin.meta.skipDataQuery)) { |
|
|
|
|
menu.push({ |
|
|
|
|
text: 'Explore', |
|
|
|
|
text: t('panel.header-menu.explore', `Explore`), |
|
|
|
|
iconClassName: 'compass', |
|
|
|
|
onClick: onNavigateToExplore, |
|
|
|
|
shortcut: 'x', |
|
|
|
|
@ -160,33 +157,27 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
// Only show these inspect actions for data plugins
|
|
|
|
|
if (panel.plugin && !panel.plugin.meta.skipDataQuery) { |
|
|
|
|
const dataTextTranslation = t('panel.header-menu.inspect-data', `Data`); |
|
|
|
|
|
|
|
|
|
inspectMenu.push({ |
|
|
|
|
text: dataTextTranslation, |
|
|
|
|
text: t('panel.header-menu.inspect-data', `Data`), |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel(InspectTab.Data), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (dashboard.meta.canEdit) { |
|
|
|
|
inspectMenu.push({ |
|
|
|
|
text: 'Query', |
|
|
|
|
text: t('panel.header-menu.query', `Query`), |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel(InspectTab.Query), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const jsonTextTranslation = t('panel.header-menu.inspect-json', `Panel JSON`); |
|
|
|
|
|
|
|
|
|
inspectMenu.push({ |
|
|
|
|
text: jsonTextTranslation, |
|
|
|
|
text: t('panel.header-menu.inspect-json', `Panel JSON`), |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel(InspectTab.JSON), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const inspectTextTranslation = t('panel.header-menu.inspect', `Inspect`); |
|
|
|
|
|
|
|
|
|
menu.push({ |
|
|
|
|
type: 'submenu', |
|
|
|
|
text: inspectTextTranslation, |
|
|
|
|
text: t('panel.header-menu.inspect', `Inspect`), |
|
|
|
|
iconClassName: 'info-circle', |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel(), |
|
|
|
|
shortcut: 'i', |
|
|
|
|
@ -198,24 +189,24 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
if (canEdit && !(panel.isViewing || panel.isEditing)) { |
|
|
|
|
subMenu.push({ |
|
|
|
|
text: 'Duplicate', |
|
|
|
|
text: t('panel.header-menu.duplicate', `Duplicate`), |
|
|
|
|
onClick: onDuplicatePanel, |
|
|
|
|
shortcut: 'p d', |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
subMenu.push({ |
|
|
|
|
text: 'Copy', |
|
|
|
|
text: t('panel.header-menu.copy', `Copy`), |
|
|
|
|
onClick: onCopyPanel, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (isPanelModelLibraryPanel(panel)) { |
|
|
|
|
subMenu.push({ |
|
|
|
|
text: 'Unlink library panel', |
|
|
|
|
text: t('panel.header-menu.unlink-library-panel', `Unlink library panel`), |
|
|
|
|
onClick: onUnlinkLibraryPanel, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
subMenu.push({ |
|
|
|
|
text: 'Create library panel', |
|
|
|
|
text: t('panel.header-menu.create-library-panel', `Create library panel`), |
|
|
|
|
onClick: onAddLibraryPanel, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -261,16 +252,15 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
if (canEdit && panel.plugin && !panel.plugin.meta.skipDataQuery) { |
|
|
|
|
subMenu.push({ |
|
|
|
|
text: 'Get help', |
|
|
|
|
text: t('panel.header-menu.get-help', 'Get help'), |
|
|
|
|
onClick: (e: React.MouseEvent) => onInspectPanel(InspectTab.Help), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (subMenu.length) { |
|
|
|
|
const moreTextTranslation = t('panel.header-menu.more', `More...`); |
|
|
|
|
menu.push({ |
|
|
|
|
type: 'submenu', |
|
|
|
|
text: moreTextTranslation, |
|
|
|
|
text: t('panel.header-menu.more', `More...`), |
|
|
|
|
iconClassName: 'cube', |
|
|
|
|
subMenu, |
|
|
|
|
onClick: onMore, |
|
|
|
|
@ -281,7 +271,7 @@ export function getPanelMenu( |
|
|
|
|
menu.push({ type: 'divider', text: '' }); |
|
|
|
|
|
|
|
|
|
menu.push({ |
|
|
|
|
text: 'Remove', |
|
|
|
|
text: t('panel.header-menu.remove', `Remove`), |
|
|
|
|
iconClassName: 'trash-alt', |
|
|
|
|
onClick: onRemovePanel, |
|
|
|
|
shortcut: 'p r', |
|
|
|
|
|