Dashboard: Disable creating library panels for provisioned dashboards (#102308)

This commit is contained in:
Alex Khomenko
2025-03-18 07:29:52 +02:00
committed by GitHub
parent 1a6ec71822
commit 20fcf443f8
2 changed files with 3 additions and 1 deletions

View File

@ -219,6 +219,7 @@ export function ToolbarActions({ dashboard }: Props) {
dashboard.onShowAddLibraryPanelDrawer();
DashboardInteractions.toolbarAddButtonClicked({ item: 'add_library_panel' });
}}
disabled={dashboard.isManaged()}
/>
<Menu.Item
key="add-row"

View File

@ -52,6 +52,7 @@ const DashboardEmpty = ({ dashboard, canCreate }: Props) => {
}
};
const isProvisioned = dashboard instanceof DashboardScene && dashboard.isManaged();
return (
<Stack alignItems="center" justifyContent="center">
<div className={styles.wrapper}>
@ -100,7 +101,7 @@ const DashboardEmpty = ({ dashboard, canCreate }: Props) => {
fill="outline"
data-testid={selectors.pages.AddDashboard.itemButton('Add a panel from the panel library button')}
onClick={onAddLibraryPanel}
disabled={!canCreate}
disabled={!canCreate || isProvisioned}
>
<Trans i18nKey="dashboard.empty.add-library-panel-button">Add library panel</Trans>
</Button>