1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { MoveToIcon, CopyIcon, RenameIcon, ShareIcon } from "components/icon/icon";
6 import { openMoveCollectionDialog } from "store/collections/collection-move-actions";
7 import { openCollectionCopyDialog, openMultiCollectionCopyDialog } from "store/collections/collection-copy-actions";
8 import { toggleCollectionTrashed } from "store/trash/trash-actions";
9 import { ContextMenuResource } from "store/context-menu/context-menu-actions";
10 import { msCommonActionSet, MultiSelectMenuActionSet, MultiSelectMenuAction } from "./ms-menu-actions";
11 import { ContextMenuActionNames } from "views-components/context-menu/context-menu-action-set";
12 import { TrashIcon, Link, FolderSharedIcon } from "components/icon/icon";
13 import { openCollectionUpdateDialog } from "store/collections/collection-update-actions";
14 import { copyToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
15 import { openWebDavS3InfoDialog } from "store/collections/collection-info-actions";
16 import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
19 const { MAKE_A_COPY, MOVE_TO, MOVE_TO_TRASH, EDIT_COLLECTION, OPEN_IN_NEW_TAB, OPEN_WITH_3RD_PARTY_CLIENT, COPY_LINK_TO_CLIPBOARD, VIEW_DETAILS, API_DETAILS, ADD_TO_FAVORITES, SHARE} = ContextMenuActionNames;
21 const msCopyCollection: MultiSelectMenuAction = {
26 execute: (dispatch, [...resources]) => {
27 if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
28 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
32 const msMoveCollection: MultiSelectMenuAction = {
37 execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
40 const msToggleTrashAction: MultiSelectMenuAction = {
45 execute: (dispatch, resources: ContextMenuResource[]) => {
46 for (const resource of [...resources]) {
47 dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
52 const msEditCollection: MultiSelectMenuAction = {
53 name: ContextMenuActionNames.EDIT_COLLECTION,
57 execute: (dispatch, resources) => {
58 dispatch<any>(openCollectionUpdateDialog(resources[0]));
62 const msCopyToClipboardMenuAction: MultiSelectMenuAction = {
63 name: COPY_LINK_TO_CLIPBOARD,
67 execute: (dispatch, resources) => {
68 dispatch<any>(copyToClipboardAction(resources));
72 const msOpenWith3rdPartyClientAction: MultiSelectMenuAction = {
73 name: OPEN_WITH_3RD_PARTY_CLIENT,
74 icon: FolderSharedIcon,
77 execute: (dispatch, resources) => {
78 dispatch<any>(openWebDavS3InfoDialog(resources[0].uuid));
82 const msShareAction: MultiSelectMenuAction = {
87 execute: (dispatch, resources) => {
88 dispatch<any>(openSharingDialog(resources[0].uuid));
92 export const msCollectionActionSet: MultiSelectMenuActionSet = [
99 msCopyToClipboardMenuAction,
100 msOpenWith3rdPartyClientAction,
105 export const msReadOnlyCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_LINK_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, ADD_TO_FAVORITES, OPEN_WITH_3RD_PARTY_CLIENT]);
106 export const msCommonCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_LINK_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, OPEN_WITH_3RD_PARTY_CLIENT, EDIT_COLLECTION, SHARE, MOVE_TO, ADD_TO_FAVORITES, MOVE_TO_TRASH])
107 export const msOldCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_LINK_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, OPEN_WITH_3RD_PARTY_CLIENT, EDIT_COLLECTION, SHARE, MOVE_TO, ADD_TO_FAVORITES, MOVE_TO_TRASH])