diff options
author | 2020-08-27 09:01:53 +0200 | |
---|---|---|
committer | 2020-08-27 11:52:38 +0200 | |
commit | 4bd84bebdaa0c2d82050fbedd1fa8260eb62146d (patch) | |
tree | 3f26dfc6c7da0f176f31bcde112971b0b8c552ce /sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx | |
parent | 958de10b4c433eb6110b93007f281b07515ed6fe (diff) |
Add link calculation app
Add link calculation app to odlux
Issue-ID: CCSDK-2562
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: Ifc0a5b2a8bb974dfd85d70a9f05990b1f11925a3
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx')
-rw-r--r-- | sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx b/sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx index cc141ee35..2fbbf956f 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx +++ b/sdnr/wt/odlux/apps/configurationApp/src/components/uiElementBoolean.tsx @@ -16,29 +16,28 @@ * ============LICENSE_END========================================================================== */ -import { ViewElementBoolean } from "../models/uiModels"; import * as React from "react" import { MenuItem, FormHelperText, Select, FormControl, InputLabel } from "@material-ui/core"; -import { baseProps } from "./baseProps"; -type booleanInputProps = baseProps; +import { ViewElementBoolean } from "../models/uiModels"; +import { BaseProps } from "./baseProps"; + +type BooleanInputProps = BaseProps<boolean>; -export const UiElementBoolean = (props: booleanInputProps) => { +export const UiElementBoolean = (props: BooleanInputProps) => { const element = props.value as ViewElementBoolean; - let error = ""; const value = String(props.inputValue).toLowerCase(); - if (element.mandatory && value !== "true" && value !== "false") { - error = "Error"; - } + const mandetoryError = element.mandatory && value !== 'true' && value !== 'false'; + return (!props.readOnly || element.id != null ? (<FormControl style={{ width: 485, marginLeft: 20, marginRight: 20 }}> <InputLabel htmlFor={`select-${element.id}`} >{element.label}</InputLabel> <Select required={!!element.mandatory} - error={!!error} - onChange={(e) => { props.onChange(e.target.value as any) }} + error={mandetoryError} + onChange={(e) => { props.onChange(e.target.value === 'true') }} readOnly={props.readOnly} disabled={props.disabled} value={value} @@ -51,7 +50,7 @@ export const UiElementBoolean = (props: booleanInputProps) => { <MenuItem value={'false'}>{element.falseValue || 'False'}</MenuItem> </Select> - <FormHelperText>{error}</FormHelperText> + <FormHelperText>{mandetoryError ? "Value is mandetory" : ""}</FormHelperText> </FormControl>) : null ); |