Merge branch '17426-plug-ins' refs #17426
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / process-resource-action-set.ts
index 4a0a83b91d69130d9ccc0a274fd323aca9b4140c..73a65a2d417f6006050f9e82939c73418367a27c 100644 (file)
@@ -10,10 +10,37 @@ import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-acti
 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 { detailsPanelActions } from '~/store/details-panel/details-panel-action';
 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';
+
+export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
+    {
+        component: ToggleFavoriteAction,
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleFavorite(resource)).then(() => {
+                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+            });
+        }
+    },
+    {
+        icon: CopyIcon,
+        name: "Copy to project",
+        execute: (dispatch, resource) => {
+            dispatch<any>(openCopyProcessDialog(resource));
+        }
+    },
+    {
+        icon: DetailsIcon,
+        name: "View details",
+        execute: dispatch => {
+            dispatch<any>(toggleDetailsPanel());
+        }
+    },
+]];
 
 export const processResourceActionSet: ContextMenuActionSet = [[
+    ...readOnlyProcessResourceActionSet.reduce((prev, next) => prev.concat(next), []),
     {
         icon: RenameIcon,
         name: "Edit process",
@@ -28,14 +55,6 @@ export const processResourceActionSet: ContextMenuActionSet = [[
             dispatch<any>(openSharingDialog(uuid));
         }
     },
-    {
-        component: ToggleFavoriteAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(toggleFavorite(resource)).then(() => {
-                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
-            });
-        }
-    },
     {
         icon: MoveToIcon,
         name: "Move to",
@@ -44,24 +63,10 @@ export const processResourceActionSet: ContextMenuActionSet = [[
         }
     },
     {
-        icon: CopyIcon,
-        name: "Copy to project",
+        name: "Remove",
+        icon: RemoveIcon,
         execute: (dispatch, resource) => {
-            dispatch<any>(openCopyProcessDialog(resource));
-        }
-    },
-    {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: dispatch => {
-            dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
+            dispatch<any>(openRemoveProcessDialog(resource.uuid));
         }
     }
-    // {
-    //     icon: RemoveIcon,
-    //     name: "Remove",
-    //     execute: (dispatch, resource) => {
-    //         // add code
-    //     }
-    // }
 ]];