Dashboards: Show copy menu item to editors (regardless of dashboard edit state) (#64826)

This commit is contained in:
Ryan McKinley 2023-03-21 07:15:45 -07:00 committed by GitHub
parent 24ecc7d0dc
commit a0d440fb03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,8 +187,8 @@ export function getPanelMenu(
const subMenu: PanelMenuItem[] = [];
const canEdit = dashboard.canEditPanel(panel);
if (canEdit && !(panel.isViewing || panel.isEditing)) {
if (!(panel.isViewing || panel.isEditing)) {
if (canEdit) {
subMenu.push({
text: t('panel.header-menu.duplicate', `Duplicate`),
onClick: onDuplicatePanel,
@ -211,6 +211,13 @@ export function getPanelMenu(
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,
});
}
}
// add old angular panel options