1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { BooleanCommandInputParameter, getInputLabel, isRequiredInput } from '~/models/workflow';
7 import { Field, WrappedFieldProps } from 'redux-form';
8 import { TextField } from '~/components/text-field/text-field';
9 import { FormGroup, FormLabel, FormHelperText, Switch } from '@material-ui/core';
11 export interface BooleanInputProps {
12 input: BooleanCommandInputParameter;
14 export const BooleanInput = ({ input }: BooleanInputProps) =>
17 label={getInputLabel(input)}
18 component={BooleanInputComponent}
19 normalize={(value, prevValue) => !prevValue}
22 const BooleanInputComponent = (props: WrappedFieldProps & { label?: string }) =>
24 <FormLabel>{props.label}</FormLabel>
27 checked={props.input.value}
28 onChange={() => props.input.onChange(props.input.value)} />