mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
feat: link the runs list's trigger column to the trigger and filter by it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d7f032c795
commit
00f26d6b3b
@@ -6,6 +6,7 @@
|
||||
ScriptService,
|
||||
FlowService,
|
||||
type ExtendedJobs,
|
||||
type Job,
|
||||
OpenAPI
|
||||
} from '$lib/gen'
|
||||
|
||||
@@ -344,6 +345,7 @@
|
||||
delete filters.val.tag
|
||||
delete filters.val.worker
|
||||
delete filters.val.schedule_path
|
||||
delete filters.val.trigger_path
|
||||
// `!schedule` is the persisted "hide schedules" preference, not a row filter.
|
||||
if (filters.val.job_trigger_kind !== '!schedule') delete filters.val.job_trigger_kind
|
||||
setter(e.detail)
|
||||
@@ -359,6 +361,11 @@
|
||||
const filterBySchedule = resetAndFilterBy((s) => (filters.val.schedule_path = s))
|
||||
const filterByWorker = resetAndFilterBy((s) => (filters.val.worker = s))
|
||||
const filterByTriggerKind = resetAndFilterBy((s) => (filters.val.job_trigger_kind = s))
|
||||
// Two kinds can share a path, so the kind narrows it.
|
||||
const filterByTriggerPath = resetAndFilterBy((job: Job) => {
|
||||
filters.val.trigger_path = job.trigger_path ?? undefined
|
||||
filters.val.job_trigger_kind = job.trigger_kind ?? undefined
|
||||
})
|
||||
|
||||
function typeOfChart(s: string | null): 'RunChart' | 'ConcurrencyChart' {
|
||||
switch (s) {
|
||||
@@ -1307,6 +1314,7 @@
|
||||
on:filterBySchedule={filterBySchedule}
|
||||
on:filterByWorker={filterByWorker}
|
||||
on:filterByTriggerKind={filterByTriggerKind}
|
||||
on:filterByTriggerPath={filterByTriggerPath}
|
||||
columns={runsColumns}
|
||||
bind:this={runsTable}
|
||||
perPage={perPage.val}
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
import { Tooltip } from '../meltComponents'
|
||||
import RunLabels from './RunLabels.svelte'
|
||||
import type { RunsColumnId } from './runsColumns'
|
||||
import { triggerDisplayNamesMap } from '../triggers/utils'
|
||||
import { triggerDisplayNamesMap, triggerIconMap } from '../triggers/utils'
|
||||
import { getTriggerHref } from './JobDetailFieldConfig'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const hosted = useHostedPage()
|
||||
@@ -312,6 +313,8 @@
|
||||
{#if shown.has('trigger_kind')}
|
||||
<div class="flex flex-row gap-1 items-center min-w-0 pr-2">
|
||||
{#if job.trigger_kind}
|
||||
{@const KindIcon = triggerIconMap[job.trigger_kind]}
|
||||
{#if KindIcon}<KindIcon size={12} class="flex-shrink-0" />{/if}
|
||||
<span class="text-xs text-primary font-normal truncate">
|
||||
{triggerDisplayNamesMap[job.trigger_kind] ?? job.trigger_kind}
|
||||
</span>
|
||||
@@ -335,15 +338,44 @@
|
||||
{/if}
|
||||
|
||||
{#if shown.has('trigger_path')}
|
||||
<div class="min-w-0 pr-2">
|
||||
<div class="flex flex-row gap-1 items-center min-w-0 pr-2">
|
||||
{#if job.trigger_path}
|
||||
<div
|
||||
class="text-xs text-primary font-normal truncate text-left"
|
||||
dir="rtl"
|
||||
title={job.trigger_path}
|
||||
>
|
||||
{job.trigger_path}
|
||||
</div>
|
||||
{@const href = isExternal ? null : getTriggerHref(job, job.workspace_id ?? '')}
|
||||
{#if href}
|
||||
<a
|
||||
{href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex items-center gap-1 min-w-0 text-xs text-primary font-normal"
|
||||
title={job.trigger_path}
|
||||
>
|
||||
<span class="truncate" dir="rtl">{job.trigger_path}</span>
|
||||
<ExternalLink size={12} class="flex-shrink-0" />
|
||||
</a>
|
||||
{:else}
|
||||
<div
|
||||
class="text-xs text-primary font-normal truncate text-left"
|
||||
dir="rtl"
|
||||
title={job.trigger_path}
|
||||
>
|
||||
{job.trigger_path}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !isExternal}
|
||||
<DropdownV2
|
||||
items={[
|
||||
{
|
||||
displayName: `Filter by trigger: ${truncateRev(job.trigger_path, 20)}`,
|
||||
action: () => dispatch('filterByTriggerPath', job)
|
||||
}
|
||||
]}
|
||||
class="w-fit"
|
||||
>
|
||||
{#snippet buttonReplacement()}
|
||||
{@render filterButton()}
|
||||
{/snippet}
|
||||
</DropdownV2>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -580,6 +580,7 @@
|
||||
on:filterBySchedule
|
||||
on:filterByWorker
|
||||
on:filterByTriggerKind
|
||||
on:filterByTriggerPath
|
||||
{containerWidth}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user