devices list shows temp and humidity of attached plenum if it's there
This commit is contained in:
parent
ade15fdfdc
commit
4f1de384e4
3 changed files with 45 additions and 8 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -4549,7 +4549,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#0a0a2671905de63ec02ff13b4a060b2b7a895e37",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#86c8ea9c667b2d01c56e0af05f77c1326f8e08fa",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ export default function DeviceComponent() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
load()
|
load()
|
||||||
}, [])
|
}, [page, pageSize])
|
||||||
|
|
||||||
const columns = (): Column<convertedUnitMeasurement>[] => {
|
const columns = (): Column<convertedUnitMeasurement>[] => {
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { DeveloperBoard as ProvisionIcon, LibraryAdd as CreateGroupIcon } from "@mui/icons-material";
|
import { DeveloperBoard as ProvisionIcon, LibraryAdd as CreateGroupIcon } from "@mui/icons-material";
|
||||||
import { Box, Chip, CircularProgress, IconButton, Skeleton, Tab, Tabs, Theme, Tooltip, Typography } from "@mui/material";
|
import { Box, Chip, CircularProgress, Grid2, IconButton, Skeleton, Tab, Tabs, Theme, Tooltip, Typography } from "@mui/material";
|
||||||
import { blue, green } from "@mui/material/colors";
|
import { blue, green } from "@mui/material/colors";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
||||||
|
|
@ -18,6 +18,7 @@ import SmartBreadcrumb from "common/SmartBreadcrumb";
|
||||||
import GroupActions from "group/GroupActions";
|
import GroupActions from "group/GroupActions";
|
||||||
// import CircleGraphIcon from "common/CircleGraphIcon";
|
// import CircleGraphIcon from "common/CircleGraphIcon";
|
||||||
import DevicesSummary from "device/DevicesSummary";
|
import DevicesSummary from "device/DevicesSummary";
|
||||||
|
import MeasurementSummary from "component/MeasurementSummary";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return ({
|
return ({
|
||||||
|
|
@ -79,6 +80,7 @@ export default function Devices() {
|
||||||
const [isProvisionDialogOpen, setIsProvisionDialogOpen] = useState<boolean>(false);
|
const [isProvisionDialogOpen, setIsProvisionDialogOpen] = useState<boolean>(false);
|
||||||
const [stats, setStats] = useState<pond.DeviceStatistics>(pond.DeviceStatistics.create())
|
const [stats, setStats] = useState<pond.DeviceStatistics>(pond.DeviceStatistics.create())
|
||||||
const [loadingStats, setLoadingStats] = useState(false)
|
const [loadingStats, setLoadingStats] = useState(false)
|
||||||
|
const [hasPlenums, setHasPlenums] = useState(false)
|
||||||
|
|
||||||
const [groupsLoading, setGroupsLoading] = useState(false)
|
const [groupsLoading, setGroupsLoading] = useState(false)
|
||||||
const [groups, setGroups] = useState<Group[]>([]);
|
const [groups, setGroups] = useState<Group[]>([]);
|
||||||
|
|
@ -196,6 +198,10 @@ export default function Devices() {
|
||||||
).then(resp => {
|
).then(resp => {
|
||||||
let newDevices: Device[] = []
|
let newDevices: Device[] = []
|
||||||
resp.data.devices.forEach(device => {
|
resp.data.devices.forEach(device => {
|
||||||
|
console.log(device.status?.plenum?.temperature)
|
||||||
|
if (device.status?.plenum?.temperature) {
|
||||||
|
setHasPlenums(true)
|
||||||
|
}
|
||||||
newDevices.push(Device.create(device))
|
newDevices.push(Device.create(device))
|
||||||
})
|
})
|
||||||
setDevices(newDevices)
|
setDevices(newDevices)
|
||||||
|
|
@ -260,10 +266,10 @@ export default function Devices() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = (): Column<Device>[] => {
|
const columns = (): Column<Device>[] => {
|
||||||
return [
|
let columns = [
|
||||||
{
|
{
|
||||||
title: "State",
|
title: "State",
|
||||||
render: (device) => {
|
render: (device: Device) => {
|
||||||
const status = device.status ?? pond.DeviceStatus.create()
|
const status = device.status ?? pond.DeviceStatus.create()
|
||||||
const deviceStateHelper = getDeviceStateHelper(status.state);
|
const deviceStateHelper = getDeviceStateHelper(status.state);
|
||||||
return (
|
return (
|
||||||
|
|
@ -275,13 +281,13 @@ export default function Devices() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "ID",
|
title: "ID",
|
||||||
render: device => <span className={classes.cellContainer}>
|
render: (device: Device) => <span className={classes.cellContainer}>
|
||||||
{device.settings?.deviceId}
|
{device.settings?.deviceId}
|
||||||
</span>
|
</span>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Device",
|
title: "Device",
|
||||||
render: (device) => {
|
render: (device: Device) => {
|
||||||
return (
|
return (
|
||||||
<Box className={classes.cellContainer} >
|
<Box className={classes.cellContainer} >
|
||||||
<Chip
|
<Chip
|
||||||
|
|
@ -294,7 +300,7 @@ export default function Devices() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Description",
|
title: "Description",
|
||||||
render: device => {
|
render: (device: Device) => {
|
||||||
const description = device.settings?.description ?? ""
|
const description = device.settings?.description ?? ""
|
||||||
return (
|
return (
|
||||||
<Box className={classes.cellContainer}>
|
<Box className={classes.cellContainer}>
|
||||||
|
|
@ -310,6 +316,37 @@ export default function Devices() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
if (hasPlenums) {
|
||||||
|
columns.push({
|
||||||
|
title: "Plenum",
|
||||||
|
render: (device: Device) => {
|
||||||
|
if (device.status.plenum?.temperature) {
|
||||||
|
return (
|
||||||
|
<Grid2 container direction="column">
|
||||||
|
<Grid2>
|
||||||
|
<Typography>
|
||||||
|
{device.status.plenum.temperature}
|
||||||
|
</Typography>
|
||||||
|
</Grid2>
|
||||||
|
<Grid2>
|
||||||
|
<Typography>
|
||||||
|
{device.status.plenum.humidity}
|
||||||
|
</Typography>
|
||||||
|
</Grid2>
|
||||||
|
</Grid2>
|
||||||
|
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<Typography>
|
||||||
|
No Data
|
||||||
|
</Typography>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return columns
|
||||||
}
|
}
|
||||||
|
|
||||||
const provisionButton= () => {
|
const provisionButton= () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue