From 054f4ad341ea68dacc9e59109cfaa6efd9ad9933 Mon Sep 17 00:00:00 2001 From: britea Date: Thu, 26 Mar 2020 09:51:25 +0100 Subject: [PATCH] fixed minor bug on smartplugs --- .../src/components/dashboard/devices/SmartPlug.js | 4 ++-- smart-hut/src/components/modalform.js | 1 - smart-hut/src/views/Dashboard.js | 14 +++++++------- smart-hut/src/views/Navbar.js | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/smart-hut/src/components/dashboard/devices/SmartPlug.js b/smart-hut/src/components/dashboard/devices/SmartPlug.js index 41b9be5..f5d3513 100644 --- a/smart-hut/src/components/dashboard/devices/SmartPlug.js +++ b/smart-hut/src/components/dashboard/devices/SmartPlug.js @@ -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), }); } diff --git a/smart-hut/src/components/modalform.js b/smart-hut/src/components/modalform.js index 960ff2a..0c704f7 100644 --- a/smart-hut/src/components/modalform.js +++ b/smart-hut/src/components/modalform.js @@ -102,7 +102,6 @@ export default class ModalWindow extends Component { padding: "10px 10px", margin: "10px 0px", }; - console.log(this.state, this.idRoom); return (
diff --git a/smart-hut/src/views/Dashboard.js b/smart-hut/src/views/Dashboard.js index 144f089..2f75f32 100644 --- a/smart-hut/src/views/Dashboard.js +++ b/smart-hut/src/views/Dashboard.js @@ -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) => { diff --git a/smart-hut/src/views/Navbar.js b/smart-hut/src/views/Navbar.js index 9e0f1f9..7a2ece7 100644 --- a/smart-hut/src/views/Navbar.js +++ b/smart-hut/src/views/Navbar.js @@ -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); };