Node Settings Panel
It displays the relevant settings interface based on the type of the node currently selected on the flow canvas.
Central Configuration Hub
This panel acts as a container and router for various specific node settings components (e.g., HttpRequestSettings
, JsonNodeSettings
, etc.), providing a unified place for all node configurations.
Features
Dynamic Content: Displays settings specific to the selected node's type.
Node Information Header: Shows the selected node's label (or a generated name from its type), ID, and type.
Execution Status: If the node has an execution result, it displays a badge indicating the status (e.g., Running, Executed, Error).
Theming: Adapts its appearance (background, borders) based on the current theme (dark/light).
Empty/Loading States:
- Shows a loading animation (
animate-pulse
) while initially mounting. - Displays a message "Select a node to edit its settings" if no node is currently selected.
- Shows "No settings available for this node." if the selected node type doesn't have a dedicated settings component.
- Shows a loading animation (
Component Structure
State and Hooks:
- Uses
useFlowStore
to getselectedNodeId
, allnodes
, andnodeResults
. - Uses
useTheme
fromnext-themes
to get the current theme for styling. useState
anduseEffect
formounted
state to prevent hydration mismatches, showing a loading state initially.useMemo
to efficiently find theselectedNode
object.
- Uses
Conditional Rendering:
- Loading State: If
!mounted
, an animated placeholder is rendered. - No Node Selected: If
!selectedNode
, a message prompts the user to select a node. Node-Specific Settings: A
switch
statement based onselectedNode.type
determines which specific settings component to render. Supported types include:httpRequest, jsonNode, selectFields, delayNode, variableSetNode, transformNode, conditionalNode, loop, exportNode
A default case handles unknown or settings-less node types.
- Loading State: If
Panel Layout:
- Main container:
<aside>
. Header (
<header>
): Contains node label/type, ID, and optional execution status badge (, , ).Content (
<section>
): Scrollable area for the dynamic settings component.
- Main container:
Styling
- Uses
cn
utility for conditional class naming, primarily for theming. - Background, border, and text colors adjust for dark/light modes (e.g.,
bg-[#0f172acc]
vsbg-white
). - Header and content sections have distinct styling and borders.
Key Functionalities
- Node Selection Logic: Reacts to
selectedNodeId
changes fromuseFlowStore
. - Dynamic Component Rendering: The
Panel
variable is assigned the correct settings component JSX based onselectedNode.type
. - Execution Result Display: Fetches and displays node execution status and results.
- Label Generation: Generates display names for nodes without custom labels (e.g.,
httpRequest
becomes "Http Request").
Imported Child Settings Components
The panel imports and utilizes components for specific node types. Refer to the component's source for the full list, including:
SelectFieldsSettings
HttpRequestSettings
JsonNodeSettings
- ...and others for delay, variable set, transform, conditional, loop, and export nodes.
Extensibility
When adding a new node type that requires settings, a corresponding settings component must be created and integrated into the switch
statement within the NodeSettingsPanel
. This ensures the new node's settings are accessible through the UI.
Efficient node management is key to building complex flows.