fixing bug to make sure controller from other devices dont show as options for interactions when using the nodes on the bin svg
This commit is contained in:
parent
863f87da1c
commit
c7016be6cd
1 changed files with 12 additions and 8 deletions
|
|
@ -290,11 +290,7 @@ export default function BinVisualizer(props: Props) {
|
|||
const [modeChangeInProgress, setModeChangeInProgress] = useState(false)
|
||||
const [newGrainSettings, setNewGrainSettings] = useState<pond.GrainSettings>()
|
||||
|
||||
const componentAPI = useComponentAPI()
|
||||
const [openControllerDIalog, setOpenControllerDialog] = useState(false)
|
||||
const [controllerOutputStates, setControllerOutputStates] = useState<Map<string, number>>(new Map<string, number>())
|
||||
const [selectedController, setSelectedController] = useState<Component>()
|
||||
const [newOutputState, setNewOutputState] = useState()
|
||||
const [filteredComponents, setFilteredComponents] = useState<Component[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
setModeTime(moment(bin.status.lastModeChange));
|
||||
|
|
@ -1420,13 +1416,21 @@ export default function BinVisualizer(props: Props) {
|
|||
coldestNodeTemp={valueDisplay === "low" ? lowNodeConditions?.tempC : undefined}
|
||||
cableNodeClicked={(cable, fillNode) => {
|
||||
if (cable) {
|
||||
let devId = componentDevices?.get(cable.key());
|
||||
let devId = componentDevices.get(cable.key());
|
||||
if (devId) {
|
||||
let device = devMap.get(devId);
|
||||
if (device) {
|
||||
setSelectedCable(cable);
|
||||
setSelectedNode(fillNode);
|
||||
setCableDevice(device);
|
||||
//need to set the filtered components so that components on other devices do not show up as options in interaction settings
|
||||
let filtered: Component[] = []
|
||||
components.forEach((component, key) => {
|
||||
if(componentDevices.get(key) === devId){
|
||||
filtered.push(component)
|
||||
}
|
||||
})
|
||||
setFilteredComponents(filtered)
|
||||
setOpenNodeDialog(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1556,7 +1560,7 @@ export default function BinVisualizer(props: Props) {
|
|||
let device = componentDevices.get(fan.key)
|
||||
if(fanComp && device){
|
||||
return (
|
||||
<BinControllerDisplay key={fanComp.key()} component={fanComp} deviceID={device} currentState/>
|
||||
<BinControllerDisplay key={fanComp.key()} component={fanComp} deviceID={device} currentState={fan.state}/>
|
||||
)
|
||||
}
|
||||
})}
|
||||
|
|
@ -2075,7 +2079,7 @@ export default function BinVisualizer(props: Props) {
|
|||
{selectedCable && cableDevice && (
|
||||
<GrainNodeInteractions
|
||||
binKey={bin.key()}
|
||||
interactionComponents={Array.from(components.values())}
|
||||
interactionComponents={filteredComponents}
|
||||
grain={bin.grain()}
|
||||
cable={selectedCable}
|
||||
open={openNodeDialog}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue