diff --git a/smart-hut/src/components/SimulationPanel.js b/smart-hut/src/components/SimulationPanel.js index 3031388..5853b97 100644 --- a/smart-hut/src/components/SimulationPanel.js +++ b/smart-hut/src/components/SimulationPanel.js @@ -273,7 +273,7 @@ class SimulationPanel extends Component { updateSliderValues(type, data, motion) { console.log(data, motion); this.setState({ - [type ? 'error' : 'value']: data, + [type ? 'error' : 'value']: parseInt(data), }); } diff --git a/smart-hut/src/components/SimulationPanelSlider.js b/smart-hut/src/components/SimulationPanelSlider.js index e278655..e0c36ce 100644 --- a/smart-hut/src/components/SimulationPanelSlider.js +++ b/smart-hut/src/components/SimulationPanelSlider.js @@ -13,6 +13,7 @@ class SimulationPanelSlider extends Component { value: this.internalValue, error: this.internalValue, }; + this.props.update(this.props.error, this.internalValue); this.updateSliderValues = this.updateSliderValues.bind(this); } diff --git a/smart-hut/src/components/SliderHumidity.js b/smart-hut/src/components/SliderHumidity.js deleted file mode 100644 index 94e1242..0000000 --- a/smart-hut/src/components/SliderHumidity.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderHumidity extends Component { - state = { visible: true, duration: 78 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Humidity: ${duration} %`} -

- - -
-
- ); - } -} diff --git a/smart-hut/src/components/SliderLight.js b/smart-hut/src/components/SliderLight.js deleted file mode 100644 index e5a638c..0000000 --- a/smart-hut/src/components/SliderLight.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderLight extends Component { - state = { visible: true, duration: 10500 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Light intensity: ${duration} lm`} -

- - -
-
- ); - } -} diff --git a/smart-hut/src/components/SliderLightRange.js b/smart-hut/src/components/SliderLightRange.js deleted file mode 100644 index 0854a10..0000000 --- a/smart-hut/src/components/SliderLightRange.js +++ /dev/null @@ -1,46 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderTempRange extends Component { - state = { visible: true, duration: 500 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Chosen tolerance: +/- ${duration}`} -

- - - -
-
- ); - } -} diff --git a/smart-hut/src/components/SliderMotion.js b/smart-hut/src/components/SliderMotion.js deleted file mode 100644 index 8c3a8ce..0000000 --- a/smart-hut/src/components/SliderMotion.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderLight extends Component { - state = { visible: true, duration: 5 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Range: ${duration} meters`} -

- - -
-
- ); - } -} diff --git a/smart-hut/src/components/SliderTempRange.js b/smart-hut/src/components/SliderTempRange.js deleted file mode 100644 index 41035f3..0000000 --- a/smart-hut/src/components/SliderTempRange.js +++ /dev/null @@ -1,46 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderTempRange extends Component { - state = { visible: true, duration: 5 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Chosen tolerance: +/- ${duration}`} -

- - - -
-
- ); - } -} diff --git a/smart-hut/src/components/SliderTemperature.js b/smart-hut/src/components/SliderTemperature.js deleted file mode 100644 index 5cace21..0000000 --- a/smart-hut/src/components/SliderTemperature.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { Component } from 'react'; -import { - Form, Grid, Image, Transition, Divider, -} from 'semantic-ui-react'; - - -export default class SliderTemperature extends Component { - state = { visible: true, duration: 20 } - - handleChange = (e, { name, value }) => this.setState({ [name]: value }) - - handleVisibility = () => this.setState((prevState) => ({ visible: !prevState.visible })) - - render() { - const { duration } = this.state; - - return ( - - -

- {`Heat: ${duration} Celsius Degrees`} -

- - -
-
- ); - } -} diff --git a/smart-hut/src/remote.js b/smart-hut/src/remote.js index 6d294bd..4a56a09 100644 --- a/smart-hut/src/remote.js +++ b/smart-hut/src/remote.js @@ -542,7 +542,11 @@ export const RemoteService = { updateSimulation: (data) => (dispatch) => { const url = `/sensor/${data.id}/simulation`; - return Endpoint.put(url, {}, data) + const param = { + typical: data.typical, + error: data.err, + }; + return Endpoint.put(url, {}, param) .then((res) => { dispatch(actions.deviceSave(res.data)); return res.data;