fix height for columns - change style for buttons, sort options for items in menu
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-resource-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 { ToggleFavoriteAction } from "../actions/favorite-action";
7 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
8 import { toggleFavorite } from "~/store/favorites/favorites-actions";
9 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
10 import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
11 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
12 import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
13 import { openCollectionCopyDialog } from '~/store/collections/collection-copy-actions';
14 import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
15 import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
16 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
17
18 export const collectionResourceActionSet: ContextMenuActionSet = [[
19     {
20         icon: RenameIcon,
21         name: "Edit collection",
22         execute: (dispatch, resource) => {
23             dispatch<any>(openCollectionUpdateDialog(resource));
24         }
25     },
26     {
27         icon: ShareIcon,
28         name: "Share",
29         execute: (dispatch, { uuid }) => {
30             dispatch<any>(openSharingDialog(uuid));
31         }
32     },
33     {
34         component: ToggleFavoriteAction,
35         execute: (dispatch, resource) => {
36             dispatch<any>(toggleFavorite(resource)).then(() => {
37                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
38             });
39         }
40     },
41     {
42         component: ToggleTrashAction,
43         execute: (dispatch, resource) => {
44             dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
45         }
46     },
47     {
48         icon: MoveToIcon,
49         name: "Move to",
50         execute: (dispatch, resource) => {
51             dispatch<any>(openMoveCollectionDialog(resource));
52         }
53     },
54     {
55         icon: CopyIcon,
56         name: "Copy to project",
57         execute: (dispatch, resource) => {
58             dispatch<any>(openCollectionCopyDialog(resource));
59         }
60     },
61     {
62         icon: DetailsIcon,
63         name: "View details",
64         execute: dispatch => {
65             dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
66         }
67     }
68     // {
69     //     icon: RemoveIcon,
70     //     name: "Remove",
71     //     execute: (dispatch, resource) => {
72     //         // add code
73     //     }
74     // }
75 ]];