Commit eae790f2 authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

[js][plotter] fix issue to save boolean values and reload them

parent fd1f1078
...@@ -51,6 +51,19 @@ export default class ParameterCreate extends React.Component<Props, State> { ...@@ -51,6 +51,19 @@ export default class ParameterCreate extends React.Component<Props, State> {
const params = this.props.params; const params = this.props.params;
const updateParameter = this.props.updateParameter; const updateParameter = this.props.updateParameter;
let new_param = false;
if (param.type == 'bool')
{
if(typeof(param.default) == 'string')
{
new_param = true;
}
else
{
new_param = false;
}
}
return ( return (
<React.Fragment> <React.Fragment>
<TypedField <TypedField
...@@ -332,6 +345,12 @@ export default class ParameterCreate extends React.Component<Props, State> { ...@@ -332,6 +345,12 @@ export default class ParameterCreate extends React.Component<Props, State> {
<Input <Input
name={`default${ name }`} name={`default${ name }`}
type='radio' type='radio'
checked={param.default && !new_param}
value={true}
onChange={(e) => updateParameter(name, {
...param,
default: JSON.parse(e.target.value)
})}
/> />
True True
</Label> </Label>
...@@ -341,6 +360,12 @@ export default class ParameterCreate extends React.Component<Props, State> { ...@@ -341,6 +360,12 @@ export default class ParameterCreate extends React.Component<Props, State> {
<Input <Input
name={`default${ name }`} name={`default${ name }`}
type='radio' type='radio'
checked={!param.default && !new_param}
value={false}
onChange={(e) => updateParameter(name, {
...param,
default: JSON.parse(e.target.value)
})}
/> />
False False
</Label> </Label>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment