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
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";
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));
}
},
{
--- /dev/null
+// 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}/>
+ </>);
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";
}
}),
pickerId(PROCESS_COPY_FORM_NAME),
-)(DialogCopy);
\ No newline at end of file
+)(DialogProcessRerun);