1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { Grid, Button } from '@material-ui/core';
7 import { RunProcessBasicForm, RUN_PROCESS_BASIC_FORM } from './run-process-basic-form';
8 import { RunProcessInputsForm } from '~/views/run-process-panel/run-process-inputs-form';
9 import { CommandInputParameter } from '~/models/workflow';
10 import { connect } from 'react-redux';
11 import { RootState } from '~/store/store';
12 import { isValid } from 'redux-form';
13 import { RUN_PROCESS_INPUTS_FORM } from './run-process-inputs-form';
14 import { RunProcessAdvancedForm } from './run-process-advanced-form';
16 export interface RunProcessSecondStepFormDataProps {
17 inputs: CommandInputParameter[];
21 export interface RunProcessSecondStepFormActionProps {
23 runProcess: () => void;
26 const mapStateToProps = (state: RootState): RunProcessSecondStepFormDataProps => ({
27 inputs: state.runProcessPanel.inputs,
28 valid: isValid(RUN_PROCESS_BASIC_FORM)(state) &&
29 isValid(RUN_PROCESS_INPUTS_FORM)(state),
32 export type RunProcessSecondStepFormProps = RunProcessSecondStepFormDataProps & RunProcessSecondStepFormActionProps;
33 export const RunProcessSecondStepForm = connect(mapStateToProps)(
34 ({ inputs, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
35 <Grid container spacing={16}>
37 <RunProcessBasicForm />
38 <RunProcessInputsForm inputs={inputs} />
39 <RunProcessAdvancedForm />
42 <Button color="primary" onClick={goBack}>
45 <Button disabled={!valid} variant="contained" color="primary" onClick={runProcess}>