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, MultiSelectMenuActionNames, MultiSelectMenuAction } from "./ms-menu-actions";
11 import { TrashIcon } from "components/icon/icon";
12 import { openCollectionUpdateDialog } from "store/collections/collection-update-actions";
14 const { MAKE_A_COPY, MOVE_TO, ADD_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;
16 const msCopyCollection: MultiSelectMenuAction = {
21 execute: (dispatch, [...resources]) => {
22 if (resources[0].fromContextMenu || resources.length === 1) dispatch<any>(openCollectionCopyDialog(resources[0]));
23 else dispatch<any>(openMultiCollectionCopyDialog(resources[0]));
27 const msMoveCollection: MultiSelectMenuAction = {
32 execute: (dispatch, resources) => dispatch<any>(openMoveCollectionDialog(resources[0])),
35 const msToggleTrashAction: MultiSelectMenuAction = {
40 execute: (dispatch, resources: ContextMenuResource[]) => {
41 for (const resource of [...resources]) {
42 dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
47 const msEditCollection: MultiSelectMenuAction = {
51 name: "Edit collection",
52 execute: (dispatch, resources) => {
53 dispatch<any>(openCollectionUpdateDialog(resources[0]));
57 export const msCollectionActionSet: MultiSelectMenuActionSet = [
67 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]);
68 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, ADD_TO_TRASH])
69 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, ADD_TO_TRASH])