diff --git a/client/main.jsx b/client/main.jsx
index a864387..897e9a1 100644
--- a/client/main.jsx
+++ b/client/main.jsx
@@ -29,7 +29,5 @@ Meteor.startup(() => {
Meteor.subscribe('activeDeviceCollection');
}
- Meteor.setTimeout(function() {
- ReactDOM.render(, document.getElementById('root'));
- }, 1250);
+ ReactDOM.render(, document.getElementById('root'));
});
\ No newline at end of file
diff --git a/imports/ui/Home.jsx b/imports/ui/Home.jsx
index 8595ea6..9d63f78 100644
--- a/imports/ui/Home.jsx
+++ b/imports/ui/Home.jsx
@@ -6,11 +6,11 @@ import {useTracker} from 'meteor/react-meteor-data';
import {Col, Form, Row} from "react-bootstrap";
-export default function Home() {
+export default function Home() {
const uniqueEspNames = _.uniq(SensorDataCollection.find({}, {
sort: {device_id: 1}, fields: {device_id: true}
- }).fetch().map(function(x) {
+ }).fetch().map(function (x) {
return x.device_id;
}), true);
@@ -19,18 +19,23 @@ export default function Home() {
});
const sensorData = useTracker(() => {
- return SensorDataCollection.find({ device_id: deviceName.deviceName }, { sort: { timestamp: -1 }, limit: 61 }).fetch().reverse();
+ return SensorDataCollection.find({device_id: deviceName.deviceName}, {
+ sort: {timestamp: -1},
+ limit: 61
+ }).fetch().reverse();
});
const handleChange = (e) => {
- if (e.target.value === "") {console.log("No device selected!");} else {
- var doc = ActiveDeviceCollection.findOne({ deviceName: deviceName.deviceName });
- ActiveDeviceCollection.update({ _id: doc._id }, {$set:{deviceName: e.target.value}});
+ if (e.target.value === "") {
+ console.log("No device selected!");
+ } else {
+ var doc = ActiveDeviceCollection.findOne({deviceName: deviceName.deviceName});
+ ActiveDeviceCollection.update({_id: doc._id}, {$set: {deviceName: e.target.value}});
}
}
- /*if (sensorData.length <= 0) {
+ if ((sensorData.length <= 0) || (deviceName.length <= 0) || (uniqueEspNames.length <= 0)) {
return (
@@ -41,85 +46,86 @@ export default function Home() {
)
- } else {}*/
- return (
- <>
-
-
- Devices:
-
-
-
-
-
-
-
- {uniqueEspNames.map((espName, index) =>{
- return
- })}
-
-
-
-
-
- active device: {deviceName.deviceName}
-
-
+ } else {
+ return (
+ <>
+
+
+ Devices:
+
+
+
+
+
+
+
+ {uniqueEspNames.map((espName, index) => {
+ return
+ })}
+
+
+
+
+
+ active device: {deviceName.deviceName}
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+ }
}
\ No newline at end of file