X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/25216cc7acedc987c26a159f0b640210c0ef101e..f1e1967ba28a81ff43b7229dbee27dd5e0ba6c13:/src/store/collections/collection-update-actions.ts diff --git a/src/store/collections/collection-update-actions.ts b/src/store/collections/collection-update-actions.ts index 3f3b662fc9..bf9c64492d 100644 --- a/src/store/collections/collection-update-actions.ts +++ b/src/store/collections/collection-update-actions.ts @@ -3,7 +3,13 @@ // SPDX-License-Identifier: AGPL-3.0 import { Dispatch } from "redux"; -import { FormErrors, initialize, startSubmit, stopSubmit } from 'redux-form'; +import { + FormErrors, + formValueSelector, + initialize, + startSubmit, + stopSubmit +} from 'redux-form'; import { RootState } from "store/store"; import { collectionPanelActions } from "store/collection-panel/collection-panel-action"; import { dialogActions } from "store/dialog/dialog-actions"; @@ -14,14 +20,20 @@ import { progressIndicatorActions } from "store/progress-indicator/progress-indi import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions"; import { updateResources } from "../resources/resources-actions"; import { loadDetailsPanel } from "../details-panel/details-panel-action"; +import { getResource } from "store/resources/resources"; +import { CollectionProperties } from "./collection-create-actions"; export interface CollectionUpdateFormDialogData { uuid: string; name: string; description?: string; + storageClassesDesired?: string[]; + properties?: CollectionProperties; } export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateFormName'; +export const COLLECTION_UPDATE_PROPERTIES_FORM_NAME = "collectionUpdatePropertiesFormName"; +export const COLLECTION_UPDATE_FORM_SELECTOR = formValueSelector(COLLECTION_UPDATE_FORM_NAME); export const openCollectionUpdateDialog = (resource: CollectionUpdateFormDialogData) => (dispatch: Dispatch) => { @@ -35,11 +47,15 @@ export const updateCollection = (collection: CollectionUpdateFormDialogData) => dispatch(startSubmit(COLLECTION_UPDATE_FORM_NAME)); dispatch(progressIndicatorActions.START_WORKING(COLLECTION_UPDATE_FORM_NAME)); + const cachedCollection = getResource(collection.uuid)(getState().resources); services.collectionService.update(uuid, { name: collection.name, - description: collection.description } + storageClassesDesired: collection.storageClassesDesired, + description: collection.description, + properties: collection.properties } ).then(updatedCollection => { - dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: updatedCollection as CollectionResource })); + updatedCollection = {...cachedCollection, ...updatedCollection}; + dispatch(collectionPanelActions.SET_COLLECTION(updatedCollection)); dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_UPDATE_FORM_NAME })); dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_UPDATE_FORM_NAME)); dispatch(snackbarActions.OPEN_SNACKBAR({