From 42e9af52d8040903208961ebd943b6201e9cc6b7 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 4 Nov 2022 21:48:38 +0100 Subject: [PATCH] script and flow details UX improvements --- frontend/src/lib/components/CronInput.svelte | 44 +++-- frontend/src/lib/components/JobArgs.svelte | 11 +- .../[job]/[resume]/[hmac]@none.svelte | 2 +- .../src/routes/flows/get/[...path].svelte | 71 ++++--- frontend/src/routes/run/[...run].svelte | 2 +- .../src/routes/scripts/get/[...hash].svelte | 182 +++++++++--------- 6 files changed, 157 insertions(+), 155 deletions(-) diff --git a/frontend/src/lib/components/CronInput.svelte b/frontend/src/lib/components/CronInput.svelte index 39599bc4ee..753d5bfa14 100644 --- a/frontend/src/lib/components/CronInput.svelte +++ b/frontend/src/lib/components/CronInput.svelte @@ -12,6 +12,7 @@ let preview: string[] = [] let cronError = '' export let schedule: string = '0 0 12 * *' + export let disabled = false let limit = 3 $: handleScheduleInput(schedule) @@ -44,28 +45,31 @@ id="cron-schedule" name="cron-schedule" bind:value={schedule} + {disabled} /> -
- - - -
+{#if !disabled} +
+ + + +
+{/if} {#if preview && preview.length > 0} diff --git a/frontend/src/lib/components/JobArgs.svelte b/frontend/src/lib/components/JobArgs.svelte index 93a06049d5..770f743887 100644 --- a/frontend/src/lib/components/JobArgs.svelte +++ b/frontend/src/lib/components/JobArgs.svelte @@ -1,26 +1,25 @@ - + Argument Value - {#if job && job.args && Object.keys(job.args).length > 0} - {#each Object.entries(job.args) as [arg, value]} + {#if args && Object.keys(args).length > 0} + {#each Object.entries(args) as [arg, value]} {arg} {/each} - {:else if job} + {:else if args} No arguments {:else} diff --git a/frontend/src/routes/approve/[workspace]/[job]/[resume]/[hmac]@none.svelte b/frontend/src/routes/approve/[workspace]/[job]/[resume]/[hmac]@none.svelte index 763e7c4abe..8c980b37f5 100644 --- a/frontend/src/routes/approve/[workspace]/[job]/[resume]/[hmac]@none.svelte +++ b/frontend/src/routes/approve/[workspace]/[job]/[resume]/[hmac]@none.svelte @@ -128,7 +128,7 @@

Flow arguments

- +
{#if approver}

Dis/approving as: {approver}

diff --git a/frontend/src/routes/flows/get/[...path].svelte b/frontend/src/routes/flows/get/[...path].svelte index 6a722cab37..f15ec04241 100644 --- a/frontend/src/routes/flows/get/[...path].svelte +++ b/frontend/src/routes/flows/get/[...path].svelte @@ -41,6 +41,9 @@ import ObjectViewer from '$lib/components/propertyPicker/ObjectViewer.svelte' import { Button, ActionRow, Skeleton, Badge } from '$lib/components/common' import UserSettings from '$lib/components/UserSettings.svelte' + import ArgInput from '$lib/components/ArgInput.svelte' + import JobArgs from '$lib/components/JobArgs.svelte' + import CronInput from '$lib/components/CronInput.svelte' let userSettings: UserSettings @@ -215,36 +218,6 @@
- {#if schedule} -
-

Primary Schedule

-
-

Enabled

- { - if (can_write) { - setScheduleEnabled(path, e.detail) - } else { - sendUserToast('not enough permission', true) - } - }} - /> -
-
-
-

Schedule

- {schedule.schedule} -
-
-

Args

- -
-
-
- {/if} {#if flow.archived} {/if}
-

Flow

+ + +

WebhookTo trigger this script with a webhook, do a POST request to the endpoint below. Flows are not public and can only be run by users with at least view rights on them. You will @@ -260,7 +236,7 @@ token or as query arg `?token=XXX`. See docs

@@ -284,10 +260,33 @@
-
-
-

Flow

- + {#if schedule} +
+

Primary Schedule
+ {schedule.schedule} + { + if (can_write) { + setScheduleEnabled(path, e.detail) + } else { + sendUserToast('not enough permission', true) + } + }} + /> + +

+
+ +
+
+ +
+
+ {/if}
{/if} diff --git a/frontend/src/routes/run/[...run].svelte b/frontend/src/routes/run/[...run].svelte index 3ceb3d69c5..6b3202dfb3 100644 --- a/frontend/src/routes/run/[...run].svelte +++ b/frontend/src/routes/run/[...run].svelte @@ -226,7 +226,7 @@
- + {#if job?.job_kind == 'flow' || job?.job_kind == 'flowpreview'}
diff --git a/frontend/src/routes/scripts/get/[...hash].svelte b/frontend/src/routes/scripts/get/[...hash].svelte index 3c243a88ff..de945d77f0 100644 --- a/frontend/src/routes/scripts/get/[...hash].svelte +++ b/frontend/src/routes/scripts/get/[...hash].svelte @@ -328,89 +328,6 @@ {/if} {/if} -
-
-

WebhooksTo trigger this script with a webhook, do a POST request to the endpoints below. - Scripts are not public and can only be run by users with at least view rights on them. - You will need to pass a bearer token to authentify as a user. You can either pass it as - a Bearer token or as query arg `?token=XXX`. See docs

- - {#if script} -
- - UUID - Result - - {#each Object.keys(webhooks) as key} - -
    - {#each Object.keys(webhooks[key]) as type} - {@const url = webhooks[key][type]} -
  • - - {url} - -
    - - {type} - - -
    -
  • - {/each} -
-
- -
-
- {/each} -
-
-
- {/if} -
-
-

Versions

- - {#if script} -
-

Current

-
- {script?.hash} -
-

Previous

- {#if script?.parent_hashes?.length} -
    - {#each script.parent_hashes as hash} -
  • - {hash} -
  • - {/each} -
- {:else} -

There are no previous versions

- {/if} -
- {/if} -
-

Arguments JSON schema @@ -433,16 +350,99 @@ {/if}

-
-

Dependencies lock file

- +
+
+
+

WebhooksTo trigger this script with a webhook, do a POST request to the endpoints below. Scripts + are not public and can only be run by users with at least view rights on them. You will + need to pass a bearer token to authentify as a user. You can either pass it as a Bearer + token or as query arg `?token=XXX`. See docs

+ {#if script} - {#if script?.lock} -
{script.lock}
- {:else} -

There is no lock file for this script

- {/if} +
+ + UUID + Result + + {#each Object.keys(webhooks) as key} + +
    + {#each Object.keys(webhooks[key]) as type} + {@const url = webhooks[key][type]} +
  • + + {url} + +
    + + {type} + + +
    +
  • + {/each} +
+
+ +
+
+ {/each} +
+
+
+ {/if} +
+
+

Versions

+ + {#if script} +
+

Current

+
+ {script?.hash} +
+

Previous

+ {#if script?.parent_hashes?.length} +
    + {#each script.parent_hashes as hash} +
  • + {hash} +
  • + {/each} +
+ {:else} +

There are no previous versions

+ {/if} +
{/if}
+
+

Dependencies lock file

+ + {#if script} + {#if script?.lock} +
{script.lock}
+ {:else} +

There is no lock file for this script

+ {/if} + {/if} +