21128: added workflow actions Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox...
[arvados.git] / src / views-components / multiselect-toolbar / ms-collection-action-set.ts
index f6d7e7122b93166aa9bf3e98e35511efff93d131..3afe15568efbbdece0afefa737c5f5c75cc635d5 100644 (file)
@@ -2,34 +2,40 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set";
 import { MoveToIcon, CopyIcon } from "components/icon/icon";
 import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
 import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
-import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
 import { toggleCollectionTrashed } from "store/trash/trash-actions";
 import { ContextMenuResource } from "store/context-menu/context-menu-actions";
+import { MultiSelectMenuActionSet, MultiSelectMenuActionNames } from "./ms-menu-actions";
+import { TrashIcon } from "components/icon/icon";
 
-export const msCollectionActionSet: ContextMenuActionSet = [
+export const msCollectionActionSet: MultiSelectMenuActionSet = [
     [
         {
+            name: MultiSelectMenuActionNames.MAKE_A_COPY,
             icon: CopyIcon,
-            name: "Make a copy",
-            execute: (dispatch, resources) => {
-                if (resources[0].isSingle || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
+            hasAlts: false,
+            isForMulti: true,
+            execute: (dispatch, [...resources]) => {
+                if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
                 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
             },
         },
         {
+            name: MultiSelectMenuActionNames.MOVE_TO,
             icon: MoveToIcon,
-            name: "Move to",
+            hasAlts: false,
+            isForMulti: true,
             execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
         },
         {
-            component: ToggleTrashAction,
-            name: "ToggleTrashAction",
+            name: MultiSelectMenuActionNames.ADD_TO_TRASH,
+            icon: TrashIcon,
+            isForMulti: true,
+            hasAlts: false,
             execute: (dispatch, resources: ContextMenuResource[]) => {
-                for (const resource of resources) {
+                for (const resource of [...resources]) {
                     dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
                 }
             },