merged in hotfixes and kept staging protobuf

This commit is contained in:
Carter 2026-01-19 10:53:24 -06:00
commit d7c9734c06
7 changed files with 47 additions and 43 deletions

View file

@ -263,32 +263,39 @@ export default function BinCard(props: Props) {
let val; let val;
let useEMC = false; let useEMC = false;
switch (valDisplay) { //taking the switch cases out so that the node always displays the average for the moisture/humidity
case "average": if (average?.emc) {
if (average?.emc) { useEMC = true;
useEMC = true; val = average.emc;
val = average.emc; } else {
} else { val = average?.humid;
val = average?.humid;
}
break;
case "low":
if (coldNode?.emc) {
useEMC = true;
val = coldNode.emc;
} else {
val = coldNode?.humid;
}
break;
case "high":
if (hotNode?.emc) {
useEMC = true;
val = hotNode.emc;
} else {
val = hotNode?.humid;
}
break;
} }
// switch (valDisplay) {
// case "average":
// if (average?.emc) {
// useEMC = true;
// val = average.emc;
// } else {
// val = average?.humid;
// }
// break;
// case "low":
// if (coldNode?.emc) {
// useEMC = true;
// val = coldNode.emc;
// } else {
// val = coldNode?.humid;
// }
// break;
// case "high":
// if (hotNode?.emc) {
// useEMC = true;
// val = hotNode.emc;
// } else {
// val = hotNode?.humid;
// }
// break;
// }
if (val !== undefined && !isNaN(val)) { if (val !== undefined && !isNaN(val)) {
display = val.toFixed(2); display = val.toFixed(2);
@ -334,7 +341,8 @@ export default function BinCard(props: Props) {
color="textSecondary" color="textSecondary"
noWrap noWrap
style={{ fontSize: "0.5rem" }}> style={{ fontSize: "0.5rem" }}>
{valDisplay === "high" ? "High" : valDisplay === "low" ? "Low" : "Average"} {/* {valDisplay === "high" ? "High" : valDisplay === "low" ? "Low" : "Average"} */}
Average
</Typography> </Typography>
</Box> </Box>
</Grid> </Grid>

View file

@ -21,6 +21,7 @@ import { pond } from "protobuf-ts/pond";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
import { useGlobalState } from "providers"; import { useGlobalState } from "providers";
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
interface TabPanelProps { interface TabPanelProps {
children?: React.ReactNode; children?: React.ReactNode;
@ -116,13 +117,7 @@ export default function DeviceLinkDrawer(props: Props) {
undefined, undefined,
undefined, undefined,
undefined, undefined,
true, true
undefined,
undefined,
undefined,
undefined,
undefined,
as
) )
.then(resp => { .then(resp => {
let devMap = new Map<string, pond.ComprehensiveDevice>(); let devMap = new Map<string, pond.ComprehensiveDevice>();

View file

@ -92,7 +92,7 @@ export default function GateDevice(props: Props) {
c.status.measurement[0].values[0] && c.status.measurement[0].values[0] &&
c.status.measurement[0].values[0].values[1] c.status.measurement[0].values[0].values[1]
) { ) {
setPCAFanOn(c.status.measurement[0].values[0].values[1] > 250); //apx 1 iwg setPCAFanOn(c.status.measurement[0].values[0].values[1] > 996); //apx 4 iwg
} }
break; break;
default: default:

View file

@ -27,6 +27,7 @@ import React, { useEffect, useState } from "react";
import { avg } from "utils"; import { avg } from "utils";
import GateFlowGraph from "./GateFlowGraph"; import GateFlowGraph from "./GateFlowGraph";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
import { cloneDeep } from "lodash";
interface Props { interface Props {
gate: Gate; gate: Gate;
@ -245,7 +246,9 @@ export default function GateGraphs(props: Props) {
const graphHeader = (comp: Component) => { const graphHeader = (comp: Component) => {
const componentIcon = GetComponentIcon(comp.settings.type, comp.settings.subtype, themeType); const componentIcon = GetComponentIcon(comp.settings.type, comp.settings.subtype, themeType);
console.log(comp)
let measurement = cloneDeep(comp.status.measurement)
let umArray = measurement.map(um => UnitMeasurement.create(um, user))
return ( return (
<CardHeader <CardHeader
avatar={ avatar={
@ -260,9 +263,7 @@ export default function GateGraphs(props: Props) {
subheader={ subheader={
<UnitMeasurementSummary <UnitMeasurementSummary
component={comp} component={comp}
reading={UnitMeasurement.convertLastMeasurement( reading={UnitMeasurement.convertLastMeasurement(umArray)}
comp.status.measurement.map(um => UnitMeasurement.create(um, user)) ?? []
)}
/> />
} }
/> />

View file

@ -109,7 +109,7 @@ export default function ObjectHeaterCard(props: Props) {
}); });
} }
} }
if (heaterData.devices[0]) { if (heaterData.devices && heaterData.devices[0]) {
setConnectedDevice(Device.any(heaterData.devices[0].device)); setConnectedDevice(Device.any(heaterData.devices[0].device));
heaterData.devices[0].components.forEach(c => { heaterData.devices[0].components.forEach(c => {
//loop through the components and assign them accordingly //loop through the components and assign them accordingly
@ -171,7 +171,7 @@ export default function ObjectHeaterCard(props: Props) {
const goToHeater = () => { const goToHeater = () => {
//history.push("/objectHeaters/" + heater.key); //history.push("/objectHeaters/" + heater.key);
let path = "/objectHeaters/" + heater.key; let path = "/heaters/" + heater.key;
navigate(path, { state: {heater: heater} }); navigate(path, { state: {heater: heater} });
}; };

View file

@ -131,7 +131,7 @@ export default function DevicePage() {
//flip operator and send negative comparitor to save //flip operator and send negative comparitor to save
interaction.settings.conditions.forEach(condition => { interaction.settings.conditions.forEach(condition => {
//coming back from the backend as a string for some reason //coming back from the backend as a string for some reason
if (condition.comparison.toString() === "RELATIONAL_OPERATOR_GREATER_THAN") { if (condition.comparison === quack.RelationalOperator.RELATIONAL_OPERATOR_GREATER_THAN) {
condition.comparison = quack.RelationalOperator.RELATIONAL_OPERATOR_LESS_THAN; condition.comparison = quack.RelationalOperator.RELATIONAL_OPERATOR_LESS_THAN;
} else { } else {
condition.comparison = quack.RelationalOperator.RELATIONAL_OPERATOR_GREATER_THAN; condition.comparison = quack.RelationalOperator.RELATIONAL_OPERATOR_GREATER_THAN;

View file

@ -56,8 +56,8 @@ export default function Site() {
siteAPI siteAPI
.getSitePage(siteKey, as) .getSitePage(siteKey, as)
.then(resp => { .then(resp => {
setSite(ISite.any(resp.data.site)); if(resp.data.site) setSite(ISite.any(resp.data.site));
setHeaters(resp.data.heaterData); if(resp.data.heaterData) setHeaters(resp.data.heaterData);
setLoadingSite(false); setLoadingSite(false);
}) })
.catch(err => { .catch(err => {