diff --git a/backend/windmill-api/src/oauth2.rs b/backend/windmill-api/src/oauth2.rs index ecae165b7f..8754a54159 100644 --- a/backend/windmill-api/src/oauth2.rs +++ b/backend/windmill-api/src/oauth2.rs @@ -710,7 +710,10 @@ async fn slack_command( .await?; tx.commit().await?; let url = base_url.0.to_owned(); - return Ok(format!("Job launched. See details at {url}/run/{uuid}")); + return Ok(format!( + "Job launched. See details at {url}/run/{uuid}?workspace={}", + &settings.workspace_id + )); } } diff --git a/frontend/src/lib/components/FlowMetadata.svelte b/frontend/src/lib/components/FlowMetadata.svelte index 0dfa58ac31..ea4a283d63 100644 --- a/frontend/src/lib/components/FlowMetadata.svelte +++ b/frontend/src/lib/components/FlowMetadata.svelte @@ -71,6 +71,6 @@
diff --git a/frontend/src/lib/components/RunChart.svelte b/frontend/src/lib/components/RunChart.svelte index 95d0cc82ec..a06a976186 100644 --- a/frontend/src/lib/components/RunChart.svelte +++ b/frontend/src/lib/components/RunChart.svelte @@ -16,6 +16,7 @@ } from 'chart.js' import type { CompletedJob } from '$lib/gen' import { createEventDispatcher } from 'svelte' + import { json } from 'svelte-highlight/languages' export let jobs: CompletedJob[] | undefined = [] @@ -43,13 +44,16 @@ // borderColor: 'rgba(99,0,125, .2)', backgroundColor: '#f87171', label: 'Failed', - data: failed?.map((job) => ({ x: job.created_at as any, y: job.duration_ms })) ?? [] + data: + failed?.map((job) => ({ x: job.created_at as any, y: job.duration_ms, id: job.id })) ?? [] }, { // borderColor: 'rgba(99,0,125, .2)', backgroundColor: '#4ade80', label: 'Successful', - data: success?.map((job) => ({ x: job.created_at as any, y: job.duration_ms })) ?? [] + data: + success?.map((job) => ({ x: job.created_at as any, y: job.duration_ms, id: job.id })) ?? + [] } ] } @@ -83,8 +87,24 @@ zoom: zoomOptions, legend: { display: false + }, + tooltip: { + callbacks: { + label: function (context) { + let label = context.dataset.label || 'X' + + if (label) { + label += ': ' + } + if (context.parsed.y !== null) { + label += JSON.stringify(context.parsed) + } + return label + } + } } }, + scales: { x: { grid: { diff --git a/frontend/src/lib/components/TestJobLoader.svelte b/frontend/src/lib/components/TestJobLoader.svelte index d62b9a157a..5cb330397c 100644 --- a/frontend/src/lib/components/TestJobLoader.svelte +++ b/frontend/src/lib/components/TestJobLoader.svelte @@ -11,7 +11,10 @@ export let isLoading = false export let job: Job | undefined = undefined + export let workspaceOverride: string | undefined = undefined + export let notfound = false + $: workspace = workspaceOverride ?? $workspaceStore let intervalId: NodeJS.Timer let syncIteration: number = 0 @@ -27,7 +30,7 @@ intervalId && clearInterval(intervalId) if (isLoading && job) { JobService.cancelQueuedJob({ - workspace: $workspaceStore!, + workspace: workspace!, id: job.id, requestBody: {} }) @@ -35,7 +38,7 @@ isLoading = true const testId = await JobService.runScriptPreview({ - workspace: $workspaceStore!, + workspace: workspace!, requestBody: { path, content: code, @@ -78,7 +81,7 @@ try { if (job && `running` in job) { let previewJobUpdates = await JobService.getJobUpdates({ - workspace: $workspaceStore!, + workspace: workspace!, id, running: job.running, logOffset: job.logs?.length ?? 0 @@ -88,21 +91,29 @@ job.logs = (job.logs ?? '').concat(previewJobUpdates.new_logs) } if ((previewJobUpdates.running ?? false) || (previewJobUpdates.completed ?? false)) { - job = await JobService.getJob({ workspace: $workspaceStore!, id }) + job = await JobService.getJob({ workspace: workspace!, id }) } } else { - job = await JobService.getJob({ workspace: $workspaceStore!, id }) + console.log(workspaceOverride) + console.log(workspace) + + job = await JobService.getJob({ workspace: workspace!, id }) } if (job?.type === 'CompletedJob') { //only CompletedJob has success property isCompleted = true - clearInterval(intervalId) + intervalId && clearInterval(intervalId) if (isLoading) { dispatch('done', job) isLoading = false } } + notfound = false } catch (err) { + intervalId && clearInterval(intervalId) + if (err.status === 404) { + notfound = true + } console.error(err) } return isCompleted diff --git a/frontend/src/lib/components/jobs/JobDetail.svelte b/frontend/src/lib/components/jobs/JobDetail.svelte index f2168639a2..ce3f092495 100644 --- a/frontend/src/lib/components/jobs/JobDetail.svelte +++ b/frontend/src/lib/components/jobs/JobDetail.svelte @@ -89,13 +89,15 @@Deleted
-The content of this run was deleted (by an admin, no less)
-Deleted
+The content of this run was deleted (by an admin, no less)
+