mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
hooked up actions
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
DashboardAclUpdateDTO,
|
||||
NewDashboardAclItem,
|
||||
} from 'app/types/acl';
|
||||
import appEvents from '../../../core/app_events';
|
||||
import { loadPluginDashboards } from '../../plugins/state/actions';
|
||||
|
||||
export enum ActionTypes {
|
||||
LoadDashboardPermissions = 'LOAD_DASHBOARD_PERMISSIONS',
|
||||
@@ -113,3 +115,18 @@ export function addDashboardPermission(dashboardId: number, newItem: NewDashboar
|
||||
await dispatch(getDashboardPermissions(dashboardId));
|
||||
};
|
||||
}
|
||||
|
||||
export function importDashboard(data, dashboardTitle: string): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
await getBackendSrv().post('/api/dashboards/import', data);
|
||||
appEvents.emit('alert-success', ['Dashboard Imported', dashboardTitle]);
|
||||
dispatch(loadPluginDashboards());
|
||||
};
|
||||
}
|
||||
|
||||
export function removeDashboard(uri: string): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
await getBackendSrv().delete(`/api/dashboards/${uri}`);
|
||||
dispatch(loadPluginDashboards());
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user