rename to next loop on failure (#4194)
This commit is contained in:
@@ -23,7 +23,7 @@ export const baseHelpTooltipContent = {
|
||||
"If you are running multiple workflows at once, you will need to give the block an identifier to know that this TOTP goes with this block.",
|
||||
continueOnFailure:
|
||||
"Allow the workflow to continue if it encounters a failure.",
|
||||
nextIterationOnFailure:
|
||||
nextLoopOnFailure:
|
||||
"When inside a for loop, continue to the next iteration if this block fails.",
|
||||
includeActionHistoryInVerification:
|
||||
"Include the action history in the completion verification.",
|
||||
@@ -74,7 +74,7 @@ export const helpTooltips = {
|
||||
...baseHelpTooltipContent,
|
||||
loopValue:
|
||||
"Define the values to iterate over. Use a parameter reference or natural language (e.g., 'Extract links of the top 2 posts'). Natural language automatically creates an extraction block that generates a list of string values. Use {{ current_value }} in the loop to get the current iteration value.",
|
||||
nextIterationOnFailure:
|
||||
nextLoopOnFailure:
|
||||
"When enabled, if any block inside the loop fails, the loop will immediately jump to the next iteration instead of stopping.",
|
||||
},
|
||||
sendEmail: {
|
||||
|
||||
@@ -255,15 +255,15 @@ function ActionNode({ id, data, type }: NodeProps<ActionNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
editable={editable}
|
||||
isInsideForLoop={isInsideForLoop}
|
||||
blockType="action"
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
/>
|
||||
<DisableCache
|
||||
|
||||
@@ -215,15 +215,15 @@ function ExtractionNode({ id, data, type }: NodeProps<ExtractionNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
editable={editable}
|
||||
isInsideForLoop={isInsideForLoop}
|
||||
blockType="extraction"
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
/>
|
||||
<DisableCache
|
||||
|
||||
@@ -285,15 +285,15 @@ function FileDownloadNode({ id, data }: NodeProps<FileDownloadNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
editable={editable}
|
||||
isInsideForLoop={isInsideForLoop}
|
||||
blockType="download"
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
/>
|
||||
<DisableCache
|
||||
|
||||
@@ -283,15 +283,15 @@ function LoginNode({ id, data, type }: NodeProps<LoginNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
editable={editable}
|
||||
isInsideForLoop={isInsideForLoop}
|
||||
blockType="login"
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
/>
|
||||
<DisableCache
|
||||
|
||||
@@ -162,11 +162,11 @@ function LoopNode({ id, data }: NodeProps<LoopNode>) {
|
||||
<div className="flex justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={data.nextIterationOnFailure ?? false}
|
||||
checked={data.nextLoopOnFailure ?? false}
|
||||
disabled={!data.editable}
|
||||
onCheckedChange={(checked) => {
|
||||
update({
|
||||
nextIterationOnFailure:
|
||||
nextLoopOnFailure:
|
||||
checked === "indeterminate" ? false : checked,
|
||||
});
|
||||
}}
|
||||
@@ -175,7 +175,7 @@ function LoopNode({ id, data }: NodeProps<LoopNode>) {
|
||||
Next Loop on Failure
|
||||
</Label>
|
||||
<HelpTooltip
|
||||
content={helpTooltips["loop"]["nextIterationOnFailure"]}
|
||||
content={helpTooltips["loop"]["nextLoopOnFailure"]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ export type LoopNodeData = NodeBaseData & {
|
||||
loopVariableReference: string;
|
||||
completeIfEmpty: boolean;
|
||||
continueOnFailure: boolean;
|
||||
nextIterationOnFailure?: boolean;
|
||||
nextLoopOnFailure?: boolean;
|
||||
};
|
||||
|
||||
export type LoopNode = Node<LoopNodeData, "loop">;
|
||||
@@ -20,7 +20,7 @@ export const loopNodeDefaultData: LoopNodeData = {
|
||||
loopVariableReference: "",
|
||||
completeIfEmpty: false,
|
||||
continueOnFailure: false,
|
||||
nextIterationOnFailure: false,
|
||||
nextLoopOnFailure: false,
|
||||
model: null,
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ function NavigationNode({ id, data, type }: NodeProps<NavigationNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
includeActionHistoryInVerification={
|
||||
data.includeActionHistoryInVerification
|
||||
}
|
||||
@@ -303,14 +303,14 @@ function NavigationNode({ id, data, type }: NodeProps<NavigationNode>) {
|
||||
blockType="navigation"
|
||||
showOptions={{
|
||||
continueOnFailure: true,
|
||||
nextIterationOnFailure: true,
|
||||
nextLoopOnFailure: true,
|
||||
includeActionHistoryInVerification: true,
|
||||
}}
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
onIncludeActionHistoryInVerificationChange={(checked) => {
|
||||
update({
|
||||
|
||||
@@ -310,7 +310,7 @@ function TaskNode({ id, data, type }: NodeProps<TaskNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
includeActionHistoryInVerification={
|
||||
data.includeActionHistoryInVerification
|
||||
}
|
||||
@@ -319,14 +319,14 @@ function TaskNode({ id, data, type }: NodeProps<TaskNode>) {
|
||||
blockType="task"
|
||||
showOptions={{
|
||||
continueOnFailure: true,
|
||||
nextIterationOnFailure: true,
|
||||
nextLoopOnFailure: true,
|
||||
includeActionHistoryInVerification: true,
|
||||
}}
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
onIncludeActionHistoryInVerificationChange={(checked) => {
|
||||
update({
|
||||
|
||||
@@ -218,15 +218,15 @@ function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
|
||||
</div>
|
||||
<BlockExecutionOptions
|
||||
continueOnFailure={data.continueOnFailure}
|
||||
nextIterationOnFailure={data.nextIterationOnFailure}
|
||||
nextLoopOnFailure={data.nextLoopOnFailure}
|
||||
editable={editable}
|
||||
isInsideForLoop={isInsideForLoop}
|
||||
blockType="validation"
|
||||
onContinueOnFailureChange={(checked) => {
|
||||
update({ continueOnFailure: checked });
|
||||
}}
|
||||
onNextIterationOnFailureChange={(checked) => {
|
||||
update({ nextIterationOnFailure: checked });
|
||||
onNextLoopOnFailureChange={(checked) => {
|
||||
update({ nextLoopOnFailure: checked });
|
||||
}}
|
||||
/>
|
||||
<DisableCache
|
||||
|
||||
@@ -6,39 +6,39 @@ import { helpTooltips } from "../../helpContent";
|
||||
|
||||
interface BlockExecutionOptionsProps {
|
||||
continueOnFailure: boolean;
|
||||
nextIterationOnFailure?: boolean;
|
||||
nextLoopOnFailure?: boolean;
|
||||
includeActionHistoryInVerification?: boolean;
|
||||
editable: boolean;
|
||||
isInsideForLoop: boolean;
|
||||
blockType: string;
|
||||
onContinueOnFailureChange: (checked: boolean) => void;
|
||||
onNextIterationOnFailureChange: (checked: boolean) => void;
|
||||
onNextLoopOnFailureChange: (checked: boolean) => void;
|
||||
onIncludeActionHistoryInVerificationChange?: (checked: boolean) => void;
|
||||
showOptions?: {
|
||||
continueOnFailure?: boolean;
|
||||
nextIterationOnFailure?: boolean;
|
||||
nextLoopOnFailure?: boolean;
|
||||
includeActionHistoryInVerification?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export function BlockExecutionOptions({
|
||||
continueOnFailure,
|
||||
nextIterationOnFailure = false,
|
||||
nextLoopOnFailure = false,
|
||||
includeActionHistoryInVerification = false,
|
||||
editable,
|
||||
isInsideForLoop,
|
||||
blockType,
|
||||
onContinueOnFailureChange,
|
||||
onNextIterationOnFailureChange,
|
||||
onNextLoopOnFailureChange,
|
||||
onIncludeActionHistoryInVerificationChange,
|
||||
showOptions = {
|
||||
continueOnFailure: true,
|
||||
nextIterationOnFailure: true,
|
||||
nextLoopOnFailure: true,
|
||||
includeActionHistoryInVerification: false,
|
||||
},
|
||||
}: BlockExecutionOptionsProps) {
|
||||
const showContinueOnFailure = showOptions.continueOnFailure ?? true;
|
||||
const showNextIterationOnFailure = showOptions.nextIterationOnFailure ?? true;
|
||||
const showNextLoopOnFailure = showOptions.nextLoopOnFailure ?? true;
|
||||
const showIncludeActionHistory =
|
||||
showOptions.includeActionHistoryInVerification ?? false;
|
||||
|
||||
@@ -101,7 +101,7 @@ export function BlockExecutionOptions({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{showNextIterationOnFailure && isInsideForLoop && (
|
||||
{showNextLoopOnFailure && isInsideForLoop && (
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex gap-2">
|
||||
<Label className="text-xs font-normal text-slate-300">
|
||||
@@ -110,19 +110,19 @@ export function BlockExecutionOptions({
|
||||
<HelpTooltip
|
||||
content={
|
||||
helpTooltips[blockType as keyof typeof helpTooltips]?.[
|
||||
"nextIterationOnFailure"
|
||||
] || helpTooltips["task"]["nextIterationOnFailure"]
|
||||
"nextLoopOnFailure"
|
||||
] || helpTooltips["task"]["nextLoopOnFailure"]
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="w-52">
|
||||
<Switch
|
||||
checked={nextIterationOnFailure}
|
||||
checked={nextLoopOnFailure}
|
||||
onCheckedChange={(checked) => {
|
||||
if (!editable) {
|
||||
return;
|
||||
}
|
||||
onNextIterationOnFailureChange(checked);
|
||||
onNextLoopOnFailureChange(checked);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ export type NodeBaseData = {
|
||||
debuggable: boolean;
|
||||
label: string;
|
||||
continueOnFailure: boolean;
|
||||
nextIterationOnFailure?: boolean;
|
||||
nextLoopOnFailure?: boolean;
|
||||
editable: boolean;
|
||||
model: WorkflowModel | null;
|
||||
showCode?: boolean;
|
||||
|
||||
@@ -223,7 +223,7 @@ function convertToNode(
|
||||
debuggable: debuggableWorkflowBlockTypes.has(block.block_type),
|
||||
label: block.label,
|
||||
continueOnFailure: block.continue_on_failure,
|
||||
nextIterationOnFailure: block.next_iteration_on_failure,
|
||||
nextLoopOnFailure: block.next_loop_on_failure,
|
||||
editable,
|
||||
model: block.model,
|
||||
};
|
||||
@@ -490,7 +490,7 @@ function convertToNode(
|
||||
loopValue: block.loop_over?.key ?? "",
|
||||
loopVariableReference: loopVariableReference,
|
||||
completeIfEmpty: block.complete_if_empty,
|
||||
nextIterationOnFailure: block.next_iteration_on_failure,
|
||||
nextLoopOnFailure: block.next_loop_on_failure,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
|
||||
const base = {
|
||||
label: node.data.label,
|
||||
continue_on_failure: node.data.continueOnFailure,
|
||||
next_iteration_on_failure: node.data.nextIterationOnFailure,
|
||||
next_loop_on_failure: node.data.nextLoopOnFailure,
|
||||
model: node.data.model,
|
||||
};
|
||||
switch (node.type) {
|
||||
@@ -1425,7 +1425,7 @@ function getOrderedChildrenBlocks(
|
||||
block_type: "for_loop",
|
||||
label: currentNode.data.label,
|
||||
continue_on_failure: currentNode.data.continueOnFailure,
|
||||
next_iteration_on_failure: currentNode.data.nextIterationOnFailure,
|
||||
next_loop_on_failure: currentNode.data.nextLoopOnFailure,
|
||||
loop_blocks: loopChildren,
|
||||
loop_variable_reference: currentNode.data.loopVariableReference,
|
||||
complete_if_empty: currentNode.data.completeIfEmpty,
|
||||
@@ -1456,7 +1456,7 @@ function getWorkflowBlocksUtil(
|
||||
block_type: "for_loop",
|
||||
label: node.data.label,
|
||||
continue_on_failure: node.data.continueOnFailure,
|
||||
next_iteration_on_failure: node.data.nextIterationOnFailure,
|
||||
next_loop_on_failure: node.data.nextLoopOnFailure,
|
||||
loop_blocks: getOrderedChildrenBlocks(nodes, edges, node.id),
|
||||
loop_variable_reference: node.data.loopVariableReference,
|
||||
complete_if_empty: node.data.completeIfEmpty,
|
||||
@@ -1957,7 +1957,7 @@ function convertBlocksToBlockYAML(
|
||||
const base = {
|
||||
label: block.label,
|
||||
continue_on_failure: block.continue_on_failure,
|
||||
next_iteration_on_failure: block.next_iteration_on_failure,
|
||||
next_loop_on_failure: block.next_loop_on_failure,
|
||||
next_block_label: block.next_block_label,
|
||||
};
|
||||
switch (block.block_type) {
|
||||
|
||||
@@ -287,7 +287,7 @@ export type WorkflowBlockBase = {
|
||||
block_type: WorkflowBlockType;
|
||||
output_parameter: OutputParameter;
|
||||
continue_on_failure: boolean;
|
||||
next_iteration_on_failure?: boolean;
|
||||
next_loop_on_failure?: boolean;
|
||||
model: WorkflowModel | null;
|
||||
next_block_label?: string | null;
|
||||
};
|
||||
|
||||
@@ -145,7 +145,7 @@ export type BlockYAMLBase = {
|
||||
block_type: WorkflowBlockType;
|
||||
label: string;
|
||||
continue_on_failure?: boolean;
|
||||
next_iteration_on_failure?: boolean;
|
||||
next_loop_on_failure?: boolean;
|
||||
next_block_label?: string | null;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user