import React from 'react' import { SensorDataCollection, ActiveDeviceCollection, ConfiguredDevicesCollection, PlantTypesCollection } from "../../client/main"; import {useTracker} from 'meteor/react-meteor-data'; import { Card, CardDeck, Table } from "react-bootstrap"; export default function Overview() { const deviceId = useTracker(() => { return ActiveDeviceCollection.find().fetch()[0]; }); const sensorData = useTracker(() => { if (deviceId === null || deviceId === undefined) { return []; } else { return SensorDataCollection.find({device_id: deviceId.deviceId}, { sort: {timestamp: -1}, limit: 61 }).fetch().reverse(); } }); const configuredDevices = useTracker(() => { return ConfiguredDevicesCollection.find().fetch(); }); function getDirt(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.dirtType } if ((sensorData.length <= 0)) { return ( Loading! Please wait... ) } else { return ( <> {configuredDevices.map((device, index) => { return })}
# Device Name Plant Type Dirt Type
{index} {device.deviceId} {device.type} {getDirt(device.type)}


If your device is not visible, go to Settings to configure it first.

) } }