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 } 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";
14 const msCopyAndRerunProcess: MultiSelectMenuAction = {
15 name: ContextMenuActionNames.COPY_AND_RERUN_PROCESS,
16 icon: ReRunProcessIcon,
19 execute: (dispatch, resources) => {
20 for (const resource of [...resources]) {
21 dispatch<any>(openCopyProcessDialog(resource));
26 const msRemoveProcess: MultiSelectMenuAction = {
27 name: ContextMenuActionNames.REMOVE,
31 execute: (dispatch, resources) => {
32 dispatch<any>(openRemoveProcessDialog(resources[0], resources.length));
36 // removed until auto-move children is implemented
37 // const msMoveTo: MultiSelectMenuAction = {
38 // name: ContextMenuActionNames.MOVE_TO,
42 // execute: (dispatch, resources) => {
43 // dispatch<any>(openMoveProcessDialog(resources[0]));
47 const msViewOutputs: MultiSelectMenuAction = {
48 name: ContextMenuActionNames.OUTPUTS,
52 execute: (dispatch, resources) => {
54 dispatch<any>(msNavigateToOutput(resources[0]));
59 const msEditProcess: MultiSelectMenuAction = {
60 name: ContextMenuActionNames.EDIT_PROCESS,
64 execute: (dispatch, resources) => {
65 dispatch<any>(openProcessUpdateDialog(resources[0]));
69 const msCancelProcess: MultiSelectMenuAction = {
70 name: ContextMenuActionNames.CANCEL,
74 execute: (dispatch, resources) => {
75 dispatch<any>(cancelRunningWorkflow(resources[0].uuid));
79 export const msProcessActionSet: MultiSelectMenuActionSet = [
82 msCopyAndRerunProcess,
91 const {REMOVE, COPY_AND_RERUN_PROCESS, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, ADD_TO_PUBLIC_FAVORITES, OUTPUTS, EDIT_PROCESS, CANCEL } = ContextMenuActionNames
93 export const msCommonProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, OUTPUTS, EDIT_PROCESS ]);
94 export const msRunningProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, OUTPUTS, EDIT_PROCESS, CANCEL ]);
96 export const msReadOnlyProcessActionFilter = new Set([COPY_AND_RERUN_PROCESS, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, OUTPUTS ]);
97 export const msAdminProcessActionFilter = new Set([REMOVE, COPY_AND_RERUN_PROCESS, ADD_TO_FAVORITES, OPEN_IN_NEW_TAB, VIEW_DETAILS, API_DETAILS, SHARE, ADD_TO_PUBLIC_FAVORITES, OUTPUTS, EDIT_PROCESS ]);