Merge branch '16848-token-handling-improvements'
[arvados-workbench2.git] / src / views / run-process-panel / run-process-panel-root.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { Stepper, Step, StepLabel, StepContent } from '@material-ui/core';
7 import { RunProcessFirstStepDataProps, RunProcessFirstStepActionProps, RunProcessFirstStep } from '~/views/run-process-panel/run-process-first-step';
8 import { RunProcessSecondStepForm } from './run-process-second-step';
9
10 export type RunProcessPanelRootDataProps = {
11     currentStep: number;
12 } & RunProcessFirstStepDataProps;
13
14 export type RunProcessPanelRootActionProps = RunProcessFirstStepActionProps & {
15     runProcess: () => void;
16 };
17
18 type RunProcessPanelRootProps = RunProcessPanelRootDataProps & RunProcessPanelRootActionProps;
19
20 export const RunProcessPanelRoot = ({ runProcess, currentStep, onSearch, onSetStep, onSetWorkflow, workflows, selectedWorkflow }: RunProcessPanelRootProps) =>
21     <Stepper activeStep={currentStep} orientation="vertical" elevation={2}>
22         <Step>
23             <StepLabel>Choose a workflow</StepLabel>
24             <StepContent>
25                 <RunProcessFirstStep
26                     workflows={workflows}
27                     selectedWorkflow={selectedWorkflow}
28                     onSearch={onSearch}
29                     onSetStep={onSetStep} 
30                     onSetWorkflow={onSetWorkflow} />
31             </StepContent>
32         </Step>
33         <Step>
34             <StepLabel>Select inputs</StepLabel>
35             <StepContent>
36                 <RunProcessSecondStepForm
37                     goBack={() => onSetStep(0)}
38                     runProcess={runProcess} />
39             </StepContent>
40         </Step>
41     </Stepper>;