mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-08 08:02:27 +00:00
improve ob loader consistency
This commit is contained in:
@@ -472,9 +472,7 @@
|
||||
if (job?.type === 'CompletedJob') {
|
||||
isCompleted = true
|
||||
if (currentId === id) {
|
||||
await tick()
|
||||
callbacks?.done?.(job)
|
||||
currentId = undefined
|
||||
onJobCompleted(id, job, callbacks)
|
||||
}
|
||||
return isCompleted
|
||||
} else if (onlyResult || (job?.type === 'QueuedJob' && !currentEventSource)) {
|
||||
@@ -566,7 +564,6 @@
|
||||
const njob = previewJobUpdates.job as Job
|
||||
njob.logs = job?.logs ?? ''
|
||||
job = njob
|
||||
callbacks?.done?.(previewJobUpdates.job as Job)
|
||||
isCompleted = true
|
||||
onJobCompleted(id, job, callbacks)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { getScriptByPath } from '$lib/scripts'
|
||||
import { getContext } from 'svelte'
|
||||
import type { FlowEditorContext } from './flows/types'
|
||||
import JobLoader from './JobLoader.svelte'
|
||||
import JobLoader, { type Callbacks } from './JobLoader.svelte'
|
||||
import { getStepHistoryLoaderContext } from './stepHistoryLoader.svelte'
|
||||
|
||||
interface Props {
|
||||
@@ -53,9 +53,10 @@
|
||||
|
||||
const val = mod.value
|
||||
// let jobId: string | undefined = undefined
|
||||
let callbacks = {
|
||||
done(x) {
|
||||
jobDone()
|
||||
let callbacks: Callbacks = {
|
||||
done: (x) => {
|
||||
jobDone(x)
|
||||
console.log('testJob', x)
|
||||
}
|
||||
}
|
||||
if (val.type == 'rawscript') {
|
||||
@@ -90,8 +91,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function jobDone() {
|
||||
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob' && `result` in testJob) {
|
||||
function jobDone(testJob: Job & { result?: any }) {
|
||||
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob') {
|
||||
if ($flowStateStore[mod.id]) {
|
||||
$flowStateStore[mod.id].previewResult = testJob.result
|
||||
$flowStateStore[mod.id].previewSuccess = testJob.success
|
||||
|
||||
Reference in New Issue
Block a user