Add TOTP stuff to task node (#793)

This commit is contained in:
Kerem Yilmaz
2024-09-09 08:29:58 -07:00
committed by GitHub
parent eb659ec17f
commit 5ab54999c4
5 changed files with 54 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
<>
<Accordion
type="multiple"
defaultValue={["content", "extraction", "limits"]}
defaultValue={["content", "extraction", "limits", "totp"]}
>
<AccordionItem value="content">
<AccordionTrigger>Content</AccordionTrigger>
@@ -261,6 +261,47 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
</div>
</AccordionContent>
</AccordionItem>
<AccordionItem value="totp">
<AccordionTrigger>TOTP</AccordionTrigger>
<AccordionContent className="pl-[1.5rem] pr-1">
<div className="space-y-4">
<div className="space-y-1">
<Label className="text-xs text-slate-300">
TOTP Verification URL
</Label>
<AutoResizingTextarea
onChange={(event) => {
if (!editable) {
return;
}
updateNodeData(id, {
totpVerificationUrl: event.target.value,
});
}}
value={data.totpVerificationUrl ?? ""}
placeholder="https://"
className="nopan"
/>
</div>
<div className="space-y-1">
<Label className="text-xs text-slate-300">
TOTP Identifier
</Label>
<AutoResizingTextarea
onChange={(event) => {
if (!editable) {
return;
}
updateNodeData(id, { totpIdentifier: event.target.value });
}}
value={data.totpIdentifier ?? ""}
placeholder="Identifier"
className="nopan"
/>
</div>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>
</>
);

View File

@@ -12,6 +12,8 @@ export type TaskNodeData = {
editable: boolean;
label: string;
parameterKeys: Array<string>;
totpVerificationUrl: string | null;
totpIdentifier: string | null;
};
export type TaskNode = Node<TaskNodeData, "task">;
@@ -30,4 +32,6 @@ export const taskNodeDefaultData: TaskNodeData = {
editable: true,
label: "",
parameterKeys: [],
totpVerificationUrl: null,
totpIdentifier: null,
} as const;

View File

@@ -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": {

View File

@@ -134,6 +134,8 @@ export type TaskBlock = WorkflowBlockBase & {
max_steps_per_run?: number | null;
parameters: Array<WorkflowParameter>;
complete_on_download?: boolean;
totp_verification_url?: string | null;
totp_identifier?: string | null;
};
export type ForLoopBlock = WorkflowBlockBase & {

View File

@@ -79,6 +79,8 @@ export type TaskBlockYAML = BlockYAMLBase & {
max_steps_per_run?: number | null;
parameter_keys?: Array<string> | null;
complete_on_download?: boolean;
totp_verification_url?: string | null;
totp_identifier?: string | null;
};
export type CodeBlockYAML = BlockYAMLBase & {