1417c074c0937164fe2d9be5e28b3c1a8f6ac577
[arvados-workbench2.git] / src / views / run-process-panel / run-process-basic-form.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 { reduxForm, Field } from 'redux-form';
7 import { Grid } from '@material-ui/core';
8 import { TextField } from 'components/text-field/text-field';
9 import { ProjectInput } from 'views/run-process-panel/inputs/project-input';
10 import { PROCESS_NAME_VALIDATION } from 'validators/validators';
11
12 export const RUN_PROCESS_BASIC_FORM = 'runProcessBasicForm';
13
14 export interface RunProcessBasicFormData {
15     name: string;
16     description: string;
17     ownerUuid?: string;
18 }
19 export const RunProcessBasicForm =
20     reduxForm<RunProcessBasicFormData>({
21         form: RUN_PROCESS_BASIC_FORM
22     })(() =>
23         <form>
24             <Grid container spacing={32}>
25                 <Grid item xs={12} md={6}>
26                     <Field
27                         name='name'
28                         component={TextField as any}
29                         label="Enter a new name for run process"
30                         required
31                         validate={PROCESS_NAME_VALIDATION} />
32                 </Grid>
33                 <Grid item xs={12} md={6}>
34                     <Field
35                         name='description'
36                         component={TextField as any}
37                         label="Enter a description for run process" />
38                 </Grid>
39                 <Grid item xs={12} md={6}>
40                     <Field
41                         name='ownerUuid'
42                         component={ProjectInput as any}
43                         label="Project to run the process in" />
44                 </Grid>
45             </Grid>
46         </form>);