Merge branch 'master' into 3d_bin

This commit is contained in:
csawatzky 2026-05-19 14:02:05 -06:00
commit f72aeb802f
8 changed files with 50 additions and 40 deletions

2
package-lock.json generated
View file

@ -11663,7 +11663,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#0aa61453c8641cf5ede545949a5f2f89f6c393ec", "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#9c0f668d4a56b8216dd71a44c3110a818aaf3541",
"dependencies": { "dependencies": {
"protobufjs": "^6.8.8" "protobufjs": "^6.8.8"
} }

View file

@ -1159,7 +1159,7 @@ export default function BinVisualizer(props: Props) {
<BindaptIcon /> <BindaptIcon />
</Avatar> </Avatar>
<Box textAlign="center" width={"85%"}> <Box textAlign="center" width={"85%"}>
<Link href="https://www.bindapt.com/bins/">View Smart Bin Devices</Link> <Typography>No Plenums found</Typography>
</Box> </Box>
</Box> </Box>
)} )}

View file

@ -71,6 +71,7 @@ export default function DeviceScannedComponents(props: Props){
let valid: quack.AddressData[] = [] let valid: quack.AddressData[] = []
//filter the address data //filter the address data
let addr = scannedI2C?.settings?.foundAddresses let addr = scannedI2C?.settings?.foundAddresses
console.log(addr)
if(addr){ if(addr){
addr.forEach(addrData => { addr.forEach(addrData => {
if(!i2cBlacklistAddresses.includes(addrData.address)){ if(!i2cBlacklistAddresses.includes(addrData.address)){

View file

@ -20,6 +20,7 @@ interface Props {
ambient?: Component ambient?: Component
start: Moment; start: Moment;
end: Moment; end: Moment;
multiGraphZoom?: (domain: number[] | string[]) => void;
} }
export default function GateDeltaTempGraph(props: Props){ export default function GateDeltaTempGraph(props: Props){
@ -28,7 +29,8 @@ export default function GateDeltaTempGraph(props: Props){
ambient, ambient,
deviceID, deviceID,
start, start,
end end,
multiGraphZoom
} = props } = props
const [data, setData] = useState<SSAreaDataPoint[]>([]) const [data, setData] = useState<SSAreaDataPoint[]>([])
const [{user}] = useGlobalState() const [{user}] = useGlobalState()
@ -110,7 +112,6 @@ export default function GateDeltaTempGraph(props: Props){
end.toISOString(), end.toISOString(),
500 500
).then(resp => { ).then(resp => {
console.log(resp)
if(resp.data.measurements){ if(resp.data.measurements){
let tempCompMeasurements = resp.data.measurements.map(um => UnitMeasurement.any(um, user)); let tempCompMeasurements = resp.data.measurements.map(um => UnitMeasurement.any(um, user));
//if there is an ambient component, then treat the temp component like a single sensor and not a chain, and use the ambient measurements as the inlet //if there is an ambient component, then treat the temp component like a single sensor and not a chain, and use the ambient measurements as the inlet
@ -211,13 +212,14 @@ export default function GateDeltaTempGraph(props: Props){
/> />
<SingleSetAreaChart <SingleSetAreaChart
data={data} data={data}
minY={-40} //-40C is the same as -40F minY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? -40 : -20)}
maxY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? 104 : 40)} maxY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? 40 : 20)}
tooltipLabel="Delta Temp" tooltipLabel="Delta Temp"
tooltipUnit={user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C"} tooltipUnit={user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C"}
yAxisLabel={"Delta T" + (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C")} yAxisLabel={"Delta T" + (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C")}
colourAboveZero={{colour: warmingColour, label: "Heating"}} colourAboveZero={{colour: warmingColour, label: "Heating"}}
colourBelowZero={{colour: coolingColour, label: "Cooling"}}/> colourBelowZero={{colour: coolingColour, label: "Cooling"}}
multiGraphZoom={multiGraphZoom}/>
</Card> </Card>
) )

View file

@ -15,7 +15,7 @@ import { Gate } from "models/Gate";
import moment, { Moment } from "moment"; import moment, { Moment } from "moment";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
import { useGateAPI, useGlobalState } from "providers"; import { useGateAPI, useGlobalState } from "providers";
import React, { useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
interface Props { interface Props {
gate: Gate; gate: Gate;
@ -25,7 +25,6 @@ interface Props {
ambient?: string; ambient?: string;
newXDomain?: number[] | string[]; newXDomain?: number[] | string[];
pressureComponent?: string; pressureComponent?: string;
// setPCAState: (state: boolean) => void;
multiGraphZoom?: (domain: number[] | string[]) => void; multiGraphZoom?: (domain: number[] | string[]) => void;
} }
@ -55,7 +54,6 @@ export default function GateFlowGraph(props: Props) {
device, device,
ambient, ambient,
pressureComponent, pressureComponent,
// setPCAState,
start, start,
end, end,
newXDomain, newXDomain,
@ -75,11 +73,12 @@ export default function GateFlowGraph(props: Props) {
//const idleFlow = 3.5; //the mass air flow that must be crossed in order to start a flow event, anything below this will not start an event but must go below this to end an event //const idleFlow = 3.5; //the mass air flow that must be crossed in order to start a flow event, anything below this will not start an event but must go below this to end an event
const [idleFlow, setIdleFlow] = useState(3.5) const [idleFlow, setIdleFlow] = useState(3.5)
useEffect(() => { const loadData = useCallback(()=>{
if (loadingChartData) return; if (loadingChartData) return;
if (ambient && pressureComponent) { if (ambient && pressureComponent) {
let gateIdle = idleFlow let gateIdle = idleFlow
if(gate.settings.idleFlow){ if(gate.settings.idleFlow){
setIdleFlow(gate.settings.idleFlow)
gateIdle = gate.settings.idleFlow gateIdle = gate.settings.idleFlow
} }
@ -131,22 +130,17 @@ export default function GateFlowGraph(props: Props) {
} }
}); });
setRuntime(moment.duration(runtime)); setRuntime(moment.duration(runtime));
// let state = false;
// if (
// data.length > 1 &&
// data[data.length - 1].value > gate.lowerFlow() &&
// data[data.length - 1].value < gate.upperFlow()
// ) {
// state = true;
// }
// setPCAState(state);
} }
setFlowData(data); setFlowData(data);
setLoadingChartData(false); setLoadingChartData(false);
setRecent(recent); setRecent(recent);
}); });
} }
}, [gateAPI, gate, ambient, pressureComponent, start, end, device, as]); // eslint-disable-line react-hooks/exhaustive-deps },[gateAPI, gate, ambient, pressureComponent, start, end, device, as])
useEffect(() => {
loadData()
}, [loadData]); // eslint-disable-line react-hooks/exhaustive-deps
const loadFlowEvents = () => { const loadFlowEvents = () => {
if (ambient && pressureComponent) { if (ambient && pressureComponent) {

View file

@ -101,16 +101,22 @@ export default function GateGraphs(props: Props) {
}); });
}, [gate, endDate, gateAPI, startDate, as]); // eslint-disable-line react-hooks/exhaustive-deps }, [gate, endDate, gateAPI, startDate, as]); // eslint-disable-line react-hooks/exhaustive-deps
const updateDateRange = (newStartDate: any, newEndDate: any) => { const updateDateRange = (newStartDate: moment.Moment, newEndDate: moment.Moment) => {
let range = GetDefaultDateRange();
range.start = newStartDate;
range.end = newEndDate;
setStartDate(newStartDate); setStartDate(newStartDate);
setEndDate(newEndDate); setEndDate(newEndDate);
}; };
const zoomGraphs = (domain: string[] | number[]) => {
setZoomed(true)
if((domain[0] && !isNaN(parseInt(domain[0] as string))) && (domain[1] && !isNaN(parseInt(domain[1] as string)))){
updateDateRange(moment(domain[0]),moment(domain[1]))
}
}
const zoomOut = () => { const zoomOut = () => {
setXDomain(["dataMin", "dataMax"]); let d = GetDefaultDateRange()
setStartDate(d.start)
setEndDate(d.end)
setZoomed(false); setZoomed(false);
}; };
@ -175,8 +181,7 @@ export default function GateGraphs(props: Props) {
tooltip tooltip
newXDomain={xDomain} newXDomain={xDomain}
multiGraphZoom={domain => { multiGraphZoom={domain => {
setXDomain(domain); zoomGraphs(domain)
setZoomed(true);
}} }}
multiGraphZoomOut multiGraphZoomOut
/> />
@ -239,8 +244,7 @@ export default function GateGraphs(props: Props) {
tooltip tooltip
newXDomain={xDomain} newXDomain={xDomain}
multiGraphZoom={domain => { multiGraphZoom={domain => {
setXDomain(domain); zoomGraphs(domain)
setZoomed(true);
}} }}
multiGraphZoomOut multiGraphZoomOut
/> />
@ -250,7 +254,6 @@ 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 measurement = cloneDeep(comp.status.measurement)
let umArray = measurement.map(um => UnitMeasurement.create(um, user)) let umArray = measurement.map(um => UnitMeasurement.create(um, user))
return ( return (
@ -356,17 +359,22 @@ export default function GateGraphs(props: Props) {
gate={gate} gate={gate}
ambient={ambient} ambient={ambient}
pressureComponent={pressure} pressureComponent={pressure}
// setPCAState={(state: boolean) => {
// setPCAState(state);
// }}
multiGraphZoom={domain => { multiGraphZoom={domain => {
setXDomain(domain); zoomGraphs(domain)
setZoomed(true);
}} }}
/> />
{/* add a new chart here for the delta temp over time */} {/* add a new chart here for the delta temp over time */}
{tempComp && {tempComp &&
<GateDeltaTempGraph deviceID={device} start={startDate} end={endDate} tempComponent={tempComp} ambient={ambientComp}/> <GateDeltaTempGraph
deviceID={device}
start={startDate}
end={endDate}
tempComponent={tempComp}
ambient={ambientComp}
multiGraphZoom={domain => {
zoomGraphs(domain)
}}
/>
} }
</Box> </Box>
); );

View file

@ -272,7 +272,12 @@ export default function GateList(props: Props) {
// cellStyle: {width: 100000}, // cellStyle: {width: 100000},
// sortKey: "state", // sortKey: "state",
render: gate => { render: gate => {
const deviceStateHelper = getDeviceStateHelper(gate.status.pcaDeviceState); let deviceStateHelper = getDeviceStateHelper(pond.DeviceState.DEVICE_STATE_UNKNOWN);
if(moment().isAfter(moment(gate.status.deviceStateExpires).add(1, 'hour'))){
deviceStateHelper = getDeviceStateHelper(pond.DeviceState.DEVICE_STATE_MISSING)
}else{
deviceStateHelper = getDeviceStateHelper(gate.status.pcaDeviceState)
}
return ( return (
<Box className={classes.cellContainer}> <Box className={classes.cellContainer}>
<Tooltip title={deviceStateHelper.description}>{deviceStateHelper.icon}</Tooltip> <Tooltip title={deviceStateHelper.description}>{deviceStateHelper.icon}</Tooltip>

View file

@ -262,7 +262,7 @@ export default function NewObjectInteraction(props: Props){
const conditionGroup = (condition: pond.InteractionCondition, index: number) => { const conditionGroup = (condition: pond.InteractionCondition, index: number) => {
let measurementType = condition.measurementType; let measurementType = condition.measurementType;
let describer = describeMeasurement(measurementType, newAlertComponentType); let describer = describeMeasurement(measurementType, newAlertComponentType, undefined, undefined, user);
let isBoolean = condition.measurementType === Measurement.boolean; let isBoolean = condition.measurementType === Measurement.boolean;
return ( return (
<React.Fragment key={index}> <React.Fragment key={index}>