Merge branch '14315_fix_columns_height_and_sort_more_options_for_items'
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / 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 "../context-menu-action-set";
6 import { ToggleFavoriteAction } from "../actions/favorite-action";
7 import { toggleFavorite } from "~/store/favorites/favorites-actions";
8 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon";
9 import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
10 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
11 import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
12 import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
13 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
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 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
18
19 export const collectionActionSet: ContextMenuActionSet = [[
20     {
21         icon: RenameIcon,
22         name: "Edit collection",
23         execute: (dispatch, resource) => {
24             dispatch<any>(openCollectionUpdateDialog(resource));
25         }
26     },
27     {
28         icon: ShareIcon,
29         name: "Share",
30         execute: (dispatch, { uuid }) => {
31             dispatch<any>(openSharingDialog(uuid));
32         }
33     },
34     {
35         component: ToggleFavoriteAction,
36         execute: (dispatch, resource) => {
37             dispatch<any>(toggleFavorite(resource)).then(() => {
38                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
39             });
40         }
41     },
42     {
43         component: ToggleTrashAction,
44         execute: (dispatch, resource) => {
45             dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
46         }
47     },
48     {
49         icon: MoveToIcon,
50         name: "Move to",
51         execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
52     },
53     {
54         icon: CopyIcon,
55         name: "Copy to project",
56         execute: (dispatch, resource) => {
57             dispatch<any>(openCollectionCopyDialog(resource));
58         }
59
60     },
61     {
62         icon: DetailsIcon,
63         name: "View details",
64         execute: dispatch => {
65             dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
66         }
67     },
68     // {
69     //     icon: ProvenanceGraphIcon,
70     //     name: "Provenance graph",
71     //     execute: (dispatch, resource) => {
72     //         // add code
73     //     }
74     // },
75     {
76         icon: AdvancedIcon,
77         name: "Advanced",
78         execute: (dispatch, resource) => {
79             dispatch<any>(openAdvancedTabDialog(resource.uuid));
80         }
81     }
82     // {
83     //     icon: RemoveIcon,
84     //     name: "Remove",
85     //     execute: (dispatch, resource) => {
86     //         // add code
87     //     }
88     // }
89 ]];