From eab70dcd350c2228e042f3580c047b7690bf55f8 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 20 Jun 2023 11:59:13 +0200 Subject: [PATCH] feat: add schema form to approval steps --- backend/windmill-common/src/flows.rs | 2 ++ .../src/lib/components/DisplayResult.svelte | 12 ++------- .../lib/components/FlowStatusViewer.svelte | 19 +++++++++----- .../flows/content/FlowModuleSuspend.svelte | 26 +++++++++++++++++++ .../[job]/[resume]/[hmac]/+page.svelte | 16 +++++++----- openflow.openapi.yaml | 5 ++++ 6 files changed, 57 insertions(+), 23 deletions(-) diff --git a/backend/windmill-common/src/flows.rs b/backend/windmill-common/src/flows.rs index 82fb9ad637..5507adf5de 100644 --- a/backend/windmill-common/src/flows.rs +++ b/backend/windmill-common/src/flows.rs @@ -152,6 +152,8 @@ pub struct Suspend { pub required_events: Option, #[serde(skip_serializing_if = "Option::is_none")] pub timeout: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub resume_form: Option, } #[derive(Deserialize, Serialize, Debug, Clone)] diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index bd2ebd39b9..f1e062b7aa 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -4,7 +4,6 @@ import TableCustom from './TableCustom.svelte' import { copyToClipboard, truncate } from '$lib/utils' import { Button, Drawer, DrawerContent } from './common' - import autosize from 'svelte-autosize' import { ClipboardCopy } from 'lucide-svelte' import Portal from 'svelte-portal' import ObjectViewer from './propertyPicker/ObjectViewer.svelte' @@ -105,7 +104,6 @@ } return 'json' } - let payload = '' let jsonViewer: Drawer @@ -219,14 +217,14 @@ >
{result.error.stack ?? ''}
- {:else if !forceJson && resultKind == 'approval'}
+ {:else if !forceJson && resultKind == 'approval'}
-
-

Payload

-
- -
-
diff --git a/frontend/src/lib/components/FlowStatusViewer.svelte b/frontend/src/lib/components/FlowStatusViewer.svelte index 740c9acb50..f9a72418d5 100644 --- a/frontend/src/lib/components/FlowStatusViewer.svelte +++ b/frontend/src/lib/components/FlowStatusViewer.svelte @@ -16,8 +16,8 @@ import { displayDate, emptyString, isOwner, pluralize, truncateRev } from '$lib/utils' import JobArgs from './JobArgs.svelte' import Tooltip from './Tooltip.svelte' - import SimpleEditor from './SimpleEditor.svelte' import { Loader2 } from 'lucide-svelte' + import SchemaForm from './SchemaForm.svelte' const dispatch = createEventDispatcher() @@ -165,7 +165,7 @@ $: selected = isListJob ? 'sequence' : 'graph' - let payload: string = '"a test payload in json"' + let payload: any = {} function isSuccess(arg: any): boolean | undefined { if (arg == undefined) { @@ -248,9 +248,16 @@ >
-
- -
+ {#if job.raw_flow?.modules?.[job?.flow_status?.step - 1]?.suspend?.resume_form?.schema} +
+ +
+ {/if} The payload is optional, it is passed to the following step through the `resume` variable
-
+
{#if selectedNode} {@const node = localFlowModuleStates[selectedNode]} {#if selectedNode == 'end'} diff --git a/frontend/src/lib/components/flows/content/FlowModuleSuspend.svelte b/frontend/src/lib/components/flows/content/FlowModuleSuspend.svelte index bd2c7cd9a5..527897e2c9 100644 --- a/frontend/src/lib/components/flows/content/FlowModuleSuspend.svelte +++ b/frontend/src/lib/components/flows/content/FlowModuleSuspend.svelte @@ -1,8 +1,10 @@