From: Lucas Di Pentima Date: Wed, 5 Feb 2020 22:02:54 +0000 (-0300) Subject: Merge branch '16067-collection-copy-fix' X-Git-Tag: 2.0.0 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/79ba1fb04fca00e440b47d28eb37f2127716343f?hp=7791be98d3982a01c56c336b6f67db5c4af59ea1 Merge branch '16067-collection-copy-fix' Closes #16067 Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- 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) => +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) => +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;