Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async dispatch => {
const res = await getBackendSrv().put(`/api/folders/${folder.uid}`, {
title: folder.title,
version: folder.version,
});
// this should be redux action at some point
appEvents.emit(AppEvents.alertSuccess, ['Folder saved']);
dispatch(updateLocation({ path: `${res.url}/settings` }));
};
}
.then((res: PluginDashboard) => {
appEvents.emit(AppEvents.alertSuccess, ['Dashboard Imported', dash.title]);
extend(dash, res);
this.setState({ dashboards: [...this.state.dashboards] });
});
};
scope.clipboard.on('success', () => {
appEvents.emit(AppEvents.alertSuccess, ['Content copied to clipboard']);
});
onClipboardSuccess = () => {
appEvents.emit(AppEvents.alertSuccess, ['Content copied to clipboard']);
};
(results: any) => {
if (options.method !== 'GET') {
if (results && results.data.message) {
if (options.showSuccessAlert !== false) {
appEvents.emit(AppEvents.alertSuccess, [results.data.message]);
}
}
}
return results.data;
},
(err: any) => {
return this.backendSrv.createFolder({ title: this.title }).then((result: any) => {
appEvents.emit(AppEvents.alertSuccess, ['Folder Created', 'OK']);
this.$location.url(locationUtil.stripBaseFromUrl(result.url));
});
}
return this.backendSrv.moveDashboards(this.dashboards, this.folder).then((result: any) => {
if (result.successCount > 0) {
const header = `Dashboard${result.successCount === 1 ? '' : 's'} Moved`;
const msg = `${result.successCount} dashboard${result.successCount === 1 ? '' : 's'} moved to ${
this.folder.title
}`;
appEvents.emit(AppEvents.alertSuccess, [header, msg]);
}
if (result.totalCount === result.alreadyInFolderCount) {
appEvents.emit(AppEvents.alertError, ['Error', `Dashboards already belongs to folder ${this.folder.title}`]);
}
this.dismiss();
return this.afterSave();
});
}
(results: any) => {
if (options.method !== 'GET') {
if (results && results.data.message) {
if (options.showSuccessAlert !== false) {
appEvents.emit(AppEvents.alertSuccess, [results.data.message]);
}
}
}
return results.data;
},
(err: any) => {
export const copyPanel = (panel: PanelModel) => {
store.set(LS_PANEL_COPY_KEY, JSON.stringify(panel.getSaveModel()));
appEvents.emit(AppEvents.alertSuccess, ['Panel copied. Open Add Panel to paste']);
};
() => {
this.$scope.appEvent(AppEvents.alertSuccess, ['Playlist deleted']);
},
() => {