From b13984c85b5ec4eed3dd896e12e5f0e0879369e6 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 9 Jun 2023 14:05:41 +0200 Subject: [PATCH] fix: add cancel button to flowpreview --- .../(root)/(logged)/run/[...run]/+page.svelte | 126 +++++++++--------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte index f3f0d92191..e3b719bfd3 100644 --- a/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/run/[...run]/+page.svelte @@ -130,27 +130,27 @@ loading={!job} layout={[0.75, [2, 0, 2], 2.25, [{ h: 1.5, w: 40 }]]} /> - {#if job?.job_kind === 'script' || job?.job_kind === 'flow'} - - - {@const isScript = job?.job_kind === 'script'} - {@const runsHref = `/runs/${job?.script_path}${!isScript ? '?jobKind=flow' : ''}`} - {#if job && 'deleted' in job && !job?.deleted && ($superadmin || ($userStore?.is_admin ?? false))} - { - job?.id && deleteCompletedJob(job.id) - } + + + {@const isScript = job?.job_kind === 'script'} + {@const runsHref = `/runs/${job?.script_path}${!isScript ? '?jobKind=flow' : ''}`} + {#if job && 'deleted' in job && !job?.deleted && ($superadmin || ($userStore?.is_admin ?? false))} + { + job?.id && deleteCompletedJob(job.id) } - ]} - > - delete - + } + ]} + > + delete + + {#if job?.job_kind === 'script' || job?.job_kind === 'flow'} - {:else} - - {/if} + {/if} + + + {@const stem = `/${job?.job_kind}s`} + {@const isScript = job?.job_kind === 'script'} + {@const route = isScript ? job?.script_hash : job?.script_path} + {@const isRunning = job && 'running' in job && job.running} + {@const viewHref = `${stem}/get/${isScript ? job?.script_hash : job?.script_path}`} + {#if isRunning} + {#if !forceCancel} + + {:else} + {/if} + {/if} + {#if job?.job_kind === 'script' || job?.job_kind === 'flow'} + {/if} + {#if job?.job_kind === 'script' || job?.job_kind === 'flow'} {#if !$userStore?.operator} {#if canWrite(job?.script_path ?? '', {}, $userStore)} - - - {/if} + {/if} + +