[ARVADOS-WORKBENCH2] created: 1.4.1-261-g070f8413

Git user git at public.arvados.org
Wed Feb 5 15:25:07 UTC 2020


        at  070f84137b216212da7eac806710df5d0c479bba (commit)


commit 070f84137b216212da7eac806710df5d0c479bba
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Feb 5 12:23:14 2020 -0300

    16116: Unifies collections and projects update handling with process.
    
    Fields should be passed explicitly to the api server to avoid unwanted
    (and illegal) fields to eventually infiltrate on the api request call.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/store/collections/collection-update-actions.ts b/src/store/collections/collection-update-actions.ts
index 5b176bea..f8fac398 100644
--- a/src/store/collections/collection-update-actions.ts
+++ b/src/store/collections/collection-update-actions.ts
@@ -10,30 +10,29 @@ import { dialogActions } from "~/store/dialog/dialog-actions";
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
 import { ServiceRepository } from "~/services/services";
 import { CollectionResource } from '~/models/collection';
-import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
 import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
 
 export interface CollectionUpdateFormDialogData {
     uuid: string;
     name: string;
-    description: string;
+    description?: string;
 }
 
 export const COLLECTION_UPDATE_FORM_NAME = 'collectionUpdateFormName';
 
-export const openCollectionUpdateDialog = (resource: ContextMenuResource) =>
+export const openCollectionUpdateDialog = (resource: CollectionUpdateFormDialogData) =>
     (dispatch: Dispatch) => {
         dispatch(initialize(COLLECTION_UPDATE_FORM_NAME, resource));
         dispatch(dialogActions.OPEN_DIALOG({ id: COLLECTION_UPDATE_FORM_NAME, data: {} }));
     };
 
-export const updateCollection = (collection: Partial<CollectionResource>) =>
+export const updateCollection = (collection: CollectionUpdateFormDialogData) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const uuid = collection.uuid || '';
         dispatch(startSubmit(COLLECTION_UPDATE_FORM_NAME));
         dispatch(progressIndicatorActions.START_WORKING(COLLECTION_UPDATE_FORM_NAME));
         try {
-            const updatedCollection = await services.collectionService.update(uuid, collection);
+            const updatedCollection = await services.collectionService.update(uuid, { name: collection.name, description: collection.description });
             dispatch(collectionPanelActions.LOAD_COLLECTION_SUCCESS({ item: updatedCollection as CollectionResource }));
             dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_UPDATE_FORM_NAME }));
             dispatch(progressIndicatorActions.STOP_WORKING(COLLECTION_UPDATE_FORM_NAME));
diff --git a/src/store/projects/project-update-actions.ts b/src/store/projects/project-update-actions.ts
index 2449b9ce..2cb02788 100644
--- a/src/store/projects/project-update-actions.ts
+++ b/src/store/projects/project-update-actions.ts
@@ -8,32 +8,28 @@ import { RootState } from "~/store/store";
 import { dialogActions } from "~/store/dialog/dialog-actions";
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
 import { ServiceRepository } from "~/services/services";
-import { ProjectResource } from '~/models/project';
-import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
-import { getResource } from '~/store/resources/resources';
 import { projectPanelActions } from '~/store/project-panel/project-panel-action';
 
 export interface ProjectUpdateFormDialogData {
     uuid: string;
     name: string;
-    description: string;
+    description?: string;
 }
 
 export const PROJECT_UPDATE_FORM_NAME = 'projectUpdateFormName';
 
-export const openProjectUpdateDialog = (resource: ContextMenuResource) =>
+export const openProjectUpdateDialog = (resource: ProjectUpdateFormDialogData) =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        const project = getResource(resource.uuid)(getState().resources);
-        dispatch(initialize(PROJECT_UPDATE_FORM_NAME, project));
+        dispatch(initialize(PROJECT_UPDATE_FORM_NAME, resource));
         dispatch(dialogActions.OPEN_DIALOG({ id: PROJECT_UPDATE_FORM_NAME, data: {} }));
     };
 
-export const updateProject = (project: Partial<ProjectResource>) =>
+export const updateProject = (project: ProjectUpdateFormDialogData) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const uuid = project.uuid || '';
         dispatch(startSubmit(PROJECT_UPDATE_FORM_NAME));
         try {
-            const updatedProject = await services.projectService.update(uuid, project);
+            const updatedProject = await services.projectService.update(uuid, { name: project.name, description: project.description });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_UPDATE_FORM_NAME }));
             return updatedProject;

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list