[ARVADOS-WORKBENCH2] created: 1.2.0-937-gaebc1ac

Git user git at public.curoverse.com
Fri Nov 23 06:25:36 EST 2018


        at  aebc1ac220838aa4f849473f3dda8d121f6118af (commit)


commit aebc1ac220838aa4f849473f3dda8d121f6118af
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Fri Nov 23 12:25:11 2018 +0100

    moving, copying, renaming processes in final state
    
    Feature #14529
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/advanced-tab/advanced-tab.ts b/src/store/advanced-tab/advanced-tab.ts
index 6ad8af2..4ba2ddb 100644
--- a/src/store/advanced-tab/advanced-tab.ts
+++ b/src/store/advanced-tab/advanced-tab.ts
@@ -52,7 +52,7 @@ enum RepositoryData {
     CREATED_AT = 'created_at'
 }
 
-export const openAdvancedTabDialog = (uuid: string, index?: number) =>
+export const openAdvancedTabDialog = (uuid: string, ownerUuid: string, index?: number) =>
     async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         const { resources } = getState();
         const kind = extractUuidKind(uuid);
@@ -60,7 +60,7 @@ export const openAdvancedTabDialog = (uuid: string, index?: number) =>
         const repositoryData = getState().repositories.items[index!];
         if (data || repositoryData) {
             if (data) {
-                const user = await services.userService.get(data.ownerUuid);
+                const user = await services.userService.get(ownerUuid);
                 const metadata = await services.linkService.list({
                     filters: new FilterBuilder()
                         .addEqual('headUuid', uuid)
diff --git a/src/store/processes/process-copy-actions.ts b/src/store/processes/process-copy-actions.ts
index cd3fe21..502764d 100644
--- a/src/store/processes/process-copy-actions.ts
+++ b/src/store/processes/process-copy-actions.ts
@@ -20,7 +20,7 @@ export const openCopyProcessDialog = (resource: { name: string, uuid: string })
         const process = getProcess(resource.uuid)(getState().resources);
         if (process) {
             const processStatus = getProcessStatus(process);
-            if (processStatus === ProcessStatus.DRAFT) {
+            if (processStatus) {
                 dispatch<any>(resetPickerProjectTree());
                 dispatch<any>(initProjectsTreePicker(PROCESS_COPY_FORM_NAME));
                 const initialData: CopyFormDialogData = { name: `Copy of: ${resource.name}`, uuid: resource.uuid, ownerUuid: '' };
@@ -39,9 +39,9 @@ export const copyProcess = (resource: CopyFormDialogData) =>
         dispatch(startSubmit(PROCESS_COPY_FORM_NAME));
         try {
             const process = await services.containerRequestService.get(resource.uuid);
-            const uuidKey = 'uuid';
-            delete process[uuidKey];
-            await services.containerRequestService.create({ ...process, ownerUuid: resource.ownerUuid, name: resource.name });
+            const uuidKey = '';
+            process.uuid = uuidKey;
+            await services.containerRequestService.create({ command: process.command, containerImage: process.containerImage, outputPath: process.outputPath, ownerUuid: resource.ownerUuid, name: resource.name });
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_COPY_FORM_NAME }));
             return process;
         } catch (e) {
diff --git a/src/store/processes/process-move-actions.ts b/src/store/processes/process-move-actions.ts
index edba5a8..7e65bcc 100644
--- a/src/store/processes/process-move-actions.ts
+++ b/src/store/processes/process-move-actions.ts
@@ -12,7 +12,7 @@ import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
 import { resetPickerProjectTree } from '~/store/project-tree-picker/project-tree-picker-actions';
 import { projectPanelActions } from '~/store/project-panel/project-panel-action';
-import { getProcess, getProcessStatus, ProcessStatus } from '~/store/processes/process';
+import { getProcess } from '~/store/processes/process';
 import { initProjectsTreePicker } from '~/store/tree-picker/tree-picker-actions';
 
 export const PROCESS_MOVE_FORM_NAME = 'processMoveFormName';
@@ -21,15 +21,10 @@ export const openMoveProcessDialog = (resource: { name: string, uuid: string })
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const process = getProcess(resource.uuid)(getState().resources);
         if (process) {
-            const processStatus = getProcessStatus(process);
-            if (processStatus === ProcessStatus.DRAFT) {
-                dispatch<any>(resetPickerProjectTree());
-                dispatch<any>(initProjectsTreePicker(PROCESS_MOVE_FORM_NAME));
-                dispatch(initialize(PROCESS_MOVE_FORM_NAME, resource));
-                dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_MOVE_FORM_NAME, data: {} }));
-            } else {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'You can move only draft processes.', hideDuration: 2000 }));
-            }
+            dispatch<any>(resetPickerProjectTree());
+            dispatch<any>(initProjectsTreePicker(PROCESS_MOVE_FORM_NAME));
+            dispatch(initialize(PROCESS_MOVE_FORM_NAME, resource));
+            dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_MOVE_FORM_NAME, data: {} }));
         } else {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process not found', hideDuration: 2000 }));
         }
