moving, copying, renaming processes in final state
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / 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 "../context-menu-action-set";
6 import { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon, DetailsIcon, AdvancedIcon } from '~/components/icon/icon';
7 import { ToggleFavoriteAction } from "../actions/favorite-action";
8 import { toggleFavorite } from "~/store/favorites/favorites-actions";
9 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
10 import { openMoveProjectDialog } from '~/store/projects/project-move-actions';
11 import { openProjectCreateDialog } from '~/store/projects/project-create-actions';
12 import { openProjectUpdateDialog } from '~/store/projects/project-update-actions';
13 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
14 import { toggleProjectTrashed } from "~/store/trash/trash-actions";
15 import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
16 import { ShareIcon } from '~/components/icon/icon';
17 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
18 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
19 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
20
21 export const projectActionSet: ContextMenuActionSet = [[
22     {
23         icon: NewProjectIcon,
24         name: "New project",
25         execute: (dispatch, resource) => {
26             dispatch<any>(openProjectCreateDialog(resource.uuid));
27         }
28     },
29     {
30         icon: RenameIcon,
31         name: "Edit project",
32         execute: (dispatch, resource) => {
33             dispatch<any>(openProjectUpdateDialog(resource));
34         }
35     },
36     {
37         icon: ShareIcon,
38         name: "Share",
39         execute: (dispatch, { uuid }) => {
40             dispatch<any>(openSharingDialog(uuid));
41         }
42     },
43     {
44         component: ToggleFavoriteAction,
45         execute: (dispatch, resource) => {
46             dispatch<any>(toggleFavorite(resource)).then(() => {
47                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
48             });
49         }
50     },
51     {
52         component: ToggleTrashAction,
53         execute: (dispatch, resource) => {
54             dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
55         }
56     },
57     {
58         icon: MoveToIcon,
59         name: "Move to",
60         execute: (dispatch, resource) => {
61             dispatch<any>(openMoveProjectDialog(resource));
62         }
63     },
64     {
65         icon: CopyIcon,
66         name: "Copy to project",
67         execute: (dispatch, resource) => {
68             // add code
69         }
70     },
71     {
72         icon: DetailsIcon,
73         name: "View details",
74         execute: dispatch => {
75             dispatch<any>(toggleDetailsPanel());
76         }
77     },
78     {
79         icon: AdvancedIcon,
80         name: "Advanced",
81         execute: (dispatch, { uuid, ownerUuid }) => {
82             dispatch<any>(openAdvancedTabDialog(uuid, ownerUuid));
83         }
84     },
85 ]];