|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
import { t } from '@lingui/macro'; |
|
|
|
|
|
|
|
|
|
import { PanelMenuItem } from '@grafana/data'; |
|
|
|
|
import { AngularComponent, getDataSourceSrv, locationService } from '@grafana/runtime'; |
|
|
|
|
import { PanelCtrl } from 'app/angular/panel/panel_ctrl'; |
|
|
|
@ -90,8 +92,12 @@ export function getPanelMenu( |
|
|
|
|
const menu: PanelMenuItem[] = []; |
|
|
|
|
|
|
|
|
|
if (!panel.isEditing) { |
|
|
|
|
const viewTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.view', |
|
|
|
|
message: `View`, |
|
|
|
|
}); |
|
|
|
|
menu.push({ |
|
|
|
|
text: 'View', |
|
|
|
|
text: viewTextTranslation, |
|
|
|
|
iconClassName: 'eye', |
|
|
|
|
onClick: onViewPanel, |
|
|
|
|
shortcut: 'v', |
|
|
|
@ -107,8 +113,13 @@ export function getPanelMenu( |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const shareTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.share', |
|
|
|
|
message: `Share`, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
menu.push({ |
|
|
|
|
text: 'Share', |
|
|
|
|
text: shareTextTranslation, |
|
|
|
|
iconClassName: 'share-alt', |
|
|
|
|
onClick: onSharePanel, |
|
|
|
|
shortcut: 'p s', |
|
|
|
@ -127,8 +138,13 @@ export function getPanelMenu( |
|
|
|
|
|
|
|
|
|
// Only show these inspect actions for data plugins
|
|
|
|
|
if (panel.plugin && !panel.plugin.meta.skipDataQuery) { |
|
|
|
|
const dataTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.inspect-data', |
|
|
|
|
message: `Data`, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
inspectMenu.push({ |
|
|
|
|
text: 'Data', |
|
|
|
|
text: dataTextTranslation, |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel('data'), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -140,14 +156,23 @@ export function getPanelMenu( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const jsonTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.inspect-json', |
|
|
|
|
message: `Panel JSON`, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
inspectMenu.push({ |
|
|
|
|
text: 'Panel JSON', |
|
|
|
|
text: jsonTextTranslation, |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel('json'), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const inspectTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.inspect', |
|
|
|
|
message: `Inspect`, |
|
|
|
|
}); |
|
|
|
|
menu.push({ |
|
|
|
|
type: 'submenu', |
|
|
|
|
text: 'Inspect', |
|
|
|
|
text: inspectTextTranslation, |
|
|
|
|
iconClassName: 'info-circle', |
|
|
|
|
onClick: (e: React.MouseEvent<any>) => onInspectPanel(), |
|
|
|
|
shortcut: 'i', |
|
|
|
@ -205,9 +230,13 @@ export function getPanelMenu( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!panel.isEditing && subMenu.length) { |
|
|
|
|
const moreTextTranslation = t({ |
|
|
|
|
id: 'panel.header-menu.more', |
|
|
|
|
message: `More...`, |
|
|
|
|
}); |
|
|
|
|
menu.push({ |
|
|
|
|
type: 'submenu', |
|
|
|
|
text: 'More...', |
|
|
|
|
text: moreTextTranslation, |
|
|
|
|
iconClassName: 'cube', |
|
|
|
|
subMenu, |
|
|
|
|
onClick: onMore, |
|
|
|
|