15768: changed all context menu actions to take an array of resources Arvados-DCO...
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / repository-action-set.ts
index 22f6bee135c71f6b11fb6faf21b4af1fe27ed4f6..e893a7fa6fffd2c5ffcdc36353f779bf6546494f 100644 (file)
@@ -2,34 +2,41 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
-import { AdvancedIcon, RemoveIcon, ShareIcon, AttributesIcon } from "~/components/icon/icon";
-import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
-import { openRepositoryAttributes, openRemoveRepositoryDialog } from "~/store/repositories/repositories-actions";
-import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
+import { ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set';
+import { AdvancedIcon, RemoveIcon, ShareIcon, AttributesIcon } from 'components/icon/icon';
+import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
+import { openRepositoryAttributes, openRemoveRepositoryDialog } from 'store/repositories/repositories-actions';
+import { openSharingDialog } from 'store/sharing-dialog/sharing-dialog-actions';
 
-export const repositoryActionSet: ContextMenuActionSet = [[{
-    name: "Attributes",
-    icon: AttributesIcon,
-    execute: (dispatch, { index }) => {
-        dispatch<any>(openRepositoryAttributes(index!));
-    }
-}, {
-    name: "Share",
-    icon: ShareIcon,
-    execute: (dispatch, { uuid }) => {
-        dispatch<any>(openSharingDialog(uuid));
-    }
-}, {
-    name: "Advanced",
-    icon: AdvancedIcon,
-    execute: (dispatch, resource) => {
-        dispatch<any>(openAdvancedTabDialog(resource.uuid, resource.index));
-    }
-}, {
-    name: "Remove",
-    icon: RemoveIcon,
-    execute: (dispatch, { uuid }) => {
-        dispatch<any>(openRemoveRepositoryDialog(uuid));
-    }
-}]];
+export const repositoryActionSet: ContextMenuActionSet = [
+    [
+        {
+            name: 'Attributes',
+            icon: AttributesIcon,
+            execute: (dispatch, resources) => {
+                resources.forEach((resource) => dispatch<any>(openRepositoryAttributes(resource.uuid)));
+            },
+        },
+        {
+            name: 'Share',
+            icon: ShareIcon,
+            execute: (dispatch, resources) => {
+                resources.forEach((resource) => dispatch<any>(openSharingDialog(resource.uuid)));
+            },
+        },
+        {
+            name: 'API Details',
+            icon: AdvancedIcon,
+            execute: (dispatch, resources) => {
+                resources.forEach((resource) => dispatch<any>(openAdvancedTabDialog(resource.uuid)));
+            },
+        },
+        {
+            name: 'Remove',
+            icon: RemoveIcon,
+            execute: (dispatch, resources) => {
+                resources.forEach((resource) => dispatch<any>(openRemoveRepositoryDialog(resource.uuid)));
+            },
+        },
+    ],
+];