measurement table in component page works now but is not fully formatted
This commit is contained in:
parent
c62bfbf916
commit
ade15fdfdc
1 changed files with 35 additions and 13 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import { Box, Grid2 as Grid, Skeleton, Theme, Tooltip } from "@mui/material";
|
import { Box, Grid2 as Grid, Skeleton, Theme, Tooltip } from "@mui/material";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import { NextMeasurementChip } from "common/NextMeasurementChip";
|
import { NextMeasurementChip } from "common/NextMeasurementChip";
|
||||||
import ResponsiveTable from "common/ResponsiveTable";
|
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
||||||
// import { getTableIcons } from "common/ResponsiveTable";
|
// import { getTableIcons } from "common/ResponsiveTable";
|
||||||
import SmartBreadcrumb from "common/SmartBreadcrumb";
|
import SmartBreadcrumb from "common/SmartBreadcrumb";
|
||||||
import StatusChip from "common/StatusChip";
|
import StatusChip from "common/StatusChip";
|
||||||
|
|
@ -9,6 +9,7 @@ import { GetDefaultDateRange } from "common/time/DateRange";
|
||||||
import ComponentActions from "component/ComponentActions";
|
import ComponentActions from "component/ComponentActions";
|
||||||
import ComponentChart from "component/ComponentChart";
|
import ComponentChart from "component/ComponentChart";
|
||||||
import ComponentTypeChip from "component/ComponentTypeChip";
|
import ComponentTypeChip from "component/ComponentTypeChip";
|
||||||
|
import UnitMeasurementSummary from "component/UnitMeasurementSummary";
|
||||||
// import MeasurementSummary from "component/MeasurementSummary";
|
// import MeasurementSummary from "component/MeasurementSummary";
|
||||||
// import UnitMeasurementSummary from "component/UnitMeasurementSummary";
|
// import UnitMeasurementSummary from "component/UnitMeasurementSummary";
|
||||||
import {
|
import {
|
||||||
|
|
@ -141,18 +142,6 @@ export default function DeviceComponent() {
|
||||||
pond.DeviceComponentPreferences
|
pond.DeviceComponentPreferences
|
||||||
>();
|
>();
|
||||||
|
|
||||||
console.log("device component")
|
|
||||||
|
|
||||||
/*const getContextKeys = useCallback(() => {
|
|
||||||
if (groupID === undefined || groupID < 1) return undefined;
|
|
||||||
return [groupID.toString(), deviceID.toString()];
|
|
||||||
}, [groupID, deviceID]);
|
|
||||||
|
|
||||||
const getContextTypes = useCallback(() => {
|
|
||||||
if (groupID === undefined || groupID < 1) return undefined;
|
|
||||||
return ["group", "device"];
|
|
||||||
}, [groupID]);*/
|
|
||||||
|
|
||||||
const setDefaultState = () => {
|
const setDefaultState = () => {
|
||||||
setDevice(Device.create());
|
setDevice(Device.create());
|
||||||
setGroup(undefined);
|
setGroup(undefined);
|
||||||
|
|
@ -468,6 +457,38 @@ export default function DeviceComponent() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const columns = (): Column<convertedUnitMeasurement>[] => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
title: "Timestamp",
|
||||||
|
render: row => {
|
||||||
|
return (
|
||||||
|
<Tooltip title={moment(row.timestamp).calendar()}>
|
||||||
|
<span>{moment(row.timestamp).fromNow()}</span>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Measurement",
|
||||||
|
render: row => {
|
||||||
|
return (
|
||||||
|
<UnitMeasurementSummary
|
||||||
|
component={component}
|
||||||
|
reading={row}
|
||||||
|
tableCell={true}
|
||||||
|
excludedNodes={deviceComponentPrefs?.excludedNodes}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
// const unitMeasurementsTable = () => {
|
// const unitMeasurementsTable = () => {
|
||||||
// interface Row {
|
// interface Row {
|
||||||
// timestamp: string;
|
// timestamp: string;
|
||||||
|
|
@ -580,6 +601,7 @@ export default function DeviceComponent() {
|
||||||
<Grid size={{ xs: 12 }} className={classes.verticalSpacing}>
|
<Grid size={{ xs: 12 }} className={classes.verticalSpacing}>
|
||||||
<ResponsiveTable
|
<ResponsiveTable
|
||||||
rows={rows}
|
rows={rows}
|
||||||
|
columns={columns()}
|
||||||
total={total}
|
total={total}
|
||||||
page={page}
|
page={page}
|
||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue