feat: approval steps description
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -277,22 +277,62 @@ func main() (interface{}, error) {
|
||||
export const DENO_INIT_CODE_APPROVAL = `import * as wmill from "npm:windmill-client@^1.158.2"
|
||||
|
||||
export async function main(approver?: string) {
|
||||
return wmill.getResumeUrls(approver)
|
||||
const urls = await wmill.getResumeUrls(approver)
|
||||
// send the urls to their intended recipients
|
||||
|
||||
|
||||
// if the resumeUrls are part of the response, they will be available to any persons having access
|
||||
// to the run page and allowed to be approved from there, even from non owners of the flow
|
||||
// self-approval is disablable in the suspend options
|
||||
return {
|
||||
...urls,
|
||||
default_args: {},
|
||||
enums: {},
|
||||
description: undefined
|
||||
}
|
||||
}`
|
||||
|
||||
export const BUN_INIT_CODE_APPROVAL = `import * as wmill from "windmill-client@^1.158.2"
|
||||
|
||||
export async function main(approver?: string) {
|
||||
const urls = await wmill.getResumeUrls(approver)
|
||||
// send the urls to their intended recipients
|
||||
|
||||
|
||||
// if the resumeUrls are part of the response, they will be available to any persons having access
|
||||
// to the run page and allowed to be approved from there, even from non owners of the flow
|
||||
// self-approval is disablable in the suspend options
|
||||
return {
|
||||
...urls,
|
||||
default_args: {},
|
||||
enums: {},
|
||||
description: undefined
|
||||
// supports all formats from rich display rendering such as simple strings,
|
||||
// but also markdown, html, images, tables, maps, render_all, etc...
|
||||
// https://www.windmill.dev/docs/core_concepts/rich_display_rendering
|
||||
}
|
||||
}`
|
||||
|
||||
export const PYTHON_INIT_CODE_APPROVAL = `import wmill
|
||||
|
||||
def main():
|
||||
urls = wmill.get_resume_urls()
|
||||
return urls
|
||||
# send the urls to their intended recipients
|
||||
|
||||
# if the get_resume_urls are part of the response, they will be available to any persons having access
|
||||
# to the run page and allowed to be approved from there, even from non owners of the flow
|
||||
# self-approval is disablable in the suspend options
|
||||
return {
|
||||
**urls,
|
||||
"default_args": {},
|
||||
"enums": {},
|
||||
"description": None,
|
||||
# supports all formats from rich display rendering such as simple strings,
|
||||
# but also markdown, html, images, tables, maps, render_all, etc...
|
||||
# https://www.windmill.dev/docs/core_concepts/rich_display_rendering
|
||||
}
|
||||
`
|
||||
|
||||
export const BUN_INIT_CODE_APPROVAL = `import * as wmill from "windmill-client@^1.158.2"
|
||||
|
||||
export async function main(approver?: string) {
|
||||
return wmill.getResumeUrls(approver)
|
||||
}`
|
||||
|
||||
export const DOCKER_INIT_CODE = `# shellcheck shell=bash
|
||||
# Bash script that calls docker as a client to the host daemon
|
||||
# See documentation: https://www.windmill.dev/docs/advanced/docker
|
||||
|
||||
Reference in New Issue
Block a user