18787: Removes unnecessary action.
[arvados-workbench2.git] / src / store / collections / collection-update-actions.ts
index 0096bc4828c1642926c3f00c0a4fa3b604a22935..bf9c64492d79cef6a5f6a75708436866a9700e0b 100644 (file)
@@ -4,7 +4,6 @@
 
 import { Dispatch } from "redux";
 import {
-    change,
     FormErrors,
     formValueSelector,
     initialize,
@@ -23,8 +22,6 @@ 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";
-import { ResourcePropertiesFormData } from "views-components/resource-properties-form/resource-properties-form";
-import { addProperty, deleteProperty } from "lib/resource-properties";
 
 export interface CollectionUpdateFormDialogData {
     uuid: string;
@@ -35,7 +32,7 @@ export interface CollectionUpdateFormDialogData {
 }
 
 export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateFormName';
-export const COLLECTION_UPDATE_PROPERTIES_FORM_NAME = "collectionCreatePropertiesFormName";
+export const COLLECTION_UPDATE_PROPERTIES_FORM_NAME = "collectionUpdatePropertiesFormName";
 export const COLLECTION_UPDATE_FORM_SELECTOR = formValueSelector(COLLECTION_UPDATE_FORM_NAME);
 
 export const openCollectionUpdateDialog = (resource: CollectionUpdateFormDialogData) =>
@@ -58,7 +55,7 @@ export const updateCollection = (collection: CollectionUpdateFormDialogData) =>
             properties: collection.properties }
         ).then(updatedCollection => {
             updatedCollection = {...cachedCollection, ...updatedCollection};
-            dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: updatedCollection as CollectionResource }));
+            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({
@@ -83,23 +80,3 @@ export const updateCollection = (collection: CollectionUpdateFormDialogData) =>
             }
         );
     };
-
-export const addPropertyToUpdateCollectionForm = (data: ResourcePropertiesFormData) =>
-    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const properties = { ...COLLECTION_UPDATE_FORM_SELECTOR(getState(), 'properties') };
-        const key = data.keyID || data.key;
-        const value =  data.valueID || data.value;
-        dispatch(change(
-            COLLECTION_UPDATE_FORM_NAME,
-            'properties',
-            addProperty(properties, key, value)));
-    };
-
-export const removePropertyFromUpdateCollectionForm = (key: string, value: string) =>
-    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const properties = { ...COLLECTION_UPDATE_FORM_SELECTOR(getState(), 'properties') };
-        dispatch(change(
-            COLLECTION_UPDATE_FORM_NAME,
-            'properties',
-            deleteProperty(properties, key, value)));
-    };