add completion criteria to navigation block as well (#1385)

This commit is contained in:
Shuchang Zheng
2024-12-13 08:13:53 -08:00
committed by GitHub
parent 2d1a53fed7
commit e61f6632c3
7 changed files with 60 additions and 0 deletions

View File

@@ -41,6 +41,8 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
cacheActions: data.cacheActions,
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
completeCriterion: data.completeCriterion,
terminateCriterion: data.terminateCriterion,
});
const deleteNodeCallback = useDeleteNodeCallback();
@@ -155,6 +157,20 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">
<div className="space-y-4">
<div className="space-y-2">
<Label className="text-xs text-slate-300">
Complete if...
</Label>
<WorkflowBlockInputTextarea
nodeId={id}
onChange={(value) => {
handleChange("completeCriterion", value);
}}
value={inputs.completeCriterion}
className="nopan text-xs"
/>
</div>
<Separator />
<div className="flex items-center justify-between">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">

View File

@@ -11,6 +11,8 @@ export type LoginNodeData = NodeBaseData & {
totpVerificationUrl: string | null;
totpIdentifier: string | null;
cacheActions: boolean;
completeCriterion: string;
terminateCriterion: string;
};
export type LoginNode = Node<LoginNodeData, "login">;
@@ -29,6 +31,8 @@ export const loginNodeDefaultData: LoginNodeData = {
totpIdentifier: null,
continueOnFailure: false,
cacheActions: false,
completeCriterion: "",
terminateCriterion: "",
} as const;
export function isLoginNode(node: Node): node is LoginNode {

View File

@@ -43,6 +43,8 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
downloadSuffix: data.downloadSuffix,
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
completeCriterion: data.completeCriterion,
terminateCriterion: data.terminateCriterion,
});
const deleteNodeCallback = useDeleteNodeCallback();
@@ -142,6 +144,20 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">
<div className="space-y-4">
<div className="space-y-2">
<Label className="text-xs text-slate-300">
Complete if...
</Label>
<WorkflowBlockInputTextarea
nodeId={id}
onChange={(value) => {
handleChange("completeCriterion", value);
}}
value={inputs.completeCriterion}
className="nopan text-xs"
/>
</div>
<Separator />
<div className="flex items-center justify-between">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">

View File

@@ -5,6 +5,8 @@ export type NavigationNodeData = NodeBaseData & {
url: string;
navigationGoal: string;
errorCodeMapping: string;
completeCriterion: string;
terminateCriterion: string;
maxRetries: number | null;
maxStepsOverride: number | null;
allowDownloads: boolean;
@@ -21,6 +23,8 @@ export const navigationNodeDefaultData: NavigationNodeData = {
label: "",
url: "",
navigationGoal: "",
completeCriterion: "",
terminateCriterion: "",
errorCodeMapping: "null",
maxRetries: null,
maxStepsOverride: null,

View File

@@ -247,6 +247,8 @@ function convertToNode(
totpVerificationUrl: block.totp_verification_url ?? null,
cacheActions: block.cache_actions,
maxStepsOverride: block.max_steps_per_run ?? null,
completeCriterion: block.complete_criterion ?? "",
terminateCriterion: block.terminate_criterion ?? "",
},
};
}
@@ -283,6 +285,8 @@ function convertToNode(
totpVerificationUrl: block.totp_verification_url ?? null,
cacheActions: block.cache_actions,
maxStepsOverride: block.max_steps_per_run ?? null,
completeCriterion: block.complete_criterion ?? "",
terminateCriterion: block.terminate_criterion ?? "",
},
};
}
@@ -879,6 +883,8 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
totp_identifier: node.data.totpIdentifier,
totp_verification_url: node.data.totpVerificationUrl,
cache_actions: node.data.cacheActions,
complete_criterion: node.data.completeCriterion,
terminate_criterion: node.data.terminateCriterion,
};
}
case "extraction": {
@@ -916,6 +922,8 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
totp_identifier: node.data.totpIdentifier,
totp_verification_url: node.data.totpVerificationUrl,
cache_actions: node.data.cacheActions,
complete_criterion: node.data.completeCriterion,
terminate_criterion: node.data.terminateCriterion,
};
}
case "wait": {
@@ -1491,6 +1499,8 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
cache_actions: block.cache_actions,
complete_criterion: block.complete_criterion,
terminate_criterion: block.terminate_criterion,
};
return blockYaml;
}
@@ -1523,6 +1533,8 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
cache_actions: block.cache_actions,
complete_criterion: block.complete_criterion,
terminate_criterion: block.terminate_criterion,
};
return blockYaml;
}

View File

@@ -255,6 +255,8 @@ export type NavigationBlock = WorkflowBlockBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
};
export type ExtractionBlock = WorkflowBlockBase & {
@@ -281,6 +283,8 @@ export type LoginBlock = WorkflowBlockBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
};
export type WaitBlock = WorkflowBlockBase & {

View File

@@ -167,6 +167,8 @@ export type NavigationBlockYAML = BlockYAMLBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
};
export type ExtractionBlockYAML = BlockYAMLBase & {
@@ -193,6 +195,8 @@ export type LoginBlockYAML = BlockYAMLBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
complete_criterion: string | null;
terminate_criterion: string | null;
};
export type WaitBlockYAML = BlockYAMLBase & {