1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { reduxForm, Field, InjectedFormProps } from 'redux-form';
7 import { Grid, Typography } from '@mui/material';
8 import withStyles from '@mui/styles/withStyles';
9 import { WithStyles } from '@mui/styles';
10 import { TextField } from 'components/text-field/text-field';
11 import { ProjectInput, ProjectCommandInputParameter } from 'views/run-process-panel/inputs/project-input';
12 import { PROCESS_NAME_VALIDATION } from 'validators/validators';
13 import { WorkflowResource } from 'models/workflow';
14 import { ArvadosTheme, CustomStyleRulesCallback } from 'common/custom-theme';
15 import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from 'store/run-process-panel/run-process-panel-actions';
17 interface RunProcessBasicFormProps {
18 workflow?: WorkflowResource;
21 type CssRules = 'root' | 'name' | 'description';
23 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
29 color: theme.customs.colors.greyD,
35 export const RunProcessBasicForm = reduxForm<RunProcessBasicFormData, RunProcessBasicFormProps>({
36 form: RUN_PROCESS_BASIC_FORM,
38 withStyles(styles)((props: InjectedFormProps<RunProcessBasicFormData, RunProcessBasicFormProps> & RunProcessBasicFormProps & WithStyles<CssRules>) => (
39 <form className={props.classes.root}>
50 className={props.classes.name}
51 data-cy='workflow-name'
63 className={props.classes.description}
64 data-cy='workflow-description'
65 //dangerouslySetInnerHTML is ok here only if description is sanitized,
66 //which it is before it is loaded into the redux store
67 dangerouslySetInnerHTML={{ __html: props.workflow.description }}
78 component={TextField as any}
79 label='Name for this workflow run'
81 validate={PROCESS_NAME_VALIDATION}
94 label: 'Project where the workflow will run',
95 } as ProjectCommandInputParameter
97 options={{ showOnlyOwned: false, showOnlyWritable: true }}