1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContextMenuActionSet, ContextMenuActionNames } from "../context-menu-action-set";
6 import { FileCopyIcon, FileMoveIcon, RemoveIcon, RenameIcon } from "components/icon/icon";
7 import { DownloadCollectionFileAction } from "../actions/download-collection-file-action";
8 import { openFileRemoveDialog, openRenameFileDialog } from "store/collection-panel/collection-panel-files/collection-panel-files-actions";
9 import { CollectionFileViewerAction } from "views-components/context-menu/actions/collection-file-viewer-action";
10 import { CollectionCopyToClipboardAction } from "../actions/collection-copy-to-clipboard-action";
12 openCollectionPartialMoveToExistingCollectionDialog,
13 openCollectionPartialMoveToNewCollectionDialog,
14 } from "store/collections/collection-partial-move-actions";
16 openCollectionPartialCopyToExistingCollectionDialog,
17 openCollectionPartialCopyToNewCollectionDialog,
18 } from "store/collections/collection-partial-copy-actions";
20 export const readOnlyCollectionDirectoryItemActionSet: ContextMenuActionSet = [
23 name: ContextMenuActionNames.COPY_ITEM_INTO_NEW_COLLECTION,
25 execute: (dispatch, resources) => {
26 dispatch<any>(openCollectionPartialCopyToNewCollectionDialog(resources[0]));
30 name: ContextMenuActionNames.COPY_ITEM_INTO_EXISTING_COLLECTION,
32 execute: (dispatch, resources) => {
33 dispatch<any>(openCollectionPartialCopyToExistingCollectionDialog(resources[0]));
37 component: CollectionFileViewerAction,
38 name: ContextMenuActionNames.OPEN_IN_NEW_TAB,
44 component: CollectionCopyToClipboardAction,
45 name: ContextMenuActionNames.COPY_LINK_TO_CLIPBOARD,
53 export const readOnlyCollectionFileItemActionSet: ContextMenuActionSet = [
56 component: DownloadCollectionFileAction,
57 name: ContextMenuActionNames.DOWNLOAD,
62 ...readOnlyCollectionDirectoryItemActionSet.reduce((prev, next) => prev.concat(next), []),
66 const writableActionSet: ContextMenuActionSet = [
69 name: ContextMenuActionNames.MOVE_ITEM_INTO_NEW_COLLECTION,
71 execute: (dispatch, resources) => {
72 dispatch<any>(openCollectionPartialMoveToNewCollectionDialog(resources[0]));
76 name: ContextMenuActionNames.MOVE_ITEM_INTO_EXISTING_COLLECTION,
78 execute: (dispatch, resources) => {
79 dispatch<any>(openCollectionPartialMoveToExistingCollectionDialog(resources[0]));
83 name: ContextMenuActionNames.RENAME,
85 execute: (dispatch, resources) => {
87 openRenameFileDialog({
88 name: resources[0].name,
89 id: resources[0].uuid,
90 path: resources[0].uuid.split("/").slice(1).join("/"),
96 name: ContextMenuActionNames.REMOVE,
98 execute: (dispatch, resources) => {
99 dispatch<any>(openFileRemoveDialog(resources[0].uuid));
105 export const collectionDirectoryItemActionSet: ContextMenuActionSet = readOnlyCollectionDirectoryItemActionSet.concat(writableActionSet);
107 export const collectionFileItemActionSet: ContextMenuActionSet = readOnlyCollectionFileItemActionSet.concat(writableActionSet);