1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00

minor bug fixes in number control and time control

This commit is contained in:
Laura Fuentes Grau 2020-03-28 18:06:08 +01:00
parent 68b688e52b
commit 76b7c60196
4 changed files with 10 additions and 7 deletions

View file

@ -68,7 +68,7 @@ export default function CreateControls(widgetType = null, widget = null, session
break;
case 'Plot':
DialogControls.push(
<EditWidgetTimeControl key={0} widget={widget} handleChange={(e) => handleChange(e)} />,
<EditWidgetTimeControl key={0} widget={widget} controlId={'customProperties.time'} handleChange={(e) => handleChange(e)} />,
<EditWidgetSignalsControl key={1} widget={widget} controlId={'signalIDs'} signals={signals} handleChange={(e) => handleChange(e)} />,
<EditWidgetTextControl key={2} widget={widget} controlId={'customProperties.ylabel'} label={'Y-Axis name'} placeholder={'Enter a name for the y-axis'} handleChange={(e) => handleChange(e)} />,
<EditWidgetMinMaxControl key={3} widget={widget} controlId="customProperties.y" handleChange={e => handleChange(e)} />

View file

@ -35,11 +35,11 @@ class EditWidgetNumberControl extends Component {
};
}
render() {
render() {
return (
<FormGroup controlId={this.props.controlId}>
<FormLabel>{this.props.label}</FormLabel>
<FormControl type="number" step="any" value={this.state.widget.customProperties[this.props.controlId] || 0} onChange={e => this.props.handleChange(e)} />
<FormControl type="number" step="any" value={this.state.widget[this.props.controlId]} onChange={e => this.props.handleChange(e)} />
</FormGroup>
);
}

View file

@ -23,8 +23,7 @@ class EditWidgetTimeControl extends Component {
super(props);
this.state = {
widget: {
time: 0
widget: {
}
};
}
@ -38,9 +37,9 @@ class EditWidgetTimeControl extends Component {
render() {
return (
<FormGroup controlId="time">
<FormGroup controlId= {this.props.controlId}>
<FormLabel>Time</FormLabel>
<FormControl type="number" min="1" max="300" placeholder="Enter time" value={this.state.widget.time} onChange={(e) => this.props.handleChange(e)} />
<FormControl type="number" min="1" max="300" placeholder="Enter time" value={this.state.widget[this.props.controlId]} onChange={(e) => this.props.handleChange(e)} />
<FormText>Time in seconds</FormText>
</FormGroup>
);

View file

@ -128,6 +128,9 @@ class WidgetFactory {
widget.height = 100;
widget.customProperties.background_color = 1;
widget.customProperties.font_color = 0;
widget.customProperties.on_value = 1;
widget.customProperties.off_value = 0;
widget.customProperties.toggle = false;
break;
case 'Input':
widget.minWidth = 200;
@ -146,6 +149,7 @@ class WidgetFactory {
widget.customProperties.rangeUseMinMax = true;
widget.customProperties.showUnit = true;
widget.customProperties.continous_update = false;
widget.customProperties.default_value = 0;
break;
case 'Gauge':