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 { ProjectResource } from 'models/project';
14 import { UserResource } from 'models/user';
15 import { WorkflowResource } from 'models/workflow';
16 import { ArvadosTheme, CustomStyleRulesCallback } from 'common/custom-theme';
17 import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from 'store/run-process-panel/run-process-panel-actions';
19 interface RunProcessBasicFormProps {
20 workflow?: WorkflowResource;
23 type CssRules = 'root' | 'name' | 'description';
25 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
31 color: theme.customs.colors.greyD,
37 export const RunProcessBasicForm = reduxForm<RunProcessBasicFormData, RunProcessBasicFormProps>({
38 form: RUN_PROCESS_BASIC_FORM,
40 withStyles(styles)((props: InjectedFormProps<RunProcessBasicFormData, RunProcessBasicFormProps> & RunProcessBasicFormProps & WithStyles<CssRules>) => (
41 <form className={props.classes.root}>
52 className={props.classes.name}
53 data-cy='workflow-name'
65 className={props.classes.description}
66 data-cy='workflow-description'
67 //dangerouslySetInnerHTML is ok here only if description is sanitized,
68 //which it is before it is loaded into the redux store
69 dangerouslySetInnerHTML={{ __html: props.workflow.description }}
80 component={TextField as any}
81 label='Name for this workflow run'
83 validate={PROCESS_NAME_VALIDATION}
96 label: 'Project where the workflow will run',
97 } as ProjectCommandInputParameter
99 options={{ showOnlyOwned: false, showOnlyWritable: true }}