21128: renamed overloaded context menu types Arvados-DCO-1.1-Signed-off-by: Lisa...
[arvados-workbench2.git] / src / views-components / multiselect-toolbar / ms-collection-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContextMenuActionItemSet } from "views-components/context-menu/context-menu-action-set";
6 import { MoveToIcon, CopyIcon } from "components/icon/icon";
7 import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
8 import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
9 import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
10 import { toggleCollectionTrashed } from "store/trash/trash-actions";
11 import { ContextMenuResource } from "store/context-menu/context-menu-actions";
12
13 export const msCollectionActionSet: ContextMenuActionItemSet = [
14     [
15         {
16             icon: CopyIcon,
17             name: "Make a copy",
18             execute: (dispatch, [...resources]) => {
19                 if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
20                 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
21             },
22         },
23         {
24             icon: MoveToIcon,
25             name: "Move to",
26             execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
27         },
28         {
29             component: ToggleTrashAction,
30             name: "ToggleTrashAction",
31             execute: (dispatch, resources: ContextMenuResource[]) => {
32                 for (const resource of [...resources]) {
33                     dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
34                 }
35             },
36         },
37     ],
38 ];