File tree 3 files changed +15
-3
lines changed
src/plugins/dashboard/public
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import 'angular-sanitize';
37
37
import { i18nDirective , i18nFilter , I18nProvider } from '@osd/i18n/angular' ;
38
38
import {
39
39
ChromeStart ,
40
+ ToastsStart ,
40
41
IUiSettingsClient ,
41
42
CoreStart ,
42
43
SavedObjectsClientContract ,
@@ -93,6 +94,7 @@ export interface RenderDeps {
93
94
setHeaderActionMenu : AppMountParameters [ 'setHeaderActionMenu' ] ;
94
95
savedObjects : SavedObjectsStart ;
95
96
restorePreviousUrl : ( ) => void ;
97
+ toastNotifications : ToastsStart ;
96
98
}
97
99
98
100
let angularModuleInstance : IModule | null = null ;
Original file line number Diff line number Diff line change @@ -114,7 +114,6 @@ export function initDashboardApp(app, deps) {
114
114
deps . core . chrome . docTitle . change (
115
115
i18n . translate ( 'dashboard.dashboardPageTitle' , { defaultMessage : 'Dashboards' } )
116
116
) ;
117
- const service = deps . savedDashboards ;
118
117
const dashboardConfig = deps . dashboardConfig ;
119
118
120
119
// syncs `_g` portion of url with query services
@@ -171,7 +170,18 @@ export function initDashboardApp(app, deps) {
171
170
history . push ( deps . addBasePath ( viewUrl ) ) ;
172
171
} ;
173
172
$scope . delete = ( dashboards ) => {
174
- return service . delete ( dashboards . map ( ( d ) => d . id ) ) ;
173
+ const ids = dashboards . map ( ( d ) => ( { id : d . id , appId : d . appId } ) ) ;
174
+ return Promise . all (
175
+ ids . map ( ( { id, appId } ) => {
176
+ return deps . savedObjectsClient . delete ( appId , id ) ;
177
+ } )
178
+ ) . catch ( ( error ) => {
179
+ deps . toastNotifications . addError ( error , {
180
+ title : i18n . translate ( 'dashboard.dashboardListingDeleteErrorTitle' , {
181
+ defaultMessage : 'Error deleting dashboard' ,
182
+ } ) ,
183
+ } ) ;
184
+ } ) ;
175
185
} ;
176
186
$scope . hideWriteControls = dashboardConfig . getHideWriteControls ( ) ;
177
187
$scope . initialFilter = parse ( history . location . search ) . filter || EMPTY_FILTER ;
Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ export class DashboardPlugin
344
344
registerDashboardProvider ( {
345
345
savedObjectsType : 'dashboard' ,
346
346
savedObjectsName : 'Dashboard' ,
347
- appId : 'dashboards ' ,
347
+ appId : 'dashboard ' ,
348
348
viewUrlPathFn : ( obj ) => `#/view/${ obj . id } ` ,
349
349
editUrlPathFn : ( obj ) => `/view/${ obj . id } ?_a=(viewMode:edit)` ,
350
350
createUrl : core . http . basePath . prepend ( '/app/dashboards#/create' ) ,
You can’t perform that action at this time.
0 commit comments