Fixed Issues with Node Configuration Sidebar trying to use node label instead of "id"
This commit is contained in:
parent
51caa741cc
commit
9aff34e8de
@ -43,17 +43,19 @@ export default function FlowEditor({
|
|||||||
}) {
|
}) {
|
||||||
// Node Configuration Sidebar State
|
// Node Configuration Sidebar State
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
const [selectedNodeLabel, setSelectedNodeLabel] = useState(null);
|
const [selectedNodeId, setSelectedNodeId] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.BorealisOpenDrawer = (label) => {
|
window.BorealisOpenDrawer = (id) => {
|
||||||
setSelectedNodeLabel(label);
|
setSelectedNodeId(id);
|
||||||
setDrawerOpen(true);
|
setDrawerOpen(true);
|
||||||
};
|
};
|
||||||
return () => {
|
return () => {
|
||||||
delete window.BorealisOpenDrawer;
|
delete window.BorealisOpenDrawer;
|
||||||
};
|
};
|
||||||
}, [nodes]);
|
}, []);
|
||||||
|
|
||||||
|
const selectedNode = nodes.find((n) => n.id === selectedNodeId);
|
||||||
|
|
||||||
const wrapperRef = useRef(null);
|
const wrapperRef = useRef(null);
|
||||||
const { project } = useReactFlow();
|
const { project } = useReactFlow();
|
||||||
@ -352,7 +354,6 @@ export default function FlowEditor({
|
|||||||
if (nodeCountEl) nodeCountEl.innerText = nodes.length;
|
if (nodeCountEl) nodeCountEl.innerText = nodes.length;
|
||||||
}, [nodes]);
|
}, [nodes]);
|
||||||
|
|
||||||
const selectedNode = nodes.find((n) => n.data?.label === selectedNodeLabel);
|
|
||||||
const nodeDef = selectedNode
|
const nodeDef = selectedNode
|
||||||
? Object.values(categorizedNodes).flat().find((def) => def.type === selectedNode.type)
|
? Object.values(categorizedNodes).flat().find((def) => def.type === selectedNode.type)
|
||||||
: null;
|
: null;
|
||||||
@ -367,11 +368,12 @@ export default function FlowEditor({
|
|||||||
<NodeConfigurationSidebar
|
<NodeConfigurationSidebar
|
||||||
drawerOpen={drawerOpen}
|
drawerOpen={drawerOpen}
|
||||||
setDrawerOpen={setDrawerOpen}
|
setDrawerOpen={setDrawerOpen}
|
||||||
title={selectedNode?.data?.label || ""}
|
title={selectedNode ? selectedNode.data?.label || selectedNode.id : ""}
|
||||||
nodeData={
|
nodeData={
|
||||||
selectedNode && nodeDef
|
selectedNode && nodeDef
|
||||||
? {
|
? {
|
||||||
...nodeDef,
|
config: nodeDef.config,
|
||||||
|
usage_documentation: nodeDef.usage_documentation,
|
||||||
...selectedNode.data,
|
...selectedNode.data,
|
||||||
nodeId: selectedNode.id
|
nodeId: selectedNode.id
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ const DataNode = ({ id, data }) => {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
window.BorealisOpenDrawer &&
|
window.BorealisOpenDrawer &&
|
||||||
window.BorealisOpenDrawer(data?.label || "Unknown Node", { ...data, nodeId: id })
|
window.BorealisOpenDrawer(id, { ...data, nodeId: id })
|
||||||
}
|
}
|
||||||
sx={{ padding: 0, marginRight: "-3px", color: "#58a6ff", width: "20px", height: "20px" }}
|
sx={{ padding: 0, marginRight: "-3px", color: "#58a6ff", width: "20px", height: "20px" }}
|
||||||
>
|
>
|
||||||
@ -88,19 +88,14 @@ export default {
|
|||||||
{ key: "value", label: "Value", type: "text" }
|
{ key: "value", label: "Value", type: "text" }
|
||||||
],
|
],
|
||||||
usage_documentation: `
|
usage_documentation: `
|
||||||
### DataNode Usage
|
### Description:
|
||||||
|
This node acts as a basic live data emitter. When connected to an upstream node, it inherits its value, otherwise it accepts user-defined input of either a number or a string.
|
||||||
|
|
||||||
This node acts as a live data emitter. When connected to an upstream source, it inherits its value. Otherwise, it accepts user-defined input.
|
**Acceptable Inputs**:
|
||||||
|
- **Static Value** (*Number or String*)
|
||||||
|
|
||||||
- **Use Cases**:
|
**Behavior**:
|
||||||
- Static constants
|
- **Pass-through Conduit** (*If Upstream Node is Connected*) > Value cannot be manually changed while connected to an upstream node.
|
||||||
- Pass-through conduit
|
- Uses global Borealis "**Update Rate**" for updating value if connected to an upstream node.
|
||||||
- Manual value input
|
|
||||||
|
|
||||||
- **Behavior**:
|
|
||||||
- Automatically updates on interval
|
|
||||||
- Emits data through BorealisValueBus
|
|
||||||
|
|
||||||
Ensure no input edge if manual input is required.
|
|
||||||
`.trim()
|
`.trim()
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user