From 2548c71913d244d9488c14a7fa2d00e97b6880e4 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 2 Dec 2026 16:04:09 +0100 Subject: [PATCH] feat: link schedule and native trigger runs to their trigger, with its icon Co-Authored-By: Claude Opus 5.5 --- backend/windmill-api/openapi.yaml | 1 + .../components/runs/JobDetailFieldConfig.ts | 52 +++++++------------ .../components/runs/JobDetailHeader.svelte | 33 ++++++------ .../src/lib/components/runs/RunDetail.svelte | 1 - 4 files changed, 36 insertions(+), 51 deletions(-) diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 7326f5fa8c..462c59ad3d 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -36582,6 +36582,7 @@ components: - sqs - gcp - azure + - nextcloud - google - github - asset diff --git a/frontend/src/lib/components/runs/JobDetailFieldConfig.ts b/frontend/src/lib/components/runs/JobDetailFieldConfig.ts index 4674f8e5ed..21c17afad9 100644 --- a/frontend/src/lib/components/runs/JobDetailFieldConfig.ts +++ b/frontend/src/lib/components/runs/JobDetailFieldConfig.ts @@ -6,7 +6,9 @@ import { agentRunHref } from '$lib/components/flows/conversations/agentEditorCha import { AUDIT_LOGS_PATH, TRIGGER_PAGES, - pageItemPageHref, + drawerHashFor, + pageItemListPath, + type PageItemRef, type TriggerKind } from '$lib/components/sessions/previewPaths' import { Calendar, Bot } from 'lucide-svelte' @@ -36,7 +38,6 @@ export type JobField = | 'run_id' | 'trigger_info' | 'parent_job' - | 'schedule_path' | 'script_hash' | 'script_path' | 'worker' @@ -162,20 +163,24 @@ export function getTriggerInfo(job: Job): { type: string; icon: any; detail?: st /** The page of the trigger or app that started the job, when it has one. */ export function getTriggerHref(job: Job, workspaceId: string): string | null { - const path = job.trigger_path - const kind = job.trigger_kind + const path = job.schedule_path || job.trigger_path + const kind = job.schedule_path ? 'schedule' : job.trigger_kind if (!path || !kind) return null const workspace = `workspace=${encodeURIComponent(job.workspace_id || workspaceId)}` if (kind === 'app') return `/apps/get/${path}?${workspace}` - if (kind in TRIGGER_PAGES) { - const [page, hash] = pageItemPageHref({ - kind: 'trigger', - triggerKind: kind as TriggerKind, - path - }).split('#') - return `${page}?${workspace}#${hash}` + // A native trigger run records the trigger's external id, which its page opens by hash. + if (kind === 'nextcloud' || kind === 'google' || kind === 'github') { + return `/native_triggers/${kind}?${workspace}#${encodeURIComponent(path)}` } - return null + const ref: PageItemRef | undefined = + kind === 'schedule' + ? { kind: 'schedule', path } + : kind in TRIGGER_PAGES + ? { kind: 'trigger', triggerKind: kind as TriggerKind, path } + : undefined + if (!ref) return null + const listPath = pageItemListPath(ref) + return `${listPath}?${workspace}#${drawerHashFor(listPath, path)}` } /** @@ -254,12 +259,6 @@ export const fieldConfigs: Record = { job.parent_job ? `/run/${job.parent_job}?workspace=${workspaceId}` : null }, - schedule_path: { - field: 'schedule_path', - label: 'Schedule', - getValue: (job) => job.schedule_path || null - }, - script_hash: { field: 'script_hash', label: 'Hash', @@ -393,7 +392,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { // Optional fields trigger_info: false, parent_job: false, - schedule_path: false, script_path: false, step_info: false, flow_status: false, @@ -416,7 +414,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { memory_peak: false, trigger_info: false, parent_job: false, - schedule_path: false, language: false, step_info: false, priority: false, @@ -437,7 +434,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { memory_peak: false, trigger_info: false, parent_job: false, - schedule_path: false, language: false, step_info: false, flow_status: false, @@ -458,7 +454,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { parent_job: true, // Optional fields trigger_info: false, - schedule_path: false, script_path: false, language: false, flow_status: false, @@ -479,7 +474,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { // Optional fields trigger_info: false, parent_job: false, - schedule_path: false, script_hash: false, script_path: false, language: false, @@ -501,7 +495,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { memory_peak: false, trigger_info: false, parent_job: false, - schedule_path: false, script_hash: false, script_path: false, language: false, @@ -519,7 +512,6 @@ export const categoryFieldPresence: FieldPresenceConfig = { run_id: true, started_at: true, parent_job: true, - schedule_path: true, trigger_info: true, // Optional fields memory_peak: false, @@ -563,7 +555,6 @@ export function getRelevantFields(job: Job): FieldConfig[] { 'flow_status', 'step_info', 'parent_job', - 'schedule_path', 'trigger_info', 'priority', 'concurrency_key' @@ -579,18 +570,13 @@ export function getRelevantFields(job: Job): FieldConfig[] { // Always show parent_job when it exists, regardless of category configuration return job.parent_job !== null && job.parent_job !== undefined } - if (fieldName === 'schedule_path') { - // Always show schedule_path when it exists, regardless of category configuration - return job.schedule_path !== null && job.schedule_path !== undefined - } if (fieldName === 'token') { return !!job.token_prefix } if (fieldName === 'trigger_info' && job.trigger_kind) { // A stamped trigger kind is how the run was started, whatever the category — but - // only one `getTriggerInfo` can name, or the row renders empty. A schedule is - // left out because its own field already says the same thing. - return !job.schedule_path && job.trigger_kind in triggerIconMap + // only one `getTriggerInfo` can name, or the row renders empty. + return job.trigger_kind in triggerIconMap } return fieldsPresence[fieldName] }) diff --git a/frontend/src/lib/components/runs/JobDetailHeader.svelte b/frontend/src/lib/components/runs/JobDetailHeader.svelte index 37a09815a0..5a10a2152c 100644 --- a/frontend/src/lib/components/runs/JobDetailHeader.svelte +++ b/frontend/src/lib/components/runs/JobDetailHeader.svelte @@ -10,7 +10,6 @@ import Popover from '$lib/components/meltComponents/Popover.svelte' import TextInput from '$lib/components/text_input/TextInput.svelte' import { sendUserToast } from '$lib/toast' - import ScheduleEditor from '$lib/components/triggers/schedules/ScheduleEditor.svelte' import TimeAgo from '$lib/components/TimeAgo.svelte' import { enterpriseLicense, userStore } from '$lib/stores' import Tooltip from '$lib/components/meltComponents/Tooltip.svelte' @@ -48,7 +47,6 @@ interface Props { job: Job - scheduleEditor?: ScheduleEditor displayPersistentScriptDefinition?: boolean openPersistentScriptDrawer?: () => void concurrencyKey?: string @@ -69,7 +67,6 @@ let { job, - scheduleEditor, displayPersistentScriptDefinition = false, openPersistentScriptDrawer, concurrencyKey, @@ -181,8 +178,6 @@ return isFlowVersionHash(job) ? fullValue.toString() : truncateHash(fullValue.toString()) case 'parent_job': return truncateRev(fullValue, 6) - case 'schedule_path': - return truncateRev(fullValue, 20) case 'memory_peak': // For memory, only show the display part (before the |) return fullValue.split('|')[0] || fullValue @@ -303,16 +298,6 @@ {#snippet text()}{tooltipMem}{/snippet} {displayMem} - {:else if config.field === 'schedule_path' && job.schedule_path} - - - {:else if config.field === 'parent_job' && job.parent_job} {#if job.is_flow_step} @@ -366,10 +351,24 @@ {:else if config.field === 'trigger_info'} {@const triggerInfoText = displayValue + (triggerInfo()?.detail ? `: ${triggerInfo()?.detail}` : '')} + {@const TriggerIcon = triggerInfo()?.icon} {#if href} - {triggerInfoText} + + {#if TriggerIcon}{/if} + {triggerInfoText} + + {:else} - {triggerInfoText} + + {#if TriggerIcon}{/if} + {triggerInfoText} + {/if} {:else if href} { persistentScriptDrawer?.open?.(persistentScriptDefinition)