X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/44e89f6c8f0bb6d2ededea8ef107766f65b9bb6a..b130d8595d05d46f2f29ebe4c1cf3dff392bc26b:/src/store/collections/collection-upload-actions.ts diff --git a/src/store/collections/collection-upload-actions.ts b/src/store/collections/collection-upload-actions.ts index c410cf0492..0ca681b98e 100644 --- a/src/store/collections/collection-upload-actions.ts +++ b/src/store/collections/collection-upload-actions.ts @@ -3,20 +3,25 @@ // SPDX-License-Identifier: AGPL-3.0 import { Dispatch } from 'redux'; -import { RootState } from '~/store/store'; -import { ServiceRepository } from '~/services/services'; -import { dialogActions } from '~/store/dialog/dialog-actions'; +import { RootState } from 'store/store'; +import { ServiceRepository } from 'services/services'; +import { dialogActions } from 'store/dialog/dialog-actions'; import { loadCollectionFiles } from '../collection-panel/collection-panel-files/collection-panel-files-actions'; -import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; -import { fileUploaderActions } from '~/store/file-uploader/file-uploader-actions'; +import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions'; +import { fileUploaderActions } from 'store/file-uploader/file-uploader-actions'; import { reset, startSubmit, stopSubmit } from 'redux-form'; -import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions"; +import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; +import { collectionPanelFilesAction } from 'store/collection-panel/collection-panel-files/collection-panel-files-actions'; +import { createTree } from 'models/tree'; +import { loadCollectionPanel } from '../collection-panel/collection-panel-action'; +import * as WorkbenchActions from 'store/workbench/workbench-actions'; export const uploadCollectionFiles = (collectionUuid: string) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(fileUploaderActions.START_UPLOAD()); const files = getState().fileUploader.map(file => file.file); await services.collectionService.uploadFiles(collectionUuid, files, handleUploadProgress(dispatch)); + dispatch(WorkbenchActions.loadCollection(collectionUuid)); dispatch(fileUploaderActions.CLEAR_UPLOAD()); }; @@ -35,8 +40,10 @@ export const submitCollectionFiles = () => try { dispatch(progressIndicatorActions.START_WORKING(COLLECTION_UPLOAD_FILES_DIALOG)); dispatch(startSubmit(COLLECTION_UPLOAD_FILES_DIALOG)); - await dispatch(uploadCollectionFiles(currentCollection.uuid)); + await dispatch(uploadCollectionFiles(currentCollection.uuid)) + .then(() => dispatch(collectionPanelFilesAction.SET_COLLECTION_FILES({ files: createTree() }))); dispatch(loadCollectionFiles(currentCollection.uuid)); + dispatch(loadCollectionPanel(currentCollection.uuid)); dispatch(closeUploadCollectionFilesDialog()); dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Data has been uploaded.', @@ -52,7 +59,7 @@ export const submitCollectionFiles = () => hideDuration: 2000, kind: SnackbarKind.ERROR })); - dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_UPLOAD_FILES_DIALOG)); + dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_UPLOAD_FILES_DIALOG)); } } }; @@ -61,4 +68,4 @@ export const closeUploadCollectionFilesDialog = () => dialogActions.CLOSE_DIALOG const handleUploadProgress = (dispatch: Dispatch) => (fileId: number, loaded: number, total: number, currentTime: number) => { dispatch(fileUploaderActions.SET_UPLOAD_PROGRESS({ fileId, loaded, total, currentTime })); -}; +}; \ No newline at end of file