@@ -40,7 +35,7 @@ export const moveProcess = (resource: MoveToFormDialogData) =>
         dispatch(startSubmit(PROCESS_MOVE_FORM_NAME));
         try {
             const process = await services.containerRequestService.get(resource.uuid);
-            await services.containerRequestService.update(resource.uuid, { ...process, ownerUuid: resource.ownerUuid });
+            await services.containerRequestService.update(resource.uuid, { ownerUuid: resource.ownerUuid });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_MOVE_FORM_NAME }));
             return process;
@@ -48,8 +43,6 @@ export const moveProcess = (resource: MoveToFormDialogData) =>
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
                 dispatch(stopSubmit(PROCESS_MOVE_FORM_NAME, { ownerUuid: 'A process with the same name already exists in the target project.' }));
-            } else if (error === CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE) {
-                dispatch(stopSubmit(PROCESS_MOVE_FORM_NAME, { ownerUuid: 'You can move only draft processes.' }));
             } else {
                 dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_MOVE_FORM_NAME }));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not move the process.', hideDuration: 2000 }));
diff --git a/src/store/processes/process-update-actions.ts b/src/store/processes/process-update-actions.ts
index 92cf032..2063f11 100644
--- a/src/store/processes/process-update-actions.ts
+++ b/src/store/processes/process-update-actions.ts
@@ -34,8 +34,7 @@ export const updateProcess = (resource: ProcessUpdateFormDialogData) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(startSubmit(PROCESS_UPDATE_FORM_NAME));
         try {
-            const process = await services.containerRequestService.get(resource.uuid);
-            const updatedProcess = await services.containerRequestService.update(resource.uuid, { ...process, name: resource.name });
+            const updatedProcess = await services.containerRequestService.update(resource.uuid, { name: resource.name });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME }));
             return updatedProcess;
@@ -43,8 +42,6 @@ export const updateProcess = (resource: ProcessUpdateFormDialogData) =>
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
                 dispatch(stopSubmit(PROCESS_UPDATE_FORM_NAME, { name: 'Process with the same name already exists.' }));
-            } else if (error === CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE) {
-                dispatch(stopSubmit(PROCESS_UPDATE_FORM_NAME, { name: 'You cannot modified in "Final" state.' }));
             } else {
                 dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME }));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Could not update the process.', hideDuration: 2000 }));
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts
index 9d26fad..2dc2a92 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-action-set.ts
@@ -76,8 +76,8 @@ export const collectionActionSet: ContextMenuActionSet = [[
     {
         icon: AdvancedIcon,
         name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     }
     // {
diff --git a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
index 7730b14..d00f864 100644
--- a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
@@ -70,8 +70,8 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
     {
         icon: AdvancedIcon,
         name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     }
     // {
diff --git a/src/views-components/context-menu/action-sets/process-action-set.ts b/src/views-components/context-menu/action-sets/process-action-set.ts
index 2d15254..3b5f297 100644
--- a/src/views-components/context-menu/action-sets/process-action-set.ts
+++ b/src/views-components/context-menu/action-sets/process-action-set.ts
@@ -110,8 +110,8 @@ export const processActionSet: ContextMenuActionSet = [[
     {
         icon: AdvancedIcon,
         name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     }
     // {
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index 9b8ced5..9b56833 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -78,8 +78,8 @@ export const projectActionSet: ContextMenuActionSet = [[
     {
         icon: AdvancedIcon,
         name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     },
 ]];
diff --git a/src/views-components/context-menu/action-sets/repository-action-set.ts b/src/views-components/context-menu/action-sets/repository-action-set.ts
index cf7fb88..7382475 100644
--- a/src/views-components/context-menu/action-sets/repository-action-set.ts
+++ b/src/views-components/context-menu/action-sets/repository-action-set.ts
@@ -23,8 +23,8 @@ export const repositoryActionSet: ContextMenuActionSet = [[{
 }, {
     name: "Advanced",
     icon: AdvancedIcon,
-    execute: (dispatch, { uuid, index }) => {
-        dispatch<any>(openAdvancedTabDialog(uuid, index));
+    execute: (dispatch, { uuid, ownerUuid, index }) => {
+        dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid, index));
     }
 }, {
     name: "Remove",
diff --git a/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts b/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts
index cefef34..7ba9f5e 100644
--- a/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/trashed-collection-action-set.ts
@@ -27,8 +27,8 @@ export const trashedCollectionActionSet: ContextMenuActionSet = [[
     {
         icon: AdvancedIcon,
         name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        execute: (dispatch, { uuid, ownerUuid }) => {
+            dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
         }
     },
     {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list