Add download suffix to workflow editor (#817)

This commit is contained in:
Kerem Yilmaz
2024-09-12 00:59:01 -07:00
committed by GitHub
parent f16b6f3c8d
commit ed57878328
5 changed files with 25 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
maxRetries: data.maxRetries,
maxStepsOverride: data.maxStepsOverride,
allowDownloads: data.allowDownloads,
downloadSuffix: data.downloadSuffix,
errorCodeMapping: data.errorCodeMapping,
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
@@ -224,7 +225,7 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
}}
/>
</div>
<div className="flex justify-between">
<div className="flex items-center justify-between">
<Label className="text-xs font-normal text-slate-300">
Allow Downloads
</Label>
@@ -240,6 +241,23 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
/>
</div>
</div>
<div className="flex items-center justify-between">
<Label className="text-xs font-normal text-slate-300">
Download Suffix
</Label>
<Input
type="text"
placeholder="Suffix"
className="nopan w-44"
value={inputs.downloadSuffix ?? ""}
onChange={(event) => {
if (!editable) {
return;
}
handleChange("downloadSuffix", event.target.value);
}}
/>
</div>
<div className="space-y-2">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">

View File

@@ -9,6 +9,7 @@ export type TaskNodeData = {
maxRetries: number | null;
maxStepsOverride: number | null;
allowDownloads: boolean;
downloadSuffix: string | null;
editable: boolean;
label: string;
parameterKeys: Array<string>;
@@ -29,6 +30,7 @@ export const taskNodeDefaultData: TaskNodeData = {
maxRetries: null,
maxStepsOverride: null,
allowDownloads: false,
downloadSuffix: null,
editable: true,
label: "",
parameterKeys: [],

View File

@@ -111,6 +111,7 @@ function convertToNode(
dataSchema: JSON.stringify(block.data_schema, null, 2),
errorCodeMapping: JSON.stringify(block.error_code_mapping, null, 2),
allowDownloads: block.complete_on_download ?? false,
downloadSuffix: block.download_suffix ?? null,
maxRetries: block.max_retries ?? null,
maxStepsOverride: block.max_steps_per_run ?? null,
parameterKeys: block.parameters.map((p) => p.key),
@@ -451,6 +452,7 @@ function getWorkflowBlock(
max_retries: node.data.maxRetries ?? undefined,
max_steps_per_run: node.data.maxStepsOverride,
complete_on_download: node.data.allowDownloads,
download_suffix: node.data.downloadSuffix,
parameter_keys: node.data.parameterKeys,
totp_identifier: node.data.totpIdentifier,
totp_verification_url: node.data.totpVerificationUrl,

View File

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

View File

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