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';
18 export const RUN_PROCESS_BASIC_FORM = 'runProcessBasicForm';
20 export interface RunProcessBasicFormData {
22 owner?: ProjectResource | UserResource;
25 interface RunProcessBasicFormProps {
26 workflow?: WorkflowResource;
29 type CssRules = 'root' | 'name' | 'description';
31 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
37 color: theme.customs.colors.greyD,
43 export const RunProcessBasicForm = reduxForm<RunProcessBasicFormData, RunProcessBasicFormProps>({
44 form: RUN_PROCESS_BASIC_FORM,
46 withStyles(styles)((props: InjectedFormProps<RunProcessBasicFormData, RunProcessBasicFormProps> & RunProcessBasicFormProps & WithStyles<CssRules>) => (
47 <form className={props.classes.root}>
58 className={props.classes.name}
59 data-cy='workflow-name'
71 className={props.classes.description}
72 data-cy='workflow-description'
73 //dangerouslySetInnerHTML is ok here only if description is sanitized,
74 //which it is before it is loaded into the redux store
75 dangerouslySetInnerHTML={{ __html: props.workflow.description }}
86 component={TextField as any}
87 label='Name for this workflow run'
89 validate={PROCESS_NAME_VALIDATION}
102 label: 'Project where the workflow will run',
103 } as ProjectCommandInputParameter
105 options={{ showOnlyOwned: false, showOnlyWritable: true }}