15768: get_items on single collection copy Arvados-DCO-1.1-Signed-off-by: Lisa Knox...
[arvados.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 { ContextMenuActionSet } 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: ContextMenuActionSet = [
14     [
15         {
16             icon: CopyIcon,
17             name: "Make a copy",
18             execute: (dispatch, [...resources]) => {
19                 console.log(resources);
20                 if (resources[0].isSingle || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
21                 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
22             },
23         },
24         {
25             icon: MoveToIcon,
26             name: "Move to",
27             execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
28         },
29         {
30             component: ToggleTrashAction,
31             name: "ToggleTrashAction",
32             execute: (dispatch, resources: ContextMenuResource[]) => {
33                 for (const resource of resources) {
34                     dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
35                 }
36             },
37         },
38     ],
39 ];