16437: Removes context items when projects are not editable by user
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-files-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 "~/views-components/context-menu/context-menu-action-set";
6 import { collectionPanelFilesAction, openMultipleFilesRemoveDialog } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
7 import { openCollectionPartialCopyDialog, openCollectionPartialCopyToSelectedCollectionDialog } from '~/store/collections/collection-partial-copy-actions';
8 import { DownloadCollectionFileAction } from "~/views-components/context-menu/actions/download-collection-file-action";
9
10 export const readOnlyCollectionFilesActionSet: ContextMenuActionSet = [[
11     {
12         name: "Select all",
13         execute: dispatch => {
14             dispatch(collectionPanelFilesAction.SELECT_ALL_COLLECTION_FILES());
15         }
16     },
17     {
18         name: "Unselect all",
19         execute: dispatch => {
20             dispatch(collectionPanelFilesAction.UNSELECT_ALL_COLLECTION_FILES());
21         }
22     },
23     {
24         component: DownloadCollectionFileAction,
25         execute: () => { return; }
26     },
27     {
28         name: "Create a new collection with selected",
29         execute: dispatch => {
30             dispatch<any>(openCollectionPartialCopyDialog());
31         }
32     },
33     {
34         name: "Copy selected into the collection",
35         execute: dispatch => {
36             dispatch<any>(openCollectionPartialCopyToSelectedCollectionDialog());
37         }
38     }
39 ]];
40
41 export const collectionFilesActionSet: ContextMenuActionSet = readOnlyCollectionFilesActionSet.concat([[
42     {
43         name: "Remove selected",
44         execute: dispatch => {
45             dispatch(openMultipleFilesRemoveDialog());
46         }
47     },
48 ]]);