1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { MoveToIcon, CopyIcon, RenameIcon } 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 { MultiSelectMenuActionNames } from "views-components/multiselect-toolbar/ms-menu-actions";
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";
17 const { MAKE_A_COPY, MOVE_TO, MOVE_TO_TRASH, EDIT_COLLECTION, OPEN_IN_NEW_TAB, OPEN_W_3RD_PARTY_CLIENT, COPY_TO_CLIPBOARD, VIEW_DETAILS, API_DETAILS, ADD_TO_FAVORITES, SHARE} = MultiSelectMenuActionNames;
19 const msCopyCollection: MultiSelectMenuAction = {
24 execute: (dispatch, [...resources]) => {
25 if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
26 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
30 const msMoveCollection: MultiSelectMenuAction = {
35 execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
38 const msToggleTrashAction: MultiSelectMenuAction = {
43 execute: (dispatch, resources: ContextMenuResource[]) => {
44 for (const resource of [...resources]) {
45 dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
50 const msEditCollection: MultiSelectMenuAction = {
51 name: MultiSelectMenuActionNames.EDIT_COLLECTION,
55 execute: (dispatch, resources) => {
56 dispatch<any>(openCollectionUpdateDialog(resources[0]));
60 const msCopyToClipboardMenuAction: MultiSelectMenuAction = {
61 name: COPY_TO_CLIPBOARD,
65 execute: (dispatch, resources) => {
66 dispatch<any>(copyToClipboardAction(resources));
70 const msOpenWith3rdPartyClientAction: MultiSelectMenuAction = {
71 name: OPEN_W_3RD_PARTY_CLIENT,
72 icon: FolderSharedIcon,
75 execute: (dispatch, resources) => {
76 dispatch<any>(openWebDavS3InfoDialog(resources[0].uuid));
80 export const msCollectionActionSet: MultiSelectMenuActionSet = [
87 msCopyToClipboardMenuAction,
88 msOpenWith3rdPartyClientAction
92 export const msReadOnlyCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, ADD_TO_FAVORITES, OPEN_W_3RD_PARTY_CLIENT]);
93 export const msCommonCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, OPEN_W_3RD_PARTY_CLIENT, EDIT_COLLECTION, SHARE, MOVE_TO, ADD_TO_FAVORITES, MOVE_TO_TRASH])
94 export const msOldCollectionActionFilter = new Set([OPEN_IN_NEW_TAB, COPY_TO_CLIPBOARD, MAKE_A_COPY, VIEW_DETAILS, API_DETAILS, OPEN_W_3RD_PARTY_CLIENT, EDIT_COLLECTION, SHARE, MOVE_TO, ADD_TO_FAVORITES, MOVE_TO_TRASH])