mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Show copy menu item to editors (regardless of dashboard edit state) (#64826)
This commit is contained in:
parent
24ecc7d0dc
commit
a0d440fb03
@ -187,28 +187,35 @@ export function getPanelMenu(
|
|||||||
|
|
||||||
const subMenu: PanelMenuItem[] = [];
|
const subMenu: PanelMenuItem[] = [];
|
||||||
const canEdit = dashboard.canEditPanel(panel);
|
const canEdit = dashboard.canEditPanel(panel);
|
||||||
|
if (!(panel.isViewing || panel.isEditing)) {
|
||||||
if (canEdit && !(panel.isViewing || panel.isEditing)) {
|
if (canEdit) {
|
||||||
subMenu.push({
|
|
||||||
text: t('panel.header-menu.duplicate', `Duplicate`),
|
|
||||||
onClick: onDuplicatePanel,
|
|
||||||
shortcut: 'p d',
|
|
||||||
});
|
|
||||||
|
|
||||||
subMenu.push({
|
|
||||||
text: t('panel.header-menu.copy', `Copy`),
|
|
||||||
onClick: onCopyPanel,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isPanelModelLibraryPanel(panel)) {
|
|
||||||
subMenu.push({
|
subMenu.push({
|
||||||
text: t('panel.header-menu.unlink-library-panel', `Unlink library panel`),
|
text: t('panel.header-menu.duplicate', `Duplicate`),
|
||||||
onClick: onUnlinkLibraryPanel,
|
onClick: onDuplicatePanel,
|
||||||
|
shortcut: 'p d',
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
subMenu.push({
|
subMenu.push({
|
||||||
text: t('panel.header-menu.create-library-panel', `Create library panel`),
|
text: t('panel.header-menu.copy', `Copy`),
|
||||||
onClick: onAddLibraryPanel,
|
onClick: onCopyPanel,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isPanelModelLibraryPanel(panel)) {
|
||||||
|
subMenu.push({
|
||||||
|
text: t('panel.header-menu.unlink-library-panel', `Unlink library panel`),
|
||||||
|
onClick: onUnlinkLibraryPanel,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
subMenu.push({
|
||||||
|
text: t('panel.header-menu.create-library-panel', `Create library panel`),
|
||||||
|
onClick: onAddLibraryPanel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (contextSrv.isEditor) {
|
||||||
|
// An editor but the dashboard is not editable
|
||||||
|
subMenu.push({
|
||||||
|
text: t('panel.header-menu.copy', `Copy`),
|
||||||
|
onClick: onCopyPanel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user