From 06df78c5fee505d92c084ccea895d0d154b54f63 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Fri, 1 Aug 2025 11:32:34 -0600 Subject: [PATCH] updated the node dialog on the bin page to allow for excluding nodes from there --- src/bin/BinSVGV2.tsx | 23 --------------- src/bin/GrainNodeInteractions.tsx | 47 +++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/src/bin/BinSVGV2.tsx b/src/bin/BinSVGV2.tsx index c183d24..2c7a888 100644 --- a/src/bin/BinSVGV2.tsx +++ b/src/bin/BinSVGV2.tsx @@ -431,8 +431,6 @@ export default function BinSVGV2(props: Props) { ); }; - //console.log(cables) - const cableGrainEstimate = ( points: GrainNodePoint[], cableSpacing: number, @@ -619,16 +617,6 @@ export default function BinSVGV2(props: Props) { if (!cable.excludedNodes.includes(nodeNumber - 1)){ if (cable.topNode > 0) { if (nodeNumber <= cable.topNode) { - // nodeHeatMap.push( - // - // ); nodeHeatMapData.push({ key: index, xCenter: cablePos, @@ -639,17 +627,6 @@ export default function BinSVGV2(props: Props) { }) } } else if (nodeY > filledToY) { - //otherwise use the fill level of the bin - // nodeHeatMap.push( - // - // ); nodeHeatMapData.push({ key: index, xCenter: cablePos, diff --git a/src/bin/GrainNodeInteractions.tsx b/src/bin/GrainNodeInteractions.tsx index 36af290..e34cfd1 100644 --- a/src/bin/GrainNodeInteractions.tsx +++ b/src/bin/GrainNodeInteractions.tsx @@ -91,6 +91,7 @@ export default function GrainNodeInteractions(props: Props) { const humDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_PERCENT); const moistureDescriber = describeMeasurement(quack.MeasurementType.MEASUREMENT_TYPE_GRAIN_EMC); const [topNode, setTopNode] = useState(false); + const [excluded, setExcluded] = useState(false); const componentAPI = useComponentAPI(); const interactionAPI = useInteractionsAPI(); const binAPI = useBinAPI(); @@ -131,6 +132,13 @@ export default function GrainNodeInteractions(props: Props) { } else { setTopNode(false); } + + //determine if the node is excluded + if (cable.excludedNodes.includes(displayNode - 1)){ + setExcluded(true) + }else{ + setExcluded(false) + } }, [cable, displayNode]); const goToComponent = () => { @@ -167,6 +175,7 @@ export default function GrainNodeInteractions(props: Props) { .then(resp => {}) .catch(err => {}); }); + updateComponentCallback(cable.key()) }) .catch(err => { openSnack("Failed to update component"); @@ -204,6 +213,15 @@ export default function GrainNodeInteractions(props: Props) { setTopNode(checked); }; + const updateNodeExclusion = (checked: boolean) => { + if (checked) { + cable.settings.excludedNodes.push(selectedNode-1) + } else { + cable.settings.excludedNodes.splice(cable.settings.excludedNodes.indexOf(selectedNode - 1), 1) + } + setExcluded(checked) + } + const displayTemp = () => { let tempFinal = nodeTemp ?? 0; if (user.settings.temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) { @@ -312,15 +330,38 @@ export default function GrainNodeInteractions(props: Props) { ); }; - const fillNodeSet = () => { + const nodeControl = () => { return ( - Top Node Control + Node Control + { + updateNodeExclusion(e.target.checked); + }} + name="excludedNode" + /> + } + label={ + + + Exclude Node + + + If checked this will set the node to be disabled and will not be used for any calculations done for the bin + + + } + /> { updateTopNode(e.target.checked); }} @@ -418,7 +459,7 @@ export default function GrainNodeInteractions(props: Props) { {latestReading()} - {fillNodeSet()} + {nodeControl()} {interactionDisplay()}