mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
Add trigger_kind filter to runs page
- Add trigger_kind field to ListCompletedQuery and ListQueueQuery structs - Implement filtering logic in filter_list_completed_query and filter_list_queue_query - Update OpenAPI spec to document new trigger_kind parameter - Add trigger kind filter UI in RunsFilter component with dropdown for all trigger types - Update JobsLoader to pass trigger_kind to API calls - Update main runs page to handle trigger_kind state and URL params 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Diego Imbert <diegoimbert@users.noreply.github.com>
This commit is contained in:
@@ -8100,6 +8100,11 @@ paths:
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
- name: trigger_kind
|
||||
description: filter by trigger kind (webhook, http, websocket, kafka, email, nats, schedule, app, ui, postgres, sqs, gcp)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: All queued jobs
|
||||
@@ -8469,6 +8474,11 @@ paths:
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
- name: trigger_kind
|
||||
description: filter by trigger kind (webhook, http, websocket, kafka, email, nats, schedule, app, ui, postgres, sqs, gcp)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: All jobs
|
||||
@@ -14442,6 +14452,11 @@ paths:
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
- name: trigger_kind
|
||||
description: filter by trigger kind (webhook, http, websocket, kafka, email, nats, schedule, app, ui, postgres, sqs, gcp)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: time
|
||||
|
||||
@@ -222,6 +222,7 @@ async fn get_concurrent_intervals(
|
||||
all_workspaces: _,
|
||||
concurrency_key: Some(_),
|
||||
allow_wildcards: None,
|
||||
trigger_kind: None,
|
||||
} => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
@@ -1781,6 +1781,7 @@ pub struct ListQueueQuery {
|
||||
pub is_not_schedule: Option<bool>,
|
||||
pub concurrency_key: Option<String>,
|
||||
pub allow_wildcards: Option<bool>,
|
||||
pub trigger_kind: Option<String>,
|
||||
}
|
||||
|
||||
impl From<ListCompletedQuery> for ListQueueQuery {
|
||||
@@ -1812,6 +1813,7 @@ impl From<ListCompletedQuery> for ListQueueQuery {
|
||||
is_not_schedule: lcq.is_not_schedule,
|
||||
concurrency_key: lcq.concurrency_key,
|
||||
allow_wildcards: lcq.allow_wildcards,
|
||||
trigger_kind: lcq.trigger_kind,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1935,6 +1937,10 @@ pub fn filter_list_queue_query(
|
||||
sqlb.and_where("trigger_kind IS DISTINCT FROM 'schedule'");
|
||||
}
|
||||
|
||||
if let Some(tk) = &lq.trigger_kind {
|
||||
sqlb.and_where_eq("v2_job.trigger_kind", "?".bind(tk));
|
||||
}
|
||||
|
||||
sqlb
|
||||
}
|
||||
|
||||
@@ -7639,6 +7645,10 @@ pub fn filter_list_completed_query(
|
||||
sqlb.and_where("trigger_kind IS DISTINCT FROM 'schedule'");
|
||||
}
|
||||
|
||||
if let Some(tk) = &lq.trigger_kind {
|
||||
sqlb.and_where_eq("v2_job.trigger_kind", "?".bind(tk));
|
||||
}
|
||||
|
||||
sqlb
|
||||
}
|
||||
|
||||
@@ -7715,6 +7725,7 @@ pub struct ListCompletedQuery {
|
||||
pub concurrency_key: Option<String>,
|
||||
pub worker: Option<String>,
|
||||
pub allow_wildcards: Option<bool>,
|
||||
pub trigger_kind: Option<String>,
|
||||
}
|
||||
|
||||
async fn list_completed_jobs(
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
folder={null}
|
||||
concurrencyKey={null}
|
||||
tag={null}
|
||||
triggerKind={null}
|
||||
success="running"
|
||||
argFilter={searchArgs ? JSON.stringify(searchArgs) : undefined}
|
||||
bind:loading
|
||||
|
||||
@@ -161,6 +161,7 @@
|
||||
folder={null}
|
||||
concurrencyKey={null}
|
||||
tag={null}
|
||||
triggerKind={null}
|
||||
success="running"
|
||||
argFilter={undefined}
|
||||
bind:loading
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
externalJobs?: Job[] | undefined
|
||||
concurrencyKey: string | null
|
||||
tag: string | null
|
||||
triggerKind: string | null
|
||||
showSkipped?: boolean
|
||||
extendedJobs?: ExtendedJobs | undefined
|
||||
argError?: string
|
||||
@@ -78,6 +79,7 @@
|
||||
externalJobs = $bindable(undefined),
|
||||
concurrencyKey,
|
||||
tag,
|
||||
triggerKind,
|
||||
extendedJobs = $bindable(undefined),
|
||||
argError = '',
|
||||
resultError = '',
|
||||
@@ -217,7 +219,8 @@
|
||||
: undefined,
|
||||
allWorkspaces: allWorkspaces ? true : undefined,
|
||||
perPage,
|
||||
allowWildcards: allowWildcards ? true : undefined
|
||||
allowWildcards: allowWildcards ? true : undefined,
|
||||
triggerKind: triggerKind === null || triggerKind === '' ? undefined : triggerKind
|
||||
})
|
||||
} catch (e) {
|
||||
sendUserToast('There was an issue loading jobs, see browser console for more details', true)
|
||||
@@ -267,7 +270,8 @@
|
||||
: undefined,
|
||||
allWorkspaces: allWorkspaces ? true : undefined,
|
||||
perPage,
|
||||
allowWildcards
|
||||
allowWildcards,
|
||||
triggerKind: triggerKind === null || triggerKind === '' ? undefined : triggerKind
|
||||
})
|
||||
} catch (e) {
|
||||
sendUserToast('There was an issue loading jobs, see browser console for more details', true)
|
||||
@@ -548,6 +552,7 @@
|
||||
jobKinds,
|
||||
concurrencyKey,
|
||||
tag,
|
||||
triggerKind,
|
||||
lookback,
|
||||
user,
|
||||
folder,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
concurrencyKey?: string | null
|
||||
worker?: string | null
|
||||
tag?: string | null
|
||||
triggerKind?: string | null
|
||||
success?: 'running' | 'waiting' | 'suspended' | 'queued' | 'success' | 'failure' | undefined
|
||||
showSkipped?: boolean | undefined
|
||||
argFilter: string
|
||||
@@ -52,6 +53,7 @@
|
||||
| 'worker'
|
||||
| 'tag'
|
||||
| 'schedulePath'
|
||||
| 'triggerKind'
|
||||
small?: boolean
|
||||
calendarSmall?: boolean
|
||||
}
|
||||
@@ -62,6 +64,7 @@
|
||||
concurrencyKey = $bindable(null),
|
||||
worker = $bindable(null),
|
||||
tag = $bindable(null),
|
||||
triggerKind = $bindable(null),
|
||||
success = $bindable(undefined),
|
||||
showSkipped = $bindable(undefined),
|
||||
argFilter = $bindable(),
|
||||
@@ -103,6 +106,8 @@
|
||||
filterBy = 'tag'
|
||||
} else if (schedulePath !== undefined && schedulePath !== '' && filterBy !== 'schedulePath') {
|
||||
filterBy = 'schedulePath'
|
||||
} else if (triggerKind !== null && triggerKind !== '' && filterBy !== 'triggerKind') {
|
||||
filterBy = 'triggerKind'
|
||||
} else if (worker !== null && worker !== '' && filterBy !== 'worker') {
|
||||
filterBy = 'worker'
|
||||
}
|
||||
@@ -120,7 +125,7 @@
|
||||
let displayedSchedule = $derived(schedulePath)
|
||||
let displayedWorker = $derived(worker)
|
||||
$effect(() => {
|
||||
;(path || user || folder || label || worker || concurrencyKey || tag || schedulePath) &&
|
||||
;(path || user || folder || label || worker || concurrencyKey || tag || triggerKind || schedulePath) &&
|
||||
untrack(() => autosetFilter())
|
||||
})
|
||||
|
||||
@@ -131,6 +136,7 @@
|
||||
label = null
|
||||
concurrencyKey = null
|
||||
tag = null
|
||||
triggerKind = null
|
||||
schedulePath = undefined
|
||||
worker = null
|
||||
}
|
||||
@@ -204,6 +210,7 @@
|
||||
{ label: 'Concurrency key', value: 'concurrencyKey' },
|
||||
{ label: 'Label', value: 'label' },
|
||||
{ label: 'Tag', value: 'tag' },
|
||||
{ label: 'Trigger', value: 'triggerKind' },
|
||||
{ label: 'Worker', value: 'worker' }
|
||||
]}
|
||||
{item}
|
||||
@@ -433,6 +440,31 @@
|
||||
</div>
|
||||
{/key}
|
||||
</RunOption>
|
||||
{:else if filterBy === 'triggerKind'}
|
||||
<RunOption label="Trigger Kind" for="triggerKind">
|
||||
{#key triggerKind}
|
||||
<Select
|
||||
items={safeSelectItems([
|
||||
'webhook',
|
||||
'http',
|
||||
'websocket',
|
||||
'kafka',
|
||||
'email',
|
||||
'nats',
|
||||
'schedule',
|
||||
'app',
|
||||
'ui',
|
||||
'postgres',
|
||||
'sqs',
|
||||
'gcp'
|
||||
])}
|
||||
bind:value={() => triggerKind ?? undefined, (v) => (triggerKind = v ?? null)}
|
||||
clearable
|
||||
onClear={() => ((triggerKind = null), dispatch('reset'))}
|
||||
id="triggerKind"
|
||||
/>
|
||||
{/key}
|
||||
</RunOption>
|
||||
{:else if filterBy === 'worker'}
|
||||
<RunOption label="Worker" for="worker">
|
||||
{#key worker}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
let allowWildcards: boolean = $state(page.url.searchParams.get('allow_wildcards') == 'true')
|
||||
let concurrencyKey: string | null = $state(page.url.searchParams.get('concurrency_key'))
|
||||
let tag: string | null = $state(page.url.searchParams.get('tag'))
|
||||
let triggerKind: string | null = $state(page.url.searchParams.get('trigger_kind'))
|
||||
|
||||
// Rest of filters handled by RunsFilter
|
||||
let success: 'running' | 'suspended' | 'waiting' | 'success' | 'failure' | undefined = $state(
|
||||
@@ -123,6 +124,7 @@
|
||||
label = page.url.searchParams.get('label')
|
||||
concurrencyKey = page.url.searchParams.get('concurrency_key')
|
||||
tag = page.url.searchParams.get('tag')
|
||||
triggerKind = page.url.searchParams.get('trigger_kind')
|
||||
worker = page.url.searchParams.get('worker')
|
||||
allowWildcards = page.url.searchParams.get('allow_wildcards') == 'true'
|
||||
// Rest of filters handled by RunsFilter
|
||||
@@ -324,6 +326,12 @@
|
||||
searchParams.delete('allow_wildcards')
|
||||
}
|
||||
|
||||
if (triggerKind) {
|
||||
searchParams.set('trigger_kind', triggerKind)
|
||||
} else {
|
||||
searchParams.delete('trigger_kind')
|
||||
}
|
||||
|
||||
if (graph != 'RunChart') {
|
||||
searchParams.set('graph', graph)
|
||||
} else {
|
||||
@@ -473,6 +481,18 @@
|
||||
allowWildcards = false
|
||||
}
|
||||
|
||||
function filterByTriggerKind(e: CustomEvent<string>) {
|
||||
path = null
|
||||
user = null
|
||||
folder = null
|
||||
label = null
|
||||
concurrencyKey = null
|
||||
tag = null
|
||||
schedulePath = undefined
|
||||
worker = null
|
||||
triggerKind = e.detail
|
||||
}
|
||||
|
||||
let calendarChangeTimeout: number | undefined = $state(undefined)
|
||||
|
||||
function typeOfChart(s: string | null): 'RunChart' | 'ConcurrencyChart' {
|
||||
@@ -744,6 +764,7 @@
|
||||
jobKindsCat,
|
||||
concurrencyKey,
|
||||
tag,
|
||||
triggerKind,
|
||||
graph,
|
||||
maxTs,
|
||||
minTs,
|
||||
@@ -836,6 +857,7 @@
|
||||
bind:externalJobs
|
||||
bind:extendedJobs
|
||||
{concurrencyKey}
|
||||
{triggerKind}
|
||||
{argError}
|
||||
{resultError}
|
||||
{tag}
|
||||
@@ -1031,6 +1053,7 @@
|
||||
bind:label
|
||||
bind:concurrencyKey
|
||||
bind:tag
|
||||
bind:triggerKind
|
||||
bind:worker
|
||||
bind:path
|
||||
bind:success
|
||||
@@ -1284,6 +1307,7 @@
|
||||
on:filterByConcurrencyKey={filterByConcurrencyKey}
|
||||
on:filterByTag={filterByTag}
|
||||
on:filterBySchedule={filterBySchedule}
|
||||
on:filterByTriggerKind={filterByTriggerKind}
|
||||
on:filterByWorker={filterByWorker}
|
||||
bind:this={runsTable}
|
||||
></RunsTable>
|
||||
|
||||
Reference in New Issue
Block a user