From eae790f28777235729382d2c63a37fa49442f711 Mon Sep 17 00:00:00 2001 From: Flavio Tarsetti <Flavio.Tarsetti@idiap.ch> Date: Mon, 1 Oct 2018 10:23:20 +0200 Subject: [PATCH] [js][plotter] fix issue to save boolean values and reload them --- conda/js/src/components/ParameterCreate.jsx | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/conda/js/src/components/ParameterCreate.jsx b/conda/js/src/components/ParameterCreate.jsx index 378557d5..7ae95a89 100644 --- a/conda/js/src/components/ParameterCreate.jsx +++ b/conda/js/src/components/ParameterCreate.jsx @@ -51,6 +51,19 @@ export default class ParameterCreate extends React.Component<Props, State> { const params = this.props.params; 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 ( <React.Fragment> <TypedField @@ -332,6 +345,12 @@ export default class ParameterCreate extends React.Component<Props, State> { <Input name={`default${ name }`} type='radio' + checked={param.default && !new_param} + value={true} + onChange={(e) => updateParameter(name, { + ...param, + default: JSON.parse(e.target.value) + })} /> True </Label> @@ -341,6 +360,12 @@ export default class ParameterCreate extends React.Component<Props, State> { <Input name={`default${ name }`} type='radio' + checked={!param.default && !new_param} + value={false} + onChange={(e) => updateParameter(name, { + ...param, + default: JSON.parse(e.target.value) + })} /> False </Label> -- GitLab