From 5ab54999c4ab6d2a56dfed1cacd0ffa325925276 Mon Sep 17 00:00:00 2001 From: Kerem Yilmaz Date: Mon, 9 Sep 2024 08:29:58 -0700 Subject: [PATCH] Add TOTP stuff to task node (#793) --- .../editor/nodes/TaskNode/TaskNode.tsx | 43 ++++++++++++++++++- .../workflows/editor/nodes/TaskNode/types.ts | 4 ++ .../workflows/editor/workflowEditorUtils.ts | 4 ++ .../routes/workflows/types/workflowTypes.ts | 2 + .../workflows/types/workflowYamlTypes.ts | 2 + 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx index 0cd5e7ce..784bbd73 100644 --- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx @@ -71,7 +71,7 @@ function TaskNode({ id, data }: NodeProps) { <> Content @@ -261,6 +261,47 @@ function TaskNode({ id, data }: NodeProps) { + + TOTP + +
+
+ + { + if (!editable) { + return; + } + updateNodeData(id, { + totpVerificationUrl: event.target.value, + }); + }} + value={data.totpVerificationUrl ?? ""} + placeholder="https://" + className="nopan" + /> +
+
+ + { + if (!editable) { + return; + } + updateNodeData(id, { totpIdentifier: event.target.value }); + }} + value={data.totpIdentifier ?? ""} + placeholder="Identifier" + className="nopan" + /> +
+
+
+
); diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts index 2c372e2b..81a510bc 100644 --- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts +++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts @@ -12,6 +12,8 @@ export type TaskNodeData = { editable: boolean; label: string; parameterKeys: Array; + totpVerificationUrl: string | null; + totpIdentifier: string | null; }; export type TaskNode = Node; @@ -30,4 +32,6 @@ export const taskNodeDefaultData: TaskNodeData = { editable: true, label: "", parameterKeys: [], + totpVerificationUrl: null, + totpIdentifier: null, } as const; diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts index b8111971..7924db58 100644 --- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts +++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts @@ -112,6 +112,8 @@ function convertToNode( maxRetries: block.max_retries ?? null, maxStepsOverride: block.max_steps_per_run ?? null, parameterKeys: block.parameters.map((p) => p.key), + totpIdentifier: block.totp_identifier ?? null, + totpVerificationUrl: block.totp_verification_url ?? null, }, }; } @@ -402,6 +404,8 @@ function getWorkflowBlock( max_steps_per_run: node.data.maxStepsOverride, complete_on_download: node.data.allowDownloads, parameter_keys: node.data.parameterKeys, + totp_identifier: node.data.totpIdentifier, + totp_verification_url: node.data.totpVerificationUrl, }; } case "sendEmail": { diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts index 1afb803f..001a529b 100644 --- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts +++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts @@ -134,6 +134,8 @@ export type TaskBlock = WorkflowBlockBase & { max_steps_per_run?: number | null; parameters: Array; complete_on_download?: boolean; + totp_verification_url?: string | null; + totp_identifier?: string | null; }; export type ForLoopBlock = WorkflowBlockBase & { diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts index b93c0f5f..ea6c873c 100644 --- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts +++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts @@ -79,6 +79,8 @@ export type TaskBlockYAML = BlockYAMLBase & { max_steps_per_run?: number | null; parameter_keys?: Array | null; complete_on_download?: boolean; + totp_verification_url?: string | null; + totp_identifier?: string | null; }; export type CodeBlockYAML = BlockYAMLBase & {