15557: Remove broken re0run functionality and rename process copy to better reflect...
authorStephen Smith <stephen@curii.com>
Mon, 9 Jan 2023 20:27:21 +0000 (15:27 -0500)
committerStephen Smith <stephen@curii.com>
Mon, 9 Jan 2023 20:27:21 +0000 (15:27 -0500)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/views-components/context-menu/action-sets/process-resource-action-set.ts
src/views-components/dialog-copy/dialog-process-rerun.tsx [new file with mode: 0644]
src/views-components/dialog-forms/copy-process-dialog.ts

index 78b2f340b8d814efbb9800ab396c3858964313a5..7d593ee4b4f72978b1f5c7aa285d435c7df0cf6e 100644 (file)
@@ -6,7 +6,7 @@ import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "store/favorites/favorites-actions";
 import {
-    RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon,
+    RenameIcon, ShareIcon, MoveToIcon, DetailsIcon,
     RemoveIcon, ReRunProcessIcon, OutputIcon,
     AdvancedIcon,
     OpenIcon
@@ -16,9 +16,8 @@ import { openMoveProcessDialog } from 'store/processes/process-move-actions';
 import { openProcessUpdateDialog } from "store/processes/process-update-actions";
 import { openCopyProcessDialog } from 'store/processes/process-copy-actions';
 import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions";
-import { openRemoveProcessDialog, reRunProcess } from "store/processes/processes-actions";
+import { openRemoveProcessDialog } from "store/processes/processes-actions";
 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
-import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
 import { navigateToOutput } from "store/process-panel/process-panel-actions";
 import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
 import { TogglePublicFavoriteAction } from "../actions/public-favorite-action";
@@ -42,22 +41,11 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
             dispatch<any>(openInNewTabAction(resource));
         }
     },
-    {
-        icon: CopyIcon,
-        name: "Copy to project",
-        execute: (dispatch, resource) => {
-            dispatch<any>(openCopyProcessDialog(resource));
-        }
-    },
     {
         icon: ReRunProcessIcon,
-        name: "Re-run process",
+        name: "Copy and re-run process",
         execute: (dispatch, resource) => {
-            if(resource.workflowUuid) {
-                dispatch<any>(reRunProcess(resource.uuid, resource.workflowUuid));
-            } else {
-                dispatch(snackbarActions.OPEN_SNACKBAR({ message: `You can't re-run this process`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
-            }
+            dispatch<any>(openCopyProcessDialog(resource));
         }
     },
     {
diff --git a/src/views-components/dialog-copy/dialog-process-rerun.tsx b/src/views-components/dialog-copy/dialog-process-rerun.tsx
new file mode 100644 (file)
index 0000000..9f97b1a
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import React from "react";
+import { memoize } from 'lodash/fp';
+import { InjectedFormProps, Field } from 'redux-form';
+import { WithDialogProps } from 'store/dialog/with-dialog';
+import { FormDialog } from 'components/form-dialog/form-dialog';
+import { ProjectTreePickerField } from 'views-components/projects-tree-picker/tree-picker-field';
+import { COPY_NAME_VALIDATION, COPY_FILE_VALIDATION } from 'validators/validators';
+import { TextField } from "components/text-field/text-field";
+import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
+import { PickerIdProp } from 'store/tree-picker/picker-id';
+
+type ProcessRerunFormDialogProps = WithDialogProps<string> & InjectedFormProps<CopyFormDialogData>;
+
+export const DialogProcessRerun = (props: ProcessRerunFormDialogProps & PickerIdProp) =>
+    <FormDialog
+        dialogTitle='Choose location for re-run'
+        formFields={CopyDialogFields(props.pickerId)}
+        submitLabel='Copy'
+        {...props}
+    />;
+
+const CopyDialogFields = memoize((pickerId: string) =>
+    () =>
+        <>
+            <Field
+                name='name'
+                component={TextField as any}
+                validate={COPY_NAME_VALIDATION}
+                label="Enter a new name for the copy" />
+            <Field
+                name="ownerUuid"
+                component={ProjectTreePickerField}
+                validate={COPY_FILE_VALIDATION}
+                pickerId={pickerId}/>
+        </>);
index c8f33642abe9bdb45d8b49818afc5c0294d1b1d6..6a79b62613d34b435a8c3a04f7bd3ad78e92602d 100644 (file)
@@ -6,7 +6,7 @@ import { compose } from "redux";
 import { withDialog } from "store/dialog/with-dialog";
 import { reduxForm } from 'redux-form';
 import { PROCESS_COPY_FORM_NAME } from 'store/processes/process-copy-actions';
-import { DialogCopy } from "views-components/dialog-copy/dialog-copy";
+import { DialogProcessRerun } from "views-components/dialog-copy/dialog-process-rerun";
 import { copyProcess } from 'store/workbench/workbench-actions';
 import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
 import { pickerId } from "store/tree-picker/picker-id";
@@ -20,4 +20,4 @@ export const CopyProcessDialog = compose(
         }
     }),
     pickerId(PROCESS_COPY_FORM_NAME),
-)(DialogCopy);
\ No newline at end of file
+)(DialogProcessRerun);