diff --git a/frontend/src/lib/components/LogViewer.svelte b/frontend/src/lib/components/LogViewer.svelte
index 3edb923d4a..0fbed914a7 100644
--- a/frontend/src/lib/components/LogViewer.svelte
+++ b/frontend/src/lib/components/LogViewer.svelte
@@ -3,6 +3,7 @@
export let content: string | undefined
export let isLoading: boolean
+ export let duration: number | undefined = undefined
let scroll = true
let div: HTMLElement | null = null
@@ -43,6 +44,9 @@
+ {#if duration}
+ took {duration}ms
+ {/if}
{#if content}{content}{:else if isLoading}Waiting for job to start...{:else}No logs are available yet{/if}
diff --git a/frontend/src/lib/components/TestJobLoader.svelte b/frontend/src/lib/components/TestJobLoader.svelte
index 84e90366cc..37900f5b70 100644
--- a/frontend/src/lib/components/TestJobLoader.svelte
+++ b/frontend/src/lib/components/TestJobLoader.svelte
@@ -21,14 +21,15 @@
let intervalId: SetIntervalAsyncTimer | undefined = undefined
let syncIteration: number = 0
- let ITERATIONS_BEFORE_SLOW_REFRESH = 100
+ let ITERATIONS_BEFORE_SLOW_REFRESH = 10
+ let ITERATIONS_BEFORE_SUPER_SLOW_REFRESH = 100
export async function abstractRun(fn: () => Promise) {
try {
intervalId && clearIntervalAsync(intervalId)
if (isLoading && job) {
- JobService.cancelQueuedJob({
+ await JobService.cancelQueuedJob({
workspace: workspace!,
id: job.id,
requestBody: {}
@@ -91,11 +92,16 @@
}
export async function cancelJob() {
- await JobService.cancelQueuedJob({
- workspace: $workspaceStore ?? '',
- id: job?.id ?? '',
- requestBody: {}
- })
+ try {
+ await JobService.cancelQueuedJob({
+ workspace: $workspaceStore ?? '',
+ id: job?.id ?? '',
+ requestBody: {}
+ })
+ } catch (err) {
+ console.error(err)
+ }
+ isLoading = false
console.log('cancelled')
}
@@ -108,7 +114,7 @@
isLoading = true
intervalId = setIntervalAsync(async () => {
await syncer(testId)
- }, 500)
+ }, 50)
}
}
@@ -144,6 +150,7 @@
notfound = false
} catch (err) {
intervalId && clearIntervalAsync(intervalId)
+ isLoading = false
if (err.status === 404) {
notfound = true
}
@@ -154,6 +161,9 @@
async function syncer(id: string): Promise {
if (syncIteration == ITERATIONS_BEFORE_SLOW_REFRESH) {
+ intervalId && clearIntervalAsync(intervalId)
+ intervalId = setIntervalAsync(async () => await syncer(id), 500)
+ } else if (syncIteration == ITERATIONS_BEFORE_SUPER_SLOW_REFRESH) {
intervalId && clearIntervalAsync(intervalId)
intervalId = setIntervalAsync(async () => await syncer(id), 2000)
}
diff --git a/frontend/src/lib/components/scriptEditor/LogPanel.svelte b/frontend/src/lib/components/scriptEditor/LogPanel.svelte
index ca70095d1a..76560aae40 100644
--- a/frontend/src/lib/components/scriptEditor/LogPanel.svelte
+++ b/frontend/src/lib/components/scriptEditor/LogPanel.svelte
@@ -77,8 +77,12 @@
-->
{#if selectedTab === 'logs'}
-
-
+
+
{#if previewJob != undefined && 'result' in previewJob && previewJob.result != undefined}