86faf4b73d61a82b4d3728e8a23d02092a54d4c6
[arvados-workbench2.git] / src / views-components / multiselect-toolbar / ms-project-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, Link } from "components/icon/icon";
7 import { openMoveProjectDialog } from "store/projects/project-move-actions";
8 import { ToggleTrashAction } from "views-components/context-menu/actions/trash-action";
9 import { toggleProjectTrashed } from "store/trash/trash-actions";
10 import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
11
12 export const msCopyToClipboardMenuAction = {
13     icon: Link,
14     name: "Copy to clipboard",
15     execute: (dispatch, resources) => {
16         dispatch(copyToClipboardAction(resources));
17     },
18 };
19
20 export const msMoveToAction = {
21     icon: MoveToIcon,
22     name: "Move to",
23     execute: (dispatch, resource) => {
24         dispatch(openMoveProjectDialog(resource[0]));
25     },
26 };
27
28 export const msToggleTrashAction = {
29     component: ToggleTrashAction,
30     name: "ToggleTrashAction",
31     execute: (dispatch, resources) => {
32         for (const resource of resources) {
33             dispatch(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!, resources.length > 1));
34         }
35     },
36 };
37
38 export const msProjectActionSet: ContextMenuActionSet = [[msCopyToClipboardMenuAction, msMoveToAction, msToggleTrashAction]];