15397: Fix usage of deprecated assertRegexpMatches.
[arvados.git] / services / workbench2 / src / views-components / dialog-copy / dialog-process-rerun.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from 'react';
6 import { memoize } from 'lodash/fp';
7 import { InjectedFormProps, Field } from 'redux-form';
8 import { WithDialogProps } from 'store/dialog/with-dialog';
9 import { FormDialog } from 'components/form-dialog/form-dialog';
10 import { ProjectTreePickerField } from 'views-components/projects-tree-picker/tree-picker-field';
11 import { COPY_NAME_VALIDATION, COPY_FILE_VALIDATION } from 'validators/validators';
12 import { TextField } from 'components/text-field/text-field';
13 import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
14 import { PickerIdProp } from 'store/tree-picker/picker-id';
15
16 type ProcessRerunFormDialogProps = WithDialogProps<string> & InjectedFormProps<CopyFormDialogData>;
17
18 export const DialogProcessRerun = (props: ProcessRerunFormDialogProps & PickerIdProp) => (
19     <FormDialog dialogTitle='Choose location for re-run' formFields={CopyDialogFields(props.pickerId)} submitLabel='Copy' {...props} />
20 );
21
22 const CopyDialogFields = memoize((pickerId: string) => () => (
23     <>
24         <Field name='name' component={TextField as any} validate={COPY_NAME_VALIDATION} label='Enter a new name for the copy' />
25         <Field name='ownerUuid' component={ProjectTreePickerField} validate={COPY_FILE_VALIDATION} pickerId={pickerId} />
26     </>
27 ));