remove duplications
This commit is contained in:
parent
c652f588cf
commit
00a3a8786a
9 changed files with 7 additions and 274 deletions
|
@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Humidity: ${duration} %`}
|
||||
</p>
|
||||
|
||||
<Form.Input
|
||||
min={0}
|
||||
max={100}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={1}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Light intensity: ${duration} lm`}
|
||||
</p>
|
||||
|
||||
<Form.Input
|
||||
min={0}
|
||||
max={15000}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={5}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Chosen tolerance: +/- ${duration}`}
|
||||
</p>
|
||||
|
||||
|
||||
<Form.Input
|
||||
min={0}
|
||||
max={1000}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={1}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Range: ${duration} meters`}
|
||||
</p>
|
||||
|
||||
<Form.Input
|
||||
min={0}
|
||||
max={15}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={5}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Chosen tolerance: +/- ${duration}`}
|
||||
</p>
|
||||
|
||||
|
||||
<Form.Input
|
||||
min={0}
|
||||
max={10}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={1}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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 (
|
||||
<Grid columns={2}>
|
||||
<Grid.Column as={Form} textAlign="center">
|
||||
<p
|
||||
style={{
|
||||
color: 'white',
|
||||
padding: '0.5rem',
|
||||
display: 'block',
|
||||
marinLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
}}
|
||||
>
|
||||
{`Heat: ${duration} Celsius Degrees`}
|
||||
</p>
|
||||
|
||||
<Form.Input
|
||||
min={10}
|
||||
max={35}
|
||||
name="duration"
|
||||
onChange={this.handleChange}
|
||||
step={1}
|
||||
type="range"
|
||||
value={duration}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue