Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions dashboard/src/components/BlueprintFlow/FlowNodeRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ export default function FlowNodeRenderer({
? truncateDescription(node.description)
: node.description,
};
const isReadOnly =
isCompleteNode || (!onAdd && !onEdit && !onSwapBranch && !onDelete);
const isReadOnly = !onAdd && !onEdit && !onSwapBranch && !onDelete;
Comment thread
c3c43083 marked this conversation as resolved.
Resolved
const [contextMenu, setContextMenu] = useState<{
mouseX: number;
mouseY: number;
Expand Down Expand Up @@ -355,7 +354,7 @@ export default function FlowNodeRenderer({
<InfoNode node={infoNode} nodeStyle={nodeStyle}>
{!isReadOnly && (
<>
{!isLocked && (
{!isLocked && !isCompleteNode && (
<ActionButtonWrapper
className="anim-hover-shadow"
data-cy="node-delete-button"
Expand All @@ -367,7 +366,7 @@ export default function FlowNodeRenderer({
<Iconify icon="mdi:delete-outline" width={16} height={16} />
</ActionButtonWrapper>
)}
{onEdit && (
{onEdit && !isCompleteNode && (
<ActionButtonWrapper
className="anim-hover-shadow"
data-cy="node-edit-button"
Expand All @@ -383,7 +382,7 @@ export default function FlowNodeRenderer({
<Iconify icon="mdi:lightning-bolt" width={16} height={16} />
</ForceIndicatorWrapper>
)}
{canAddChild && (
{canAddChild && !isCompleteNode && (
<ActionButtonWrapper
className="anim-hover-shadow"
data-cy="node-add-button"
Expand All @@ -394,7 +393,7 @@ export default function FlowNodeRenderer({
<Iconify icon="mdi:plus" width={16} height={16} />
</ActionButtonWrapper>
)}
{onPin && canPin && (
{onPin && canPin && !isCompleteNode && (
<ActionButtonWrapper
className="anim-hover-shadow"
data-cy="node-pin-button"
Expand Down Expand Up @@ -423,7 +422,7 @@ export default function FlowNodeRenderer({
sx={{ zIndex: (theme) => theme.zIndex.modal + 3 }}
slotProps={{ paper: { sx: { minWidth: 180 } } }}
>
{canAddChild && (
{canAddChild && !isCompleteNode && (
<MenuItem
onClick={(e) => {
handleAddClick(e);
Expand All @@ -449,7 +448,7 @@ export default function FlowNodeRenderer({
<ListItemText>Edit node</ListItemText>
</MenuItem>
)}
{onToggleForce && !isLocked && (
{onToggleForce && !isLocked && !isCompleteNode && (
<MenuItem
onClick={(e) => {
handleToggleForceClick(e);
Expand Down
83 changes: 65 additions & 18 deletions dashboard/src/components/NodeEditor/NodeEditorDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const NodeEditorDrawer = ({
handoffTargetBlueprintId = "",
setHandoffTargetBlueprintId,
availableAgentBlueprints = [],
isCompleteNode = false,
}: {
parameters?: Record<string, unknown>;
onParametersChange?: (parameters: Record<string, unknown>) => void;
Expand Down Expand Up @@ -212,6 +213,7 @@ const NodeEditorDrawer = ({
handoffTargetBlueprintId?: string;
setHandoffTargetBlueprintId?: (id: string) => void;
availableAgentBlueprints?: Array<{ id: string; title: string }>;
isCompleteNode?: boolean;
}) => {
const theme = useTheme();
const [integrationPage, setIntegrationPage] = useState(1);
Expand Down Expand Up @@ -808,6 +810,43 @@ const NodeEditorDrawer = ({
</Stack>
);

const completeNodeFields = (
<Stack spacing={2}>
<TextField
label="Label"
variant="outlined"
fullWidth
value={newNodeLabel}
onChange={(e) => setNewNodeLabel(e.target.value)}
autoComplete="off"
inputProps={{
"data-cy": "node-label-input",
autoComplete: "off",
autoCorrect: "off",
spellCheck: false,
}}
sx={{ mt: 1 }}
/>

<TextField
label="Description"
variant="outlined"
fullWidth
multiline
minRows={2}
value={newNodeDescription}
onChange={(e) => setNewNodeDescription?.(e.target.value)}
Comment thread
c3c43083 marked this conversation as resolved.
Resolved
placeholder={descriptionPlaceholder}
autoComplete="off"
inputProps={{
autoComplete: "off",
autoCorrect: "off",
spellCheck: false,
}}
/>
</Stack>
);

const paramsFields = (
<Stack spacing={2}>
{usesIntegration && selectedIntegration?.id && onParametersChange ? (
Expand Down Expand Up @@ -879,26 +918,34 @@ const NodeEditorDrawer = ({
height: "100%",
}}
>
<Tabs
value={activeTab}
onChange={(_, value) => setActiveTab(value)}
sx={{ mb: 2, borderBottom: 1, borderColor: "divider" }}
>
<Tab label="Node" value="node" />
<Tab label="Details" value="details" />
<Tab label="Params" value="params" />
</Tabs>
{!isCompleteNode && (
<Tabs
value={activeTab}
onChange={(_, value) => setActiveTab(value)}
sx={{ mb: 2, borderBottom: 1, borderColor: "divider" }}
>
<Tab label="Node" value="node" />
<Tab label="Details" value="details" />
<Tab label="Params" value="params" />
</Tabs>
)}

<Box sx={{ flex: 1, overflowY: "auto" }}>
<Box sx={{ display: activeTab === "node" ? "block" : "none" }}>
{nodeFields}
</Box>
<Box sx={{ display: activeTab === "details" ? "block" : "none" }}>
{detailsFields}
</Box>
<Box sx={{ display: activeTab === "params" ? "block" : "none" }}>
{paramsFields}
</Box>
{isCompleteNode ? (
completeNodeFields
) : (
<>
<Box sx={{ display: activeTab === "node" ? "block" : "none" }}>
{nodeFields}
</Box>
<Box sx={{ display: activeTab === "details" ? "block" : "none" }}>
{detailsFields}
</Box>
<Box sx={{ display: activeTab === "params" ? "block" : "none" }}>
{paramsFields}
</Box>
</>
)}
</Box>

<Box
Expand Down
15 changes: 13 additions & 2 deletions dashboard/src/widgets/APITab/APITab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const INITIAL_NODE_EDITOR: NodeEditorState = {
parentNode: null,
editingNodeId: null,
label: "",
description: "",
instructions: "",
pseudocodeEnabled: true,
pseudocode: "",
Expand Down Expand Up @@ -507,6 +508,10 @@ function APITab({ agentId }: { agentId: string }) {
editMode: true,
editingNodeId: graphNode.id,
label: graphNode.label || "",
description:
graphNode.description ||
(graphNode.raw?.properties?.description as string) ||
"",
instructions: (graphNode.raw?.properties?.instructions as string) || "",
pseudocodeEnabled: true,
pseudocode: (graphNode.raw?.properties?.pseudocode as string) || "",
Expand Down Expand Up @@ -590,6 +595,7 @@ function APITab({ agentId }: { agentId: string }) {
editMode,
editingNodeId,
label,
description: newNodeDescription,
instructions,
pseudocodeEnabled,
pseudocode,
Expand All @@ -605,9 +611,10 @@ function APITab({ agentId }: { agentId: string }) {
? "PLATFORM:decision"
: nodeEditor.integration?.action;
const description =
nodeType === "CONDITION"
newNodeDescription.trim() ||
(nodeType === "CONDITION"
? "A decision node that branches the flow based on conditions."
: nodeEditor.integration?.description || "";
: nodeEditor.integration?.description || "");

const currentNodes = { ...flowGraphData.nodes };

Expand Down Expand Up @@ -764,6 +771,10 @@ function APITab({ agentId }: { agentId: string }) {
setNewNodeInstructions={(v: string) =>
setNodeEditor((p) => ({ ...p, instructions: v }))
}
newNodeDescription={nodeEditor.description}
setNewNodeDescription={(v: string) =>
setNodeEditor((p) => ({ ...p, description: v }))
}
newNodePseudocodeEnabled={nodeEditor.pseudocodeEnabled}
setNewNodePseudocodeEnabled={handlePseudocodeEnabledChange}
newNodeType={nodeEditor.nodeType}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/widgets/APITab/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type NodeEditorState = {
} | null;
editingNodeId: string | null;
label: string;
description: string;
instructions: string;
pseudocodeEnabled: boolean;
pseudocode: string;
Expand Down
6 changes: 6 additions & 0 deletions dashboard/src/widgets/NodeEditorWidget/NodeEditorWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,14 @@ const NodeEditorWidget = ({
])
);

const isCompleteNode =
editMode &&
(editingNode?.action || editingNode?.raw?.properties?.action) ===
"PLATFORM:complete";

return (
<NodeEditorDrawer
isCompleteNode={isCompleteNode}
parameters={parameters}
onParametersChange={onParametersChange}
pseudocode={pseudocode}
Expand Down
Loading