feat: approval steps description

This commit is contained in:
Ruben Fiszel
2024-03-27 14:04:14 +01:00
parent 240ae93748
commit 810136a4a4
7 changed files with 93 additions and 21 deletions
@@ -34,6 +34,7 @@
export let jobId: string | undefined = undefined
export let workspaceId: string | undefined = undefined
export let hideAsJson: boolean = false
export let noControls: boolean = false
let resultKind:
| 'json'
@@ -288,7 +289,7 @@
</div>
<div class="text-tertiary text-xs flex gap-2 z-10 items-center">
<slot name="copilot-fix" />
{#if !disableExpand}
{#if !disableExpand && !noControls}
<button on:click={() => copyToClipboard(toJsonStr(result))}
><ClipboardCopy size={16} /></button
>
@@ -542,11 +543,13 @@
{/if}
{:else if typeof result == 'string' && result.length > 0}
<pre class="text-sm">{result}</pre>
<div class="flex">
<Button on:click={() => copyToClipboard(result)} color="light" size="xs">
<div class="flex gap-2 items-center">Copy <ClipboardCopy size={12} /> </div>
</Button>
</div>
{#if !noControls}
<div class="flex">
<Button on:click={() => copyToClipboard(result)} color="light" size="xs">
<div class="flex gap-2 items-center">Copy <ClipboardCopy size={12} /> </div>
</Button>
</div>
{/if}
{:else}
<Highlight
class={forceJson ? '' : 'h-full w-full'}
@@ -3,6 +3,7 @@
import { Job, JobService } from '$lib/gen'
import { workspaceStore } from '$lib/stores'
import { sendUserToast } from '$lib/toast'
import DisplayResult from './DisplayResult.svelte'
import LightweightSchemaForm from './LightweightSchemaForm.svelte'
import Tooltip from './Tooltip.svelte'
import { Button } from './common'
@@ -14,6 +15,7 @@
let default_payload: object = {}
let enum_payload: object = {}
let resumeUrl: string | undefined = undefined
let description: any = undefined
$: approvalStep = (job?.flow_status?.step ?? 1) - 1
@@ -35,6 +37,7 @@
id: jobId
})
const args = job_result?.default_args ?? {}
description = job_result?.description
defaultValues = JSON.parse(JSON.stringify(args))
default_payload = args
@@ -45,6 +48,9 @@
<div class="w-full h-full mt-2 text-sm text-tertiary">
<p>Waiting to be resumed</p>
{#if description != undefined}
<DisplayResult noControls result={description} />
{/if}
<div>
{#if isOwner || resumeUrl}
<div class="flex flex-row gap-2 mt-2">
@@ -221,6 +221,13 @@
</div>
{/if}
{#if flowModule.suspend?.resume_form}
<Toggle
bind:checked={flowModule.suspend.hide_cancel}
size="xs"
options={{
right: 'Hide cancel button on approval page'
}}
/>
<SchemaEditor bind:schema={flowModule.suspend.resume_form.schema} />
{/if}
</div>