import { RootState } from '~/store/store';
export const runProcessPanelActions = unionize({
- CHANGE_STEP: ofType<number>()
+ SET_CURRENT_STEP: ofType<number>()
});
export type RunProcessPanelAction = UnionOf<typeof runProcessPanelActions>;
};
-export const goToStep = (step: number) => runProcessPanelActions.CHANGE_STEP(step);
\ No newline at end of file
+export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);
\ No newline at end of file
export const runProcessPanelReducer = (state = initialState, action: RunProcessPanelAction): RunProcessPanel =>
runProcessPanelActions.match(action, {
- CHANGE_STEP: currentStep => ({ ...state, currentStep }),
+ SET_CURRENT_STEP: currentStep => ({ ...state, currentStep }),
default: () => state
});
\ No newline at end of file
}
export interface RunProcessPanelRootActionProps {
- onClick: (step: number) => void;
+ onSetStep: (step: number) => void;
}
type RunProcessPanelRootProps = RunProcessPanelRootDataProps & RunProcessPanelRootActionProps;
-export const RunProcessPanelRoot = ({ currentStep, onClick, ...props }: RunProcessPanelRootProps) =>
+export const RunProcessPanelRoot = ({ currentStep, onSetStep, ...props }: RunProcessPanelRootProps) =>
<Stepper activeStep={currentStep} orientation="vertical" elevation={2}>
<Step>
<StepLabel>Choose a workflow</StepLabel>
<StepContent>
- <Button variant="contained" color="primary" onClick={() => onClick(1)}>
+ <Button variant="contained" color="primary" onClick={() => onSetStep(1)}>
Next
</Button>
</StepContent>
<Step>
<StepLabel>Select inputs</StepLabel>
<StepContent>
- <Button color="primary" onClick={() => onClick(0)}>
+ <Button color="primary" onClick={() => onSetStep(0)}>
Back
</Button>
<Button variant="contained" color="primary">
};
const mapDispatchToProps = (dispatch: Dispatch): RunProcessPanelRootActionProps => ({
- onClick: (step: number) => {
+ onSetStep: (step: number) => {
dispatch<any>(goToStep(step));
}
});