Implement resource moving
[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 { toggleFavorite } from "~/store/favorites/favorites-actions";
8 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
9 import { openUpdater } from "~/store/collections/updater/collection-updater-action";
10 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
11 import { openMoveToDialog } from "../../move-to-dialog/move-to-dialog";
12 import { ResourceKind } from '~/models/resource';
13
14 export const collectionResourceActionSet: ContextMenuActionSet = [[
15     {
16         icon: RenameIcon,
17         name: "Edit collection",
18         execute: (dispatch, resource) => {
19             dispatch<any>(openUpdater(resource));
20         }
21     },
22     {
23         icon: ShareIcon,
24         name: "Share",
25         execute: (dispatch, resource) => {
26             // add code
27         }
28     },
29     {
30         icon: MoveToIcon,
31         name: "Move to",
32         execute: (dispatch, resource) => dispatch<any>(openMoveToDialog({
33             name: resource.name,
34             uuid: resource.uuid,
35             kind: ResourceKind.COLLECTION
36         }))
37     },
38     {
39         component: ToggleFavoriteAction,
40         execute: (dispatch, resource) => {
41             dispatch<any>(toggleFavorite(resource)).then(() => {
42                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
43             });
44         }
45     },
46     {
47         icon: CopyIcon,
48         name: "Copy to project",
49         execute: (dispatch, resource) => {
50             // add code
51         }
52     },
53     {
54         icon: DetailsIcon,
55         name: "View details",
56         execute: (dispatch, resource) => {
57             // add code
58         }
59     },
60     {
61         icon: RemoveIcon,
62         name: "Remove",
63         execute: (dispatch, resource) => {
64             // add code
65         }
66     }
67 ]];