make cacheActions optional in DisableCache component; add disable cache toggle to Validation and V2Task blocks (#3722)
This commit is contained in:
@@ -12,7 +12,7 @@ function DisableCache({
|
|||||||
onCacheActionsChange,
|
onCacheActionsChange,
|
||||||
onDisableCacheChange,
|
onDisableCacheChange,
|
||||||
}: {
|
}: {
|
||||||
cacheActions: boolean;
|
cacheActions?: boolean;
|
||||||
disableCache: boolean;
|
disableCache: boolean;
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
// --
|
// --
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import { useRerender } from "@/hooks/useRerender";
|
|||||||
import { BlockCodeEditor } from "@/routes/workflows/components/BlockCodeEditor";
|
import { BlockCodeEditor } from "@/routes/workflows/components/BlockCodeEditor";
|
||||||
import { useBlockScriptStore } from "@/store/BlockScriptStore";
|
import { useBlockScriptStore } from "@/store/BlockScriptStore";
|
||||||
|
|
||||||
|
import { DisableCache } from "../DisableCache";
|
||||||
|
|
||||||
function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
|
function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
|
||||||
const { editable, label } = data;
|
const { editable, label } = data;
|
||||||
const { blockLabel: urlBlockLabel } = useParams();
|
const { blockLabel: urlBlockLabel } = useParams();
|
||||||
@@ -49,6 +51,7 @@ function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
|
|||||||
totpVerificationUrl: data.totpVerificationUrl,
|
totpVerificationUrl: data.totpVerificationUrl,
|
||||||
totpIdentifier: data.totpIdentifier,
|
totpIdentifier: data.totpIdentifier,
|
||||||
maxSteps: data.maxSteps,
|
maxSteps: data.maxSteps,
|
||||||
|
disableCache: data.disableCache,
|
||||||
model: data.model,
|
model: data.model,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -167,6 +170,18 @@ function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<Separator />
|
||||||
|
<DisableCache
|
||||||
|
disableCache={inputs.disableCache}
|
||||||
|
editable={editable}
|
||||||
|
onCacheActionsChange={(cacheActions) => {
|
||||||
|
handleChange("cacheActions", cacheActions);
|
||||||
|
}}
|
||||||
|
onDisableCacheChange={(disableCache) => {
|
||||||
|
handleChange("disableCache", disableCache);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Separator />
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Label className="text-xs text-slate-300">
|
<Label className="text-xs text-slate-300">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type Taskv2NodeData = NodeBaseData & {
|
|||||||
totpVerificationUrl: string | null;
|
totpVerificationUrl: string | null;
|
||||||
totpIdentifier: string | null;
|
totpIdentifier: string | null;
|
||||||
maxSteps: number | null;
|
maxSteps: number | null;
|
||||||
|
disableCache: boolean;
|
||||||
maxScreenshotScrolls: number | null;
|
maxScreenshotScrolls: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ export const taskv2NodeDefaultData: Taskv2NodeData = {
|
|||||||
totpIdentifier: null,
|
totpIdentifier: null,
|
||||||
totpVerificationUrl: null,
|
totpVerificationUrl: null,
|
||||||
maxSteps: MAX_STEPS_DEFAULT,
|
maxSteps: MAX_STEPS_DEFAULT,
|
||||||
|
disableCache: false,
|
||||||
model: null,
|
model: null,
|
||||||
maxScreenshotScrolls: null,
|
maxScreenshotScrolls: null,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ import { statusIsRunningOrQueued } from "@/routes/tasks/types";
|
|||||||
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
|
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
|
||||||
import { useRerender } from "@/hooks/useRerender";
|
import { useRerender } from "@/hooks/useRerender";
|
||||||
|
|
||||||
|
import { DisableCache } from "../DisableCache";
|
||||||
|
|
||||||
function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
|
function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
|
||||||
const { updateNodeData } = useReactFlow();
|
const { updateNodeData } = useReactFlow();
|
||||||
const [facing, setFacing] = useState<"front" | "back">("front");
|
const [facing, setFacing] = useState<"front" | "back">("front");
|
||||||
@@ -58,6 +60,7 @@ function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
|
|||||||
terminateCriterion: data.terminateCriterion,
|
terminateCriterion: data.terminateCriterion,
|
||||||
errorCodeMapping: data.errorCodeMapping,
|
errorCodeMapping: data.errorCodeMapping,
|
||||||
model: data.model,
|
model: data.model,
|
||||||
|
disableCache: data.disableCache,
|
||||||
});
|
});
|
||||||
|
|
||||||
const rerender = useRerender({ prefix: "accordian" });
|
const rerender = useRerender({ prefix: "accordian" });
|
||||||
@@ -243,6 +246,16 @@ function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<DisableCache
|
||||||
|
disableCache={inputs.disableCache}
|
||||||
|
editable={editable}
|
||||||
|
onCacheActionsChange={(cacheActions) => {
|
||||||
|
handleChange("cacheActions", cacheActions);
|
||||||
|
}}
|
||||||
|
onDisableCacheChange={(disableCache) => {
|
||||||
|
handleChange("disableCache", disableCache);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export type ValidationNodeData = NodeBaseData & {
|
|||||||
terminateCriterion: string;
|
terminateCriterion: string;
|
||||||
errorCodeMapping: string;
|
errorCodeMapping: string;
|
||||||
parameterKeys: Array<string>;
|
parameterKeys: Array<string>;
|
||||||
|
disableCache: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ValidationNode = Node<ValidationNodeData, "validation">;
|
export type ValidationNode = Node<ValidationNodeData, "validation">;
|
||||||
@@ -19,6 +20,7 @@ export const validationNodeDefaultData: ValidationNodeData = {
|
|||||||
continueOnFailure: false,
|
continueOnFailure: false,
|
||||||
editable: true,
|
editable: true,
|
||||||
parameterKeys: [],
|
parameterKeys: [],
|
||||||
|
disableCache: false,
|
||||||
model: null,
|
model: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ function convertToNode(
|
|||||||
prompt: block.prompt,
|
prompt: block.prompt,
|
||||||
url: block.url ?? "",
|
url: block.url ?? "",
|
||||||
maxSteps: block.max_steps,
|
maxSteps: block.max_steps,
|
||||||
|
disableCache: block.disable_cache ?? false,
|
||||||
totpIdentifier: block.totp_identifier,
|
totpIdentifier: block.totp_identifier,
|
||||||
totpVerificationUrl: block.totp_verification_url,
|
totpVerificationUrl: block.totp_verification_url,
|
||||||
maxScreenshotScrolls: null,
|
maxScreenshotScrolls: null,
|
||||||
@@ -281,6 +282,7 @@ function convertToNode(
|
|||||||
completeCriterion: block.complete_criterion ?? "",
|
completeCriterion: block.complete_criterion ?? "",
|
||||||
terminateCriterion: block.terminate_criterion ?? "",
|
terminateCriterion: block.terminate_criterion ?? "",
|
||||||
parameterKeys: block.parameters.map((p) => p.key),
|
parameterKeys: block.parameters.map((p) => p.key),
|
||||||
|
disableCache: block.disable_cache ?? false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ export type Taskv2Block = WorkflowBlockBase & {
|
|||||||
totp_verification_url: string | null;
|
totp_verification_url: string | null;
|
||||||
totp_identifier: string | null;
|
totp_identifier: string | null;
|
||||||
max_steps: number | null;
|
max_steps: number | null;
|
||||||
|
disable_cache: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ForLoopBlock = WorkflowBlockBase & {
|
export type ForLoopBlock = WorkflowBlockBase & {
|
||||||
@@ -391,6 +392,7 @@ export type ValidationBlock = WorkflowBlockBase & {
|
|||||||
terminate_criterion: string | null;
|
terminate_criterion: string | null;
|
||||||
error_code_mapping: Record<string, string> | null;
|
error_code_mapping: Record<string, string> | null;
|
||||||
parameters: Array<WorkflowParameter>;
|
parameters: Array<WorkflowParameter>;
|
||||||
|
disable_cache?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ActionBlock = WorkflowBlockBase & {
|
export type ActionBlock = WorkflowBlockBase & {
|
||||||
|
|||||||
Reference in New Issue
Block a user