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 086551b..fac6ca3 100644
--- a/imports/ui/Home.jsx
+++ b/imports/ui/Home.jsx
@@ -3,6 +3,7 @@ import {CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XA
import SensorCardDeck from './SensorCardDeck'
import {SensorDataCollection, ActiveDeviceCollection} from "../../client/main";
import {useTracker} from 'meteor/react-meteor-data';
+
import {Col, Form, Row} from "react-bootstrap";
export default function Home() {
@@ -28,13 +29,25 @@ export default function Home() {
}
}
- return (
+
+ if (sensorData.length <= 0) {
+ return (
+
+
+
+ Loading!
+ Please wait...
+
+
+
+ )
+ } else {
+ return (
<>
Devices:
-
@@ -55,7 +68,6 @@ export default function Home() {
-
@@ -109,5 +121,5 @@ export default function Home() {
>
- )
+ )}
}
\ No newline at end of file
diff --git a/imports/ui/SensorCardDeck.jsx b/imports/ui/SensorCardDeck.jsx
index 6c585ec..041a22b 100644
--- a/imports/ui/SensorCardDeck.jsx
+++ b/imports/ui/SensorCardDeck.jsx
@@ -11,33 +11,45 @@ export default function SensorCardDeck() {
const sensorData = useTracker(() => {
return SensorDataCollection.find({ device_id: deviceName.deviceName }, { sort: { timestamp: -1 }, limit: 1 }).fetch();
});
-
- return (
-
-
-
- Temperature
- {sensorData[0].temperature} °C
-
-
-
-
- Humidity
- {sensorData[0].humidity} %
-
-
-
-
- Brightness
- {sensorData[0].brightness} lux
-
-
-
-
- Moisture
- {sensorData[0].moisture} %
-
-
-
- )
+ if (sensorData.length <= 0) {
+ return (
+
+
+
+ Loading!
+ Please wait...
+
+
+
+ )
+ } else {
+ return (
+
+
+
+ Temperature
+ {sensorData[0].temperature} °C
+
+
+
+
+ Humidity
+ {sensorData[0].humidity} %
+
+
+
+
+ Brightness
+ {sensorData[0].brightness} lux
+
+
+
+
+ Moisture
+ {sensorData[0].moisture} %
+
+
+
+ )
+ }
}
\ No newline at end of file
diff --git a/package.json b/package.json
index afc917c..bceda08 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,8 @@
"name": "smart_garden_server",
"private": true,
"scripts": {
- "start": "meteor run",
+ "start": "MONGO_URL=mongodb://garden:99009911@cloud.timovolkmann.de:27017/Smart_Garden meteor run",
+ "plainstart": "meteor run",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"visualize": "meteor --production --extra-packages bundle-visualizer"