File tree 1 file changed +12
-5
lines changed
src/plugins/dashboard/public/application/components
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,14 @@ export const DashboardListing = () => {
31
31
history,
32
32
uiSettings,
33
33
notifications,
34
- savedDashboards,
35
34
dashboardProviders,
36
35
data : { query } ,
37
36
osdUrlStateStorage,
38
37
} ,
39
38
} = useOpenSearchDashboards < DashboardServices > ( ) ;
40
39
41
40
const location = useLocation ( ) ;
42
- const queryParameters = new URLSearchParams ( location . search ) ;
41
+ const queryParameters = useMemo ( ( ) => new URLSearchParams ( location . search ) , [ location ] ) ;
43
42
const initialFiltersFromURL = queryParameters . get ( 'filter' ) ;
44
43
const [ initialFilter , setInitialFilter ] = useState < string | null > ( initialFiltersFromURL ) ;
45
44
@@ -168,10 +167,18 @@ export const DashboardListing = () => {
168
167
// );
169
168
170
169
const deleteItems = useCallback (
171
- ( dashboards : object [ ] ) => {
172
- return savedDashboards . delete ( dashboards . map ( ( d : any ) => d . id ) ) ;
170
+ async ( dashboards : object [ ] ) => {
171
+ await Promise . all (
172
+ dashboards . map ( ( dashboard : any ) => savedObjectsClient . delete ( dashboard . appId , dashboard . id ) )
173
+ ) . catch ( ( error ) => {
174
+ notifications . toasts . addError ( error , {
175
+ title : i18n . translate ( 'dashboard.dashboardListingDeleteErrorTitle' , {
176
+ defaultMessage : 'Error deleting dashboard' ,
177
+ } ) ,
178
+ } ) ;
179
+ } ) ;
173
180
} ,
174
- [ savedDashboards ]
181
+ [ savedObjectsClient , notifications ]
175
182
) ;
176
183
177
184
useMount ( ( ) => {
You can’t perform that action at this time.
0 commit comments