mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* LibraryPanels: Prevents deletion of connected library panels * Refactor: adds the delete library panel modal * Chore: updates after PR comments
18 lines
726 B
TypeScript
18 lines
726 B
TypeScript
import { DispatchResult, LibraryPanelDTO } from '../../types';
|
|
import { getLibraryPanelConnectedDashboards } from '../../state/api';
|
|
import { getBackendSrv } from '../../../../core/services/backend_srv';
|
|
import { searchCompleted } from './reducer';
|
|
|
|
export function getConnectedDashboards(libraryPanel: LibraryPanelDTO): DispatchResult {
|
|
return async function (dispatch) {
|
|
const connectedDashboards = await getLibraryPanelConnectedDashboards(libraryPanel.uid);
|
|
if (!connectedDashboards.length) {
|
|
dispatch(searchCompleted({ dashboards: [] }));
|
|
return;
|
|
}
|
|
|
|
const dashboards = await getBackendSrv().search({ dashboardIds: connectedDashboards });
|
|
dispatch(searchCompleted({ dashboards }));
|
|
};
|
|
}
|