mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
feat: link schedule and native trigger runs to their trigger, with its icon
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
400f2b8d71
commit
2548c71913
@@ -36582,6 +36582,7 @@ components:
|
||||
- sqs
|
||||
- gcp
|
||||
- azure
|
||||
- nextcloud
|
||||
- google
|
||||
- github
|
||||
- asset
|
||||
|
||||
@@ -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<JobField, FieldConfig> = {
|
||||
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]
|
||||
})
|
||||
|
||||
@@ -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}
|
||||
<span>{displayMem}</span>
|
||||
</Tooltip>
|
||||
{:else if config.field === 'schedule_path' && job.schedule_path}
|
||||
<span class="whitespace-nowrap" title={fullValue}>
|
||||
<button
|
||||
onclick={() => scheduleEditor?.openEdit?.(job.schedule_path ?? '', job.job_kind == 'flow')}
|
||||
class="flex items-center gap-1 font-normal"
|
||||
>
|
||||
{displayValue}
|
||||
<ExternalLink size={12} class="flex-shrink-0" />
|
||||
</button>
|
||||
</span>
|
||||
{:else if config.field === 'parent_job' && job.parent_job}
|
||||
<span class="whitespace-nowrap flex items-center gap-1" title={fullValue}>
|
||||
{#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}
|
||||
<a {href} class="truncate text-primary" title={triggerInfoText}>{triggerInfoText}</a>
|
||||
<a
|
||||
{href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex items-center gap-1 min-w-0 text-primary"
|
||||
title={triggerInfoText}
|
||||
>
|
||||
{#if TriggerIcon}<TriggerIcon size={12} class="flex-shrink-0" />{/if}
|
||||
<span class="truncate flex-shrink min-w-0">{triggerInfoText}</span>
|
||||
<ExternalLink size={12} class="flex-shrink-0" />
|
||||
</a>
|
||||
{:else}
|
||||
<span title={triggerInfoText}>{triggerInfoText}</span>
|
||||
<span class="flex items-center gap-1 min-w-0" title={triggerInfoText}>
|
||||
{#if TriggerIcon}<TriggerIcon size={12} class="flex-shrink-0" />{/if}
|
||||
<span class="truncate">{triggerInfoText}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{:else if href}
|
||||
<a
|
||||
|
||||
@@ -1417,7 +1417,6 @@
|
||||
{#if job}
|
||||
<JobDetailHeader
|
||||
{job}
|
||||
{scheduleEditor}
|
||||
displayPersistentScriptDefinition={!!persistentScriptDefinition}
|
||||
openPersistentScriptDrawer={() => {
|
||||
persistentScriptDrawer?.open?.(persistentScriptDefinition)
|
||||
|
||||
Reference in New Issue
Block a user