fix height for columns - change style for buttons, sort options for items in menu
[arvados.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
20 export const projectActionSet: ContextMenuActionSet = [[
21     {
22         icon: NewProjectIcon,
23         name: "New project",
24         execute: (dispatch, resource) => {
25             dispatch<any>(openProjectCreateDialog(resource.uuid));
26         }
27     },
28     {
29         icon: RenameIcon,
30         name: "Edit project",
31         execute: (dispatch, resource) => {
32             dispatch<any>(openProjectUpdateDialog(resource));
33         }
34     },
35     {
36         icon: ShareIcon,
37         name: "Share",
38         execute: (dispatch, { uuid }) => {
39             dispatch<any>(openSharingDialog(uuid));
40         }
41     },
42     {
43         component: ToggleFavoriteAction,
44         execute: (dispatch, resource) => {
45             dispatch<any>(toggleFavorite(resource)).then(() => {
46                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
47             });
48         }
49     },
50     {
51         component: ToggleTrashAction,
52         execute: (dispatch, resource) => {
53             dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
54         }
55     },
56     {
57         icon: MoveToIcon,
58         name: "Move to",
59         execute: (dispatch, resource) => {
60             dispatch<any>(openMoveProjectDialog(resource));
61         }
62     },
63     {
64         icon: CopyIcon,
65         name: "Copy to project",
66         execute: (dispatch, resource) => {
67             // add code
68         }
69     },
70     {
71         icon: DetailsIcon,
72         name: "View details",
73         execute: dispatch => {
74             dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
75         }
76     },
77     {
78         icon: AdvancedIcon,
79         name: "Advanced",
80         execute: (dispatch, resource) => {
81             dispatch<any>(openAdvancedTabDialog(resource.uuid));
82         }
83     },
84 ]];