updated the api to use a new variable for whether to load all nodes, this will still use the show errors boolean for the component page

fixed issue in the filter function in the grain cable model that caused it to return empty when a top node was not set
updated the bin svg to have the disabled nodes greyed out
This commit is contained in:
csawatzky 2025-07-31 13:20:31 -06:00
parent 35e8996c29
commit 23223aa1a8
10 changed files with 134 additions and 109 deletions

View file

@ -87,54 +87,48 @@ export default function BinCard(props: Props) {
//loop through the cables in the bin status to prep for display
bin.status.grainCables.forEach(cable => {
let c: GrainCable = new GrainCable();
//flip the cables so that for display node 1 is at the bottom
//flip the cables so that for display node 1 is at the bottom,
let cableTemps = cloneDeep(cable.celcius);
let cableHums = cloneDeep(cable.relativeHumidity);
let cableEMC = cloneDeep(cable.moisture);
c.temperatures = cableTemps.reverse();
c.humidities = cableHums.reverse();
c.grainMoistures = cableEMC.reverse();
c.topNode = cable.topNode;
c.excludedNodes = cable.excludedNodes;
newGrainCables.push(c);
//determine the averages for temp/RH/EMC for the bin using all of the cables
let temps = cloneDeep(cable.celcius);
let hums = cloneDeep(cable.relativeHumidity);
let moistures = cloneDeep(cable.moisture);
const spliceEnd = cable.topNode > 0 ? cable.topNode : temps.length;
let grainTemps = temps.splice(0, spliceEnd);
let grainHums = hums.splice(0, spliceEnd);
let grainEMCs = moistures.splice(0, spliceEnd);
allTemps.push(...grainTemps);
allHums.push(...grainHums);
allMoistures.push(...grainEMCs);
//filter out the excluded nodes and any nodes above the top node
let filteredNodes = c.filteredNodes(true)
allTemps.push(...filteredNodes.temps);
allHums.push(...filteredNodes.humids);
allMoistures.push(...filteredNodes.moistures);
//set the hottest and coldest nodes
if (coldestNode === undefined || Math.min(...grainTemps) < coldestNode.temp) {
if (coldestNode === undefined || Math.min(...filteredNodes.temps) < coldestNode.temp) {
let lowTempIndex =
grainTemps.indexOf(Math.min(...grainTemps)) === -1
filteredNodes.temps.indexOf(Math.min(...filteredNodes.temps)) === -1
? 0
: grainTemps.indexOf(Math.min(...grainTemps));
: filteredNodes.temps.indexOf(Math.min(...filteredNodes.temps));
coldestNode = {
temp: grainTemps[lowTempIndex],
humid: grainHums[lowTempIndex],
emc: grainEMCs[lowTempIndex]
temp: filteredNodes.temps[lowTempIndex],
humid: filteredNodes.humids[lowTempIndex],
emc: filteredNodes.moistures[lowTempIndex]
};
}
if (hottestNode === undefined || Math.max(...grainTemps) > hottestNode.temp) {
if (hottestNode === undefined || Math.max(...filteredNodes.temps) > hottestNode.temp) {
let highTempIndex =
grainTemps.indexOf(Math.max(...grainTemps)) === -1
filteredNodes.temps.indexOf(Math.max(...filteredNodes.temps)) === -1
? 0
: grainTemps.indexOf(Math.max(...grainTemps));
: filteredNodes.temps.indexOf(Math.max(...filteredNodes.temps));
hottestNode = {
temp: grainTemps[highTempIndex],
humid: grainHums[highTempIndex],
emc: grainEMCs[highTempIndex]
temp: filteredNodes.temps[highTempIndex],
humid: filteredNodes.humids[highTempIndex],
emc: filteredNodes.moistures[highTempIndex]
};
}