mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-31 00:13:53 +00:00
add resume_id to job_resume + add identity module
This commit is contained in:
@@ -5,21 +5,44 @@
|
||||
import CenteredModal from '$lib/components/CenteredModal.svelte'
|
||||
import { sendUserToast } from '$lib/utils'
|
||||
import FlowMetadata from '$lib/components/FlowMetadata.svelte'
|
||||
import FlowViewer from '$lib/components/FlowViewer.svelte'
|
||||
import FlowModulesViewer from '$lib/components/FlowModulesViewer.svelte'
|
||||
import JobArgs from '$lib/components/JobArgs.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
let job: Job | undefined = undefined
|
||||
let currentApprovers: string[] = []
|
||||
let approver = $page.url.searchParams.get('approver') ?? undefined
|
||||
|
||||
let completed: boolean = false
|
||||
$: completed = job?.type == 'CompletedJob'
|
||||
|
||||
getJob()
|
||||
|
||||
onMount(() => {
|
||||
window.onunhandledrejection = (event: PromiseRejectionEvent) => {
|
||||
event.preventDefault()
|
||||
|
||||
if (event.reason?.message) {
|
||||
const { message, body, status } = event.reason
|
||||
|
||||
if (body) {
|
||||
sendUserToast(`${body}`, true)
|
||||
} else {
|
||||
sendUserToast(`${message}`, true)
|
||||
}
|
||||
} else {
|
||||
console.log('Caught unhandled promise rejection without message', event)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
async function getJob() {
|
||||
const suspendedJobFlow = await JobService.getSuspendedJobFlow({
|
||||
workspace: $page.params.workspace,
|
||||
id: $page.params.job,
|
||||
resumeId: new Number($page.params.resume).valueOf(),
|
||||
signature: $page.params.hmac,
|
||||
approver: $page.url.searchParams.get('approver') ?? undefined
|
||||
approver
|
||||
})
|
||||
job = suspendedJobFlow.job
|
||||
currentApprovers = suspendedJobFlow.approvers
|
||||
@@ -31,7 +54,7 @@
|
||||
id: $page.params.job,
|
||||
resumeId: new Number($page.params.resume).valueOf(),
|
||||
signature: $page.params.hmac,
|
||||
approver: $page.url.searchParams.get('approver') ?? undefined,
|
||||
approver,
|
||||
requestBody: {}
|
||||
})
|
||||
sendUserToast('Flow approved')
|
||||
@@ -44,7 +67,7 @@
|
||||
id: $page.params.job,
|
||||
resumeId: new Number($page.params.resume).valueOf(),
|
||||
signature: $page.params.hmac,
|
||||
approver: $page.url.searchParams.get('approver') ?? undefined,
|
||||
approver,
|
||||
requestBody: {}
|
||||
})
|
||||
sendUserToast('Flow disapproved!')
|
||||
@@ -53,21 +76,55 @@
|
||||
</script>
|
||||
|
||||
<div class="min-h-screen antialiased text-gray-900">
|
||||
<CenteredModal title="Approve flow?">
|
||||
<JobArgs {job} />
|
||||
<CenteredModal title="Approve resuming of flow?">
|
||||
<div class="flex flex-row justify-between flex-wrap sm:flex-nowrap gap-x-4">
|
||||
<div class="w-full">
|
||||
<h2 class="mt-4">Current approvers</h2>
|
||||
<div class="my-4">
|
||||
{#if currentApprovers.length > 0}
|
||||
{currentApprovers.join(', ')}
|
||||
{:else}
|
||||
<p class="text-sm"
|
||||
>No current approvers for this step (approval steps can require more than one
|
||||
approval)</p
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
{#if job && job.raw_flow}
|
||||
<FlowMetadata {job} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="mt-4">Flow arguments</h2>
|
||||
|
||||
{#if job && job.raw_flow}
|
||||
<FlowMetadata {job} />
|
||||
<FlowViewer flow={{ summary: '', value: job.raw_flow }} />
|
||||
<JobArgs {job} />
|
||||
<div class="mt-8">
|
||||
{#if approver}
|
||||
<p>Dis/approving as: <b>{approver}</b></p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if completed}
|
||||
<div class="my-2"><p><b>The flow is already completed</b></p></div>
|
||||
{/if}
|
||||
|
||||
<div class="w-max-md flex flex-row gap-x-4 gap-y-4 justify-between w-full flex-wrap">
|
||||
<Button btnClasses="grow" color="red" on:click|once={cancel} size="md"
|
||||
<div class="w-max-md flex flex-row gap-x-4 gap-y-4 justify-between w-full flex-wrap mt-2">
|
||||
<Button btnClasses="grow" color="red" on:click|once={cancel} size="md" disabled={completed}
|
||||
>Disapprove/Cancel</Button
|
||||
>
|
||||
<Button btnClasses="grow" on:click|once={resume} size="md">Approve/Resume</Button>
|
||||
<Button btnClasses="grow" on:click|once={resume} size="md" disabled={completed}
|
||||
>Approve/Resume</Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="mt-4"><a href="https://windmill.dev">Learn more about Windmill</a></div>
|
||||
{#if job && job.raw_flow}
|
||||
<h2 class="mt-10">Flow details</h2>
|
||||
<FlowModulesViewer
|
||||
modules={job.raw_flow?.modules}
|
||||
failureModule={job.raw_flow?.failure_module}
|
||||
/>
|
||||
{/if}
|
||||
</CenteredModal>
|
||||
</div>
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import FlowStatusViewer from '$lib/components/FlowStatusViewer.svelte'
|
||||
import TableCustom from '$lib/components/TableCustom.svelte'
|
||||
import ArgInfo from '$lib/components/ArgInfo.svelte'
|
||||
import HighlightCode from '$lib/components/HighlightCode.svelte'
|
||||
import TestJobLoader from '$lib/components/TestJobLoader.svelte'
|
||||
import LogViewer from '$lib/components/LogViewer.svelte'
|
||||
|
||||
Reference in New Issue
Block a user