-export const processResourceActionSet: ContextMenuActionSet = [[
- {
- icon: RenameIcon,
- name: "Edit process",
- execute: (dispatch, resource) => {
- dispatch<any>(openProcessUpdateDialog(resource));
- }
- },
- {
- icon: ShareIcon,
- name: "Share",
- execute: (dispatch, { uuid }) => {
- dispatch<any>(openSharingDialog(uuid));
- }
- },
- {
- component: ToggleFavoriteAction,
- execute: (dispatch, resource) => {
- dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
- });
- }
- },
- {
- icon: MoveToIcon,
- name: "Move to",
- execute: (dispatch, resource) => {
- dispatch<any>(openMoveProcessDialog(resource));
- }
- },
- {
- icon: CopyIcon,
- name: "Copy to project",
- execute: (dispatch, resource) => {
- dispatch<any>(openCopyProcessDialog(resource));
- }
- },
- {
- icon: DetailsIcon,
- name: "View details",
- execute: dispatch => {
- dispatch<any>(toggleDetailsPanel());
- }
- },
- {
- name: "Remove",
- icon: RemoveIcon,
- execute: (dispatch, resource) => {
- dispatch<any>(openRemoveProcessDialog(resource.uuid));
- }
- }
-]];
+export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [
+ [
+ {
+ component: ToggleFavoriteAction,
+ execute: (dispatch, resources) => {
+ dispatch<any>(toggleFavorite(resources[0])).then(() => {
+ dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+ });
+ },
+ },
+ {
+ icon: OpenIcon,
+ name: "Open in new tab",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openInNewTabAction(resources[0]));
+ },
+ },
+ {
+ icon: ReRunProcessIcon,
+ name: "Copy and re-run process",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openCopyProcessDialog(resources[0]));
+ },
+ },
+ {
+ icon: OutputIcon,
+ name: "Outputs",
+ execute: (dispatch, resources) => {
+ if (resources[0]) {
+ dispatch<any>(navigateToOutput(resources[0]));
+ }
+ },
+ },
+ {
+ icon: DetailsIcon,
+ name: "View details",
+ execute: dispatch => {
+ dispatch<any>(toggleDetailsPanel());
+ },
+ },
+ {
+ icon: AdvancedIcon,
+ name: "API Details",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
+ },
+ },
+ ],
+];
+
+export const processResourceActionSet: ContextMenuActionSet = [
+ [
+ ...readOnlyProcessResourceActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RenameIcon,
+ name: "Edit process",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openProcessUpdateDialog(resources[0]));
+ },
+ },
+ {
+ icon: ShareIcon,
+ name: "Share",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openSharingDialog(resources[0].uuid));
+ },
+ },
+ {
+ icon: MoveToIcon,
+ name: "Move to",
+ execute: (dispatch, resources) => {
+ dispatch<any>(openMoveProcessDialog(resources[0]));
+ },
+ },
+ {
+ name: "Remove",
+ icon: RemoveIcon,
+ execute: (dispatch, resources) => {
+ dispatch<any>(openRemoveProcessDialog(resources[0], resources.length));
+ },
+ },
+ ],
+];
+
+const runningProcessOnlyActionSet: ContextMenuActionSet = [
+ [
+ {
+ name: "CANCEL",
+ icon: StopIcon,
+ execute: (dispatch, resources) => {
+ dispatch<any>(cancelRunningWorkflow(resources[0].uuid));
+ },
+ },
+ ]
+];
+
+export const processResourceAdminActionSet: ContextMenuActionSet = [
+ [
+ ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ component: TogglePublicFavoriteAction,
+ name: "Add to public favorites",
+ execute: (dispatch, resources) => {
+ dispatch<any>(togglePublicFavorite(resources[0])).then(() => {
+ dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
+ });
+ },
+ },
+ ],
+];
+
+export const runningProcessResourceActionSet = [
+ [
+ ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []),
+ ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []),
+ ],
+];
+
+export const runningProcessResourceAdminActionSet: ContextMenuActionSet = [
+ [
+ ...processResourceAdminActionSet.reduce((prev, next) => prev.concat(next), []),
+ ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []),
+ ],
+];