From 0d7d2efde8b6bb00ba8d14ce341fe230d79fe9f2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 20 Jan 2024 15:25:49 +0100 Subject: [PATCH] fix: improve approval/prompt helpers --- .../src/lib/components/DisplayResult.svelte | 20 +-- .../src/lib/components/HighlightCode.svelte | 37 +++-- frontend/src/lib/components/Section.svelte | 2 +- .../content/FlowBranchesAllWrapper.svelte | 11 +- .../content/FlowBranchesOneWrapper.svelte | 10 +- .../flows/content/FlowInputs.svelte | 68 ++++++--- .../components/flows/content/FlowLoop.svelte | 22 ++- .../flows/content/FlowModuleSuspend.svelte | 77 ++++------ .../flows/content/SuspendDrawer.svelte | 144 ++++++++++++++++++ .../flows/map/InsertModuleButton.svelte | 2 +- frontend/src/lib/script_helpers.ts | 9 ++ 11 files changed, 300 insertions(+), 102 deletions(-) create mode 100644 frontend/src/lib/components/flows/content/SuspendDrawer.svelte diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index 0507f3efa1..dbcd35736b 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -204,15 +204,14 @@
{#if result != undefined && length != undefined && largeObject != undefined} {#if resultKind && !['json', 's3object', 's3object-list'].includes(resultKind)} -
as JSON 
- -
- {/if} - {#if typeof result == 'object' && Object.keys(result).length > 0} -
+
{/if}{#if typeof result == 'object' && Object.keys(result).length > 0}
{#if !disableExpand}
{/if}
- {/if} - {#if !forceJson && resultKind == 'table-col'} + >{/if}{#if !forceJson && resultKind == 'table-col'} {@const data = 'table-col' in result ? result['table-col'] : result} - {:else if !forceJson && resultKind == 'table-row'} {@const data = 'table-row' in result ? result['table-row'] : result} @@ -329,7 +325,7 @@
{result.error.stack ?? ''}
- {:else if !forceJson && resultKind == 'approval'}
+ {:else if !forceJson && resultKind == 'approval'}
+ {#if code?.length < 5000} + {#if !lines} + + {:else} + + + + {/if} + {:else} +
{code}
+ {/if} +
diff --git a/frontend/src/lib/components/Section.svelte b/frontend/src/lib/components/Section.svelte index daaaba4830..94f16cd7f8 100644 --- a/frontend/src/lib/components/Section.svelte +++ b/frontend/src/lib/components/Section.svelte @@ -13,7 +13,7 @@
-

+

{#if collapsable} + + + +
+
+ To add a form, go to the Form tab, inside the Advanced {'->'} Suspend tab, and add a form. + You can then get back the payloads using `resume` (single approver), or `resumes` (multiple approvers) + in the next step. Forms are an EE feature only. The approver list itself is fetchable using `approvers` +
+
+ A prompt is simply an approval step that can be self-approved. To do this, include the + resume url in the returned payload of the step. The UX will automatically adapt and show the + prompt to the operator when running the flow. e.g: + + TypeScript (Deno) + TypeScript (Bun) + Python + + + + + + + + + + + + + +
+
+ As one of the return key of this step, return an object `default_args` that contains the + default arguments of the form arguments. e.g: + +
+
+ As one of the return key of this step, return an object `enums` that contains the default + arguments of the form arguments. e.g: + +
+
+
+
diff --git a/frontend/src/lib/components/flows/map/InsertModuleButton.svelte b/frontend/src/lib/components/flows/map/InsertModuleButton.svelte index c91390081a..56cd8678b6 100644 --- a/frontend/src/lib/components/flows/map/InsertModuleButton.svelte +++ b/frontend/src/lib/components/flows/map/InsertModuleButton.svelte @@ -78,7 +78,7 @@ tabindex="-1" > - Approval + Approval/Prompt