fixed minor bug on smartplugs

This commit is contained in:
britea 2020-03-26 09:51:25 +01:00
parent e231425a94
commit 054f4ad341
4 changed files with 11 additions and 12 deletions

View file

@ -12,7 +12,7 @@ import {
editModeStyleLeft,
} from "./styleComponents";
import Settings from "./DeviceSettings";
import { Image, Icon } from "semantic-ui-react";
import { Image } from "semantic-ui-react";
import {
energyConsumedStyle,
imageStyle,
@ -75,7 +75,7 @@ export default class SmartPlug extends Component {
componentDidMount() {
this.setState({
turnedOn: this.props.device.on,
energyConsumed: this.props.device.totalConsumption,
energyConsumed: (this.props.device.totalConsumption / 1000).toFixed(3),
});
}

View file

@ -102,7 +102,6 @@ export default class ModalWindow extends Component {
padding: "10px 10px",
margin: "10px 0px",
};
console.log(this.state, this.idRoom);
return (
<div>
<Responsive minWidth={768}>

View file

@ -38,21 +38,21 @@ export default class Dashboard extends Component {
.getAllDevices()
.then((res) => {
if (res.status === 200) {
console.log(res.data);
//console.log(res.data);
this.setState({
devices: res.data,
});
}
})
.catch((err) => {
console.log(err);
//console.log(err);
});
} else {
call
.getAllDevicesByRoom(this.state.activeItem)
.then((res) => {
if (res.status === 200) {
console.log(res.data);
//console.log(res.data);
this.setState({
devices: res.data,
});
@ -88,7 +88,7 @@ export default class Dashboard extends Component {
}
})
.catch((err) => {
console.log(err);
//console.log(err);
});
}
@ -107,7 +107,7 @@ export default class Dashboard extends Component {
this.handleItemClick(-1);
})
.catch((err) => {
console.log(err);
//console.log(err);
});
}
@ -139,7 +139,7 @@ export default class Dashboard extends Component {
}
})
.catch((err) => {
console.log(err);
//console.log(err);
});
} else {
call
@ -153,7 +153,7 @@ export default class Dashboard extends Component {
}
})
.catch((err) => {
console.log(err);
//console.log(err);
});
}
this.state.rooms.forEach((item) => {

View file

@ -26,13 +26,13 @@ class Navbar extends Component {
handleClick = (e, { id, name }) => {
const room = this.props.rooms.filter((d) => d.id === id)[0];
console.log(room);
//console.log(room);
this.setState({
activeItem: id,
activeItemName: name,
});
this.activeRoom = room;
console.log(this.activeRoom);
//console.log(this.activeRoom);
this.forceUpdate();
this.props.handleItemClick(id);
};