added update for dimmableLights

This commit is contained in:
britea 2020-03-23 13:22:30 +01:00
parent 950908ef07
commit 045742d68e
4 changed files with 15 additions and 19 deletions

View File

@ -31,7 +31,6 @@ class App extends Component {
let userJsonString = localStorage.getItem("token");
let exp = localStorage.getItem("exp");
let date = new Date().getTime();
console.log(exp > date, date)
if (userJsonString && exp && date < exp) {
loggedIn = true;
} else {
@ -53,7 +52,6 @@ class App extends Component {
componentDidMount() {
if (window.location) {
const values = queryString.parse(window.location.search);
console.log(values);
this.setState({
query : values
});

View File

@ -36,7 +36,6 @@ export default class Light extends Component {
setIntensity = (newValue) => {
this.props.device.intensity = Math.round(newValue * 100) <= 1 ? 1 : Math.round(newValue * 100);
console.log(this.props.device.intensity)
call.deviceUpdate(this.props.device, 'dimmableLight')
.then(res => {
if (res.status === 200 ) {
@ -69,7 +68,7 @@ export default class Light extends Component {
render() {
const intensityLightView = (
<CircularInput
value={Math.round(this.props.device.intensity/100)}
value={+(Math.round(this.props.device.intensity/100 + "e+2") + "e-2")}
onChange={this.setIntensity}
style={style}
>

View File

@ -108,12 +108,12 @@ export default class ModalWindow extends Component {
<p>Insert the name of the room:</p>
<Form.Field>
<Input label='Room name' placeholder='Room Name' name="name" type='text' onChange={this.changeSomething}
value={this.props.type === "new" && this.props.idRoom !== -1 ? "" : "" }/>
value={this.props.type === "new" ? "" : this.props.idRoom.name }/>
</Form.Field>
<p>Insert an image of the room:</p>
<Form.Field>
<Input label='Room image' type='file' name="img" onChange={this.changeSomething}
value={this.props.type === "new" && this.props.idRoom !== -1 ? "" : this.props.idRoom.images }/>
value={this.props.type === "new" ? "" : this.props.idRoom.images }/>
</Form.Field>
</Form>
@ -126,7 +126,7 @@ export default class ModalWindow extends Component {
<Button icon labelPosition='left' inverted color='red' onClick={this.deleteRoom}>
<Icon name='trash alternate' />
Delete room
</Button> : "" }
</Button> : null }
</Modal.Content>
<Modal.Actions>

View File

@ -36,7 +36,7 @@ class Navbar extends Component {
render(){
//const { activeItem } = this.state
return (
<div style={{background: '#1b1c1d'}}>
<div style={{background: '#1b1c1d!important'}}>
<Segment.Group>
<Responsive as={Segment} minWidth={768}>
<Grid>
@ -163,22 +163,21 @@ class Navbar extends Component {
</Dropdown.Menu>
</Dropdown>
</Menu>
{
this.state.activeItem !== -1 ?
<Grid>
</Menu >
<Grid inverted>
<Grid.Row>
<Grid.Column width={8}>
<ModalWindow type="new" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
</Grid.Column>
<Grid.Column width={8}>
<ModalWindow type="modify" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
<ModalWindow type="new" addRoom={this.props.addRoom} />
</Grid.Column>
{
this.state.activeItem !== -1 ?
<Grid.Column width={8}>
<ModalWindow type="modify" idRoom={this.state.activeRoom} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom}/>
</Grid.Column>
: null
}
</Grid.Row>
</Grid>
:
null
}
</Responsive>
</Segment.Group>