X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c00eef5dc15d93f40a8b24753688c8c40c69d819..9eaee66663fa21962f46e301ba6257ab63a9b10c:/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts index 4764d436..3f82d29e 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts @@ -7,7 +7,7 @@ import { Dispatch } from "redux"; import { CollectionFilesTree, CollectionFileType } from "~/models/collection-file"; import { ServiceRepository } from "~/services/services"; import { RootState } from "../../store"; -import { snackbarActions } from "../../snackbar/snackbar-actions"; +import { snackbarActions, SnackbarKind } from "../../snackbar/snackbar-actions"; import { dialogActions } from '../../dialog/dialog-actions'; import { getNodeValue } from "~/models/tree"; import { filterCollectionFilesBySelection } from './collection-panel-files-state'; @@ -37,10 +37,18 @@ export const removeCollectionFiles = (filePaths: string[]) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const currentCollection = getState().collectionPanel.item; if (currentCollection) { - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' })); - await services.collectionService.deleteFiles(currentCollection.uuid, filePaths); - dispatch(loadCollectionFiles(currentCollection.uuid)); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000 })); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing...' })); + try { + await services.collectionService.deleteFiles('', filePaths); + dispatch(loadCollectionFiles(currentCollection.uuid)); + dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000 })); + } catch (e) { + dispatch(snackbarActions.OPEN_SNACKBAR({ + message: 'Could not remove file.', + hideDuration: 2000, + kind: SnackbarKind.ERROR + })); + } } };