1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContextMenuActionNames } from "views-components/context-menu/context-menu-action-set";
6 import { DeleteForever, ReRunProcessIcon, OutputIcon, RenameIcon, StopIcon, CopyIcon, Link } from "components/icon/icon";
7 import { openCopyProcessDialog } from "store/processes/process-copy-actions";
8 import { openRemoveProcessDialog } from "store/processes/processes-actions";
9 import { MultiSelectMenuAction, MultiSelectMenuActionSet, msCommonActionSet } from "./ms-menu-actions";
10 import { openProcessUpdateDialog } from "store/processes/process-update-actions";
11 import { msNavigateToOutput } from "store/multiselect/multiselect-actions";
12 import { cancelRunningWorkflow } from "store/processes/processes-actions";
13 import { copyToClipboardAction, copyStringToClipboardAction } from "store/open-in-new-tab/open-in-new-tab.actions";
15 const {REMOVE, COPY_AND_RERUN_PROCESS, COPY_LINK_TO_CLIPBOARD, COPY_UUID, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, ADD_TO_PUBLIC_FAVORITES, OUTPUTS, EDIT_PROCESS, CANCEL } = ContextMenuActionNames
17 const msCopyAndRerunProcess: MultiSelectMenuAction = {
18 name: COPY_AND_RERUN_PROCESS,
19 icon: ReRunProcessIcon,
22 execute: (dispatch, resources) => {
23 for (const resource of [...resources]) {
24 dispatch<any>(openCopyProcessDialog(resource));
29 const msRemoveProcess: MultiSelectMenuAction = {
34 execute: (dispatch, resources) => {
35 dispatch<any>(openRemoveProcessDialog(resources[0], resources.length));
39 const msCopyUuid: MultiSelectMenuAction = {
44 execute: (dispatch, resources) => {
45 dispatch<any>(copyStringToClipboardAction(resources[0].uuid));
49 const msCopyToClipboardMenuAction: MultiSelectMenuAction = {
50 name: COPY_LINK_TO_CLIPBOARD,
54 execute: (dispatch, resources) => {
55 dispatch<any>(copyToClipboardAction(resources));
59 // removed until auto-move children is implemented
60 // const msMoveTo: MultiSelectMenuAction = {
65 // execute: (dispatch, resources) => {
66 // dispatch<any>(openMoveProcessDialog(resources[0]));
70 const msViewOutputs: MultiSelectMenuAction = {
75 execute: (dispatch, resources) => {
77 dispatch<any>(msNavigateToOutput(resources[0]));
82 const msEditProcess: MultiSelectMenuAction = {
87 execute: (dispatch, resources) => {
88 dispatch<any>(openProcessUpdateDialog(resources[0]));
92 const msCancelProcess: MultiSelectMenuAction = {
97 execute: (dispatch, resources) => {
98 dispatch<any>(cancelRunningWorkflow(resources[0].uuid));
102 export const msProcessActionSet: MultiSelectMenuActionSet = [
104 ...msCommonActionSet,
105 msCopyAndRerunProcess,
112 msCopyToClipboardMenuAction,
116 export const msCommonProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, COPY_LINK_TO_CLIPBOARD, COPY_UUID, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, OUTPUTS, EDIT_PROCESS ]);
117 export const msRunningProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, COPY_LINK_TO_CLIPBOARD, COPY_UUID, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, OUTPUTS, EDIT_PROCESS, CANCEL ]);
119 export const msReadOnlyProcessActionFilter = new Set([COPY_AND_RERUN_PROCESS, COPY_LINK_TO_CLIPBOARD, COPY_UUID, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, OUTPUTS ]);
120 export const msAdminProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, COPY_LINK_TO_CLIPBOARD, COPY_UUID, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, ADD_TO_PUBLIC_FAVORITES, OUTPUTS, EDIT_PROCESS ]);