[ARVADOS-WORKBENCH2] created: 2.3.0-187-g33502c3e

Git user git at public.arvados.org
Tue Mar 1 20:21:39 UTC 2022


        at  33502c3ee0e24d155193938bbbce2968d2947593 (commit)


commit 33502c3ee0e24d155193938bbbce2968d2947593
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Tue Mar 1 17:16:46 2022 -0300

    18028: Removes code duplication in process context menus.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/src/index.tsx b/src/index.tsx
index c160f96c..f928ea8a 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -29,7 +29,6 @@ import { collectionFilesActionSet, readOnlyCollectionFilesActionSet } from 'view
 import { collectionDirectoryItemActionSet, collectionFileItemActionSet, readOnlyCollectionDirectoryItemActionSet, readOnlyCollectionFileItemActionSet } from 'views-components/context-menu/action-sets/collection-files-item-action-set';
 import { collectionFilesNotSelectedActionSet } from 'views-components/context-menu/action-sets/collection-files-not-selected-action-set';
 import { collectionActionSet, collectionAdminActionSet, oldCollectionVersionActionSet, readOnlyCollectionActionSet } from 'views-components/context-menu/action-sets/collection-action-set';
-import { processActionSet } from 'views-components/context-menu/action-sets/process-action-set';
 import { loadWorkbench } from 'store/workbench/workbench-actions';
 import { Routes } from 'routes/routes';
 import { trashActionSet } from "views-components/context-menu/action-sets/trash-action-set";
@@ -38,7 +37,11 @@ import { initWebSocket } from 'websocket/websocket';
 import { Config } from 'common/config';
 import { addRouteChangeHandlers } from './routes/route-change-handlers';
 import { setTokenDialogApiHost } from 'store/token-dialog/token-dialog-actions';
-import { processResourceActionSet, readOnlyProcessResourceActionSet } from 'views-components/context-menu/action-sets/process-resource-action-set';
+import {
+    processResourceActionSet,
+    processResourceAdminActionSet,
+    readOnlyProcessResourceActionSet
+} from 'views-components/context-menu/action-sets/process-resource-action-set';
 import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
 import { trashedCollectionActionSet } from 'views-components/context-menu/action-sets/trashed-collection-action-set';
 import { setBuildInfo } from 'store/app-info/app-info-actions';
@@ -57,7 +60,6 @@ import { groupActionSet } from 'views-components/context-menu/action-sets/group-
 import { groupMemberActionSet } from 'views-components/context-menu/action-sets/group-member-action-set';
 import { linkActionSet } from 'views-components/context-menu/action-sets/link-action-set';
 import { loadFileViewersConfig } from 'store/file-viewers/file-viewers-actions';
-import { processResourceAdminActionSet } from 'views-components/context-menu/action-sets/process-resource-admin-action-set';
 import { filterGroupAdminActionSet, projectAdminActionSet } from 'views-components/context-menu/action-sets/project-admin-action-set';
 import { permissionEditActionSet } from 'views-components/context-menu/action-sets/permission-edit-action-set';
 import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
@@ -83,7 +85,6 @@ addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.READONLY_COLLECTION, readOnlyCollectionActionSet);
 addMenuActionSet(ContextMenuKind.OLD_VERSION_COLLECTION, oldCollectionVersionActionSet);
 addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
-addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
 addMenuActionSet(ContextMenuKind.PROCESS_RESOURCE, processResourceActionSet);
 addMenuActionSet(ContextMenuKind.READONLY_PROCESS_RESOURCE, readOnlyProcessResourceActionSet);
 addMenuActionSet(ContextMenuKind.TRASH, trashActionSet);
diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts
index 38433eb2..336817ea 100644
--- a/src/store/context-menu/context-menu-actions.ts
+++ b/src/store/context-menu/context-menu-actions.ts
@@ -190,7 +190,7 @@ export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>, pro
                 description: res.description,
                 outputUuid: res.outputUuid || '',
                 workflowUuid: res.properties.workflowUuid || '',
-                menuKind: ContextMenuKind.PROCESS
+                menuKind: ContextMenuKind.PROCESS_RESOURCE
             }));
         }
     };
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
deleted file mode 100644
index 65f6a316..00000000
--- a/src/views-components/context-menu/action-sets/process-action-set.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
-import { ToggleFavoriteAction } from "views-components/context-menu/actions/favorite-action";
-import { toggleFavorite } from "store/favorites/favorites-actions";
-import {
-    RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon,
-    AdvancedIcon, RemoveIcon, ReRunProcessIcon, LogIcon, InputIcon, CommandIcon, OutputIcon
-} from "components/icon/icon";
-import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
-import { navigateToProcessLogs } from 'store/navigation/navigation-action';
-import { openMoveProcessDialog } from 'store/processes/process-move-actions';
-import { openProcessUpdateDialog } from "store/processes/process-update-actions";
-import { openCopyProcessDialog } from 'store/processes/process-copy-actions';
-import { openProcessCommandDialog } from 'store/processes/process-command-actions';
-import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
-import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
-import { openProcessInputDialog } from "store/processes/process-input-actions";
-import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
-import { openRemoveProcessDialog, reRunProcess } from "store/processes/processes-actions";
-import { navigateToOutput } from "store/process-panel/process-panel-actions";
-import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
-
-export const processActionSet: ContextMenuActionSet = [[
-    {
-        icon: RenameIcon,
-        name: "Edit process",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProcessUpdateDialog(resource));
-        }
-    },
-    {
-        icon: ShareIcon,
-        name: "Share",
-        execute: (dispatch, { uuid }) => {
-            dispatch<any>(openSharingDialog(uuid));
-        }
-    },
-    {
-        component: ToggleFavoriteAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(toggleFavorite(resource)).then(() => {
-                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
-            });
-        }
-    },
-    {
-        icon: MoveToIcon,
-        name: "Move to",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openMoveProcessDialog(resource));
-        }
-    },
-    {
-        icon: CopyIcon,
-        name: "Copy to project",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openCopyProcessDialog(resource));
-        }
-    },
-    {
-        icon: ReRunProcessIcon,
-        name: "Re-run process",
-        execute: (dispatch, resource) => {
-            if(resource.workflowUuid) {
-                dispatch<any>(reRunProcess(resource.uuid, resource.workflowUuid));
-            } else {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: `You can't re-run this process`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
-            }        
-        }        
-    },
-    {
-        icon: InputIcon,
-        name: "Inputs",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProcessInputDialog(resource.uuid));
-        }
-    },
-    {
-        icon: OutputIcon,
-        name: "Outputs",
-        execute: (dispatch, resource) => {
-            if(resource.outputUuid){
-                dispatch<any>(navigateToOutput(resource.outputUuid));
-            }
-        }
-    },
-    {
-        icon: CommandIcon,
-        name: "Command",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProcessCommandDialog(resource.uuid));
-        }
-    },
-    {
-        icon: LogIcon,
-        name: "Log",
-        execute: (dispatch, resource) => {
-            dispatch<any>(navigateToProcessLogs(resource.uuid));
-        }
-    },
-    {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: dispatch => {
-            dispatch<any>(toggleDetailsPanel());
-        }
-    },
-    // {
-    //     icon: ProvenanceGraphIcon,
-    //     name: "Provenance graph",
-    //     execute: (dispatch, resource) => {
-    //         // add code
-    //     }
-    // },
-    {
-        icon: AdvancedIcon,
-        name: "Advanced",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openAdvancedTabDialog(resource.uuid));
-        }
-    },
-    {
-        name: "Remove",
-        icon: RemoveIcon,
-        execute: (dispatch, resource) => {
-            dispatch<any>(openRemoveProcessDialog(resource.uuid));
-        }
-    }
-]];
diff --git a/src/views-components/context-menu/action-sets/process-resource-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
index 9b25bb67..be2f82fd 100644
--- a/src/views-components/context-menu/action-sets/process-resource-action-set.ts
+++ b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
@@ -5,14 +5,27 @@
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "store/favorites/favorites-actions";
-import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "components/icon/icon";
+import {
+    RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon,
+    RemoveIcon, ReRunProcessIcon, InputIcon, OutputIcon, CommandIcon,
+    LogIcon, AdvancedIcon
+} from "components/icon/icon";
 import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
 import { openMoveProcessDialog } from 'store/processes/process-move-actions';
 import { openProcessUpdateDialog } from "store/processes/process-update-actions";
 import { openCopyProcessDialog } from 'store/processes/process-copy-actions';
 import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
-import { openRemoveProcessDialog } from "store/processes/processes-actions";
+import { openRemoveProcessDialog, reRunProcess } from "store/processes/processes-actions";
 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
+import { openProcessInputDialog } from "store/processes/process-input-actions";
+import { navigateToOutput } from "store/process-panel/process-panel-actions";
+import { openProcessCommandDialog } from "store/processes/process-command-actions";
+import { navigateToProcessLogs } from "store/navigation/navigation-action";
+import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
+import { TogglePublicFavoriteAction } from "../actions/public-favorite-action";
+import { togglePublicFavorite } from "store/public-favorites/public-favorites-actions";
+import { publicFavoritePanelActions } from "store/public-favorites-panel/public-favorites-action";
 
 export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
     {
@@ -30,6 +43,47 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
             dispatch<any>(openCopyProcessDialog(resource));
         }
     },
+    {
+        icon: ReRunProcessIcon,
+        name: "Re-run process",
+        execute: (dispatch, resource) => {
+            if(resource.workflowUuid) {
+                dispatch<any>(reRunProcess(resource.uuid, resource.workflowUuid));
+            } else {
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: `You can't re-run this process`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
+            }
+        }
+    },
+    {
+        icon: InputIcon,
+        name: "Inputs",
+        execute: (dispatch, resource) => {
+            dispatch<any>(openProcessInputDialog(resource.uuid));
+        }
+    },
+    {
+        icon: OutputIcon,
+        name: "Outputs",
+        execute: (dispatch, resource) => {
+            if(resource.outputUuid){
+                dispatch<any>(navigateToOutput(resource.outputUuid));
+            }
+        }
+    },
+    {
+        icon: CommandIcon,
+        name: "Command",
+        execute: (dispatch, resource) => {
+            dispatch<any>(openProcessCommandDialog(resource.uuid));
+        }
+    },
+    {
+        icon: LogIcon,
+        name: "Log",
+        execute: (dispatch, resource) => {
+            dispatch<any>(navigateToProcessLogs(resource.uuid));
+        }
+    },
     {
         icon: DetailsIcon,
         name: "View details",
@@ -37,6 +91,13 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
             dispatch<any>(toggleDetailsPanel());
         }
     },
+    {
+        icon: AdvancedIcon,
+        name: "Advanced",
+        execute: (dispatch, resource) => {
+            dispatch<any>(openAdvancedTabDialog(resource.uuid));
+        }
+    },
 ]];
 
 export const processResourceActionSet: ContextMenuActionSet = [[
@@ -70,3 +131,16 @@ export const processResourceActionSet: ContextMenuActionSet = [[
         }
     }
 ]];
+
+export const processResourceAdminActionSet: ContextMenuActionSet = [[
+    ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []),
+    {
+        component: TogglePublicFavoriteAction,
+        name: "Add to public favorites",
+        execute: (dispatch, resource) => {
+            dispatch<any>(togglePublicFavorite(resource)).then(() => {
+                dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
+            });
+        }
+    },
+]];
\ No newline at end of file
diff --git a/src/views-components/context-menu/action-sets/process-resource-admin-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-admin-action-set.ts
deleted file mode 100644
index e6ab2638..00000000
--- a/src/views-components/context-menu/action-sets/process-resource-admin-action-set.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { ContextMenuActionSet } from "../context-menu-action-set";
-import { ToggleFavoriteAction } from "../actions/favorite-action";
-import { toggleFavorite } from "store/favorites/favorites-actions";
-import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "components/icon/icon";
-import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
-import { openMoveProcessDialog } from 'store/processes/process-move-actions';
-import { openProcessUpdateDialog } from "store/processes/process-update-actions";
-import { openCopyProcessDialog } from 'store/processes/process-copy-actions';
-import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
-import { openRemoveProcessDialog } from "store/processes/processes-actions";
-import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
-import { TogglePublicFavoriteAction } from "views-components/context-menu/actions/public-favorite-action";
-import { togglePublicFavorite } from "store/public-favorites/public-favorites-actions";
-import { publicFavoritePanelActions } from "store/public-favorites-panel/public-favorites-action";
-
-export const processResourceAdminActionSet: ContextMenuActionSet = [[
-    {
-        icon: RenameIcon,
-        name: "Edit process",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openProcessUpdateDialog(resource));
-        }
-    },
-    {
-        icon: ShareIcon,
-        name: "Share",
-        execute: (dispatch, { uuid }) => {
-            dispatch<any>(openSharingDialog(uuid));
-        }
-    },
-    {
-        component: ToggleFavoriteAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(toggleFavorite(resource)).then(() => {
-                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
-            });
-        }
-    },
-    {
-        component: TogglePublicFavoriteAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(togglePublicFavorite(resource)).then(() => {
-                dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
-            });
-        }
-    },
-    {
-        icon: MoveToIcon,
-        name: "Move to",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openMoveProcessDialog(resource));
-        }
-    },
-    {
-        icon: CopyIcon,
-        name: "Copy to project",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openCopyProcessDialog(resource));
-        }
-    },
-    {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: dispatch => {
-            dispatch<any>(toggleDetailsPanel());
-        }
-    },
-    {
-        name: "Remove",
-        icon: RemoveIcon,
-        execute: (dispatch, resource) => {
-            dispatch<any>(openRemoveProcessDialog(resource.uuid));
-        }
-    }
-]];

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list