1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { ContextMenuActionSet } from "../context-menu-action-set";
6 import { ToggleFavoriteAction } from "../actions/favorite-action";
7 import { toggleFavorite } from "store/favorites/favorites-actions";
19 } from "components/icon/icon";
20 import { favoritePanelActions } from "store/favorite-panel/favorite-panel-action";
21 import { openMoveProcessDialog } from "store/processes/process-move-actions";
22 import { openProcessUpdateDialog } from "store/processes/process-update-actions";
23 import { openCopyProcessDialog } from "store/processes/process-copy-actions";
24 import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
25 import { openRemoveProcessDialog } from "store/processes/processes-actions";
26 import { toggleDetailsPanel } from "store/details-panel/details-panel-action";
27 import { navigateToOutput } from "store/process-panel/process-panel-actions";
28 import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
29 import { TogglePublicFavoriteAction } from "../actions/public-favorite-action";
30 import { togglePublicFavorite } from "store/public-favorites/public-favorites-actions";
31 import { publicFavoritePanelActions } from "store/public-favorites-panel/public-favorites-action";
32 import { openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions";
33 import { cancelRunningWorkflow } from "store/processes/processes-actions";
35 export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [
38 component: ToggleFavoriteAction,
39 execute: (dispatch, resources) => {
40 dispatch<any>(toggleFavorite(resources[0])).then(() => {
41 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
47 name: "Open in new tab",
48 execute: (dispatch, resources) => {
49 dispatch<any>(openInNewTabAction(resources[0]));
53 icon: ReRunProcessIcon,
54 name: "Copy and re-run process",
55 execute: (dispatch, resources) => {
56 dispatch<any>(openCopyProcessDialog(resources[0]));
62 execute: (dispatch, resources) => {
64 dispatch<any>(navigateToOutput(resources[0]));
71 execute: dispatch => {
72 dispatch<any>(toggleDetailsPanel());
78 execute: (dispatch, resources) => {
79 dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
85 export const processResourceActionSet: ContextMenuActionSet = [
87 ...readOnlyProcessResourceActionSet.reduce((prev, next) => prev.concat(next), []),
91 execute: (dispatch, resources) => {
92 dispatch<any>(openProcessUpdateDialog(resources[0]));
98 execute: (dispatch, resources) => {
99 dispatch<any>(openSharingDialog(resources[0].uuid));
105 execute: (dispatch, resources) => {
106 dispatch<any>(openMoveProcessDialog(resources[0]));
112 execute: (dispatch, resources) => {
113 dispatch<any>(openRemoveProcessDialog(resources[0], resources.length));
119 const runningProcessOnlyActionSet: ContextMenuActionSet = [
124 execute: (dispatch, resources) => {
125 dispatch<any>(cancelRunningWorkflow(resources[0].uuid));
131 export const processResourceAdminActionSet: ContextMenuActionSet = [
133 ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []),
135 component: TogglePublicFavoriteAction,
136 name: "Add to public favorites",
137 execute: (dispatch, resources) => {
138 dispatch<any>(togglePublicFavorite(resources[0])).then(() => {
139 dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
146 export const runningProcessResourceActionSet = [
148 ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []),
149 ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []),
153 export const runningProcessResourceAdminActionSet: ContextMenuActionSet = [
155 ...processResourceAdminActionSet.reduce((prev, next) => prev.concat(next), []),
156 ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []),