fixed dropdown when no data for device
This commit is contained in:
parent
399ffeae83
commit
ac4cd8f0c3
@ -20,8 +20,9 @@ export default function Overview() {
|
|||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
return SensorDataCollection.find({device_id: activeDevice.deviceId}, {
|
return SensorDataCollection.find({device_id: activeDevice.deviceId}, {
|
||||||
sort: {timestamp: -1},
|
timestamp: { $gt: moment(Date.now()).subtract(1, 'days').toDate() },
|
||||||
limit: 1440
|
sort: { timestamp: -1 },
|
||||||
|
//limit: 1440
|
||||||
}).fetch().reverse();
|
}).fetch().reverse();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -41,6 +42,31 @@ export default function Overview() {
|
|||||||
|
|
||||||
if ((sensorData.length <= 0)) {
|
if ((sensorData.length <= 0)) {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<br></br>
|
||||||
|
<Row>
|
||||||
|
<Col xs lg="2">
|
||||||
|
<h4>Devices:</h4>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col xs lg="2">
|
||||||
|
<Form>
|
||||||
|
<Form.Group>
|
||||||
|
<Form.Control as="select" type="text" onChange={handleChange}>
|
||||||
|
<option></option>
|
||||||
|
{configuredDevices.map((devices, index) => {
|
||||||
|
return <option key={index} value={devices.deviceId}>{devices.alias}</option>
|
||||||
|
})}
|
||||||
|
</Form.Control>
|
||||||
|
</Form.Group>
|
||||||
|
</Form>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
|
<h6>active device: {!activeDevice === undefined && !ConfiguredDevicesCollection.findOne({ deviceId: activeDevice.deviceId }) === undefined ? ConfiguredDevicesCollection.findOne({ deviceId: activeDevice.deviceId }).alias : "No device selected"}</h6>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
<CardDeck>
|
<CardDeck>
|
||||||
<Card>
|
<Card>
|
||||||
<Card.Body>
|
<Card.Body>
|
||||||
@ -48,7 +74,8 @@ export default function Overview() {
|
|||||||
<Card.Text>Please wait...</Card.Text>
|
<Card.Text>Please wait...</Card.Text>
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
</Card>
|
</Card>
|
||||||
</CardDeck>
|
</CardDeck>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user