feat: link each trigger to its runs and stop repeating row buttons in the menu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-02 16:57:01 +01:00
co-authored by Claude Opus 5.5
parent 95344a326f
commit d7f032c795
6 changed files with 62 additions and 3 deletions
+1
View File
@@ -19611,6 +19611,7 @@ paths:
- $ref: "#/components/parameters/ScriptExactPath"
- $ref: "#/components/parameters/ScriptStartPath"
- $ref: "#/components/parameters/SchedulePath"
- $ref: "#/components/parameters/TriggerPath"
- $ref: "#/components/parameters/ScriptExactHash"
- $ref: "#/components/parameters/StartedBefore"
- $ref: "#/components/parameters/StartedAfter"
@@ -119,6 +119,12 @@ export function buildRunsFilterSearchbarSchema({
icon: Clock,
description: 'Filter by schedule that triggered the job'
},
trigger_path: {
type: 'string' as const,
label: 'Trigger path',
icon: Zap,
description: 'Filter by the trigger that started the job'
},
concurrency_key: {
type: 'string' as const,
label: 'Concurrency key',
@@ -103,6 +103,7 @@ export function useJobsLoader(args: () => UseJobLoaderArgs) {
let resultFilter = $derived(filters?.result)
let jobTriggerKind = $derived(filters?.job_trigger_kind ?? null)
let schedulePath = $derived(filters?.schedule_path ?? null)
let triggerPath = $derived(filters?.trigger_path ?? null)
let jobKindsCat = $derived(filters?.job_kinds ?? null)
let allWorkspaces = $derived(filters?.all_workspaces ?? false)
let allowWildcards = $derived(_allowWildcards(filters))
@@ -467,6 +468,7 @@ export function useJobsLoader(args: () => UseJobLoaderArgs) {
? (completedAfter ?? createdAfterQueue)
: createdAfterQueue,
schedulePath: schedulePath ?? undefined,
triggerPath: triggerPath ?? undefined,
scriptPathExact,
createdBy: user == null || user === '' ? undefined : user,
scriptPathStart: scriptPathStart,
@@ -1,4 +1,5 @@
<script lang="ts">
import { MediaQuery } from 'svelte/reactivity'
import { getLocalDraftHint } from '$lib/localDraftHints.svelte'
import {
ScheduleService,
@@ -383,6 +384,8 @@
})
let items = $derived(filteredItems)
// The row's buttons show from md up; their menu entries are there for narrower screens.
const wide = new MediaQuery('min-width: 768px')
</script>
{#snippet scheduleRow(s: ScheduleWJobs, inTree: boolean, depth: number)}
@@ -567,7 +570,6 @@
{/key}
</div>
<div class="flex gap-2 items-center justify-end shrink-0">
<!-- Below md these two live only in the dropdown, which has both. -->
<Button
href={`/runs/?schedule_path=${path}&job_trigger_kind=schedule&show_future_jobs=true`}
disabled={draft_only}
@@ -621,6 +623,7 @@
{
displayName: canEdit ? 'Edit' : 'View',
icon: canEdit ? Pen : Eye,
hide: wide.current,
action: () => {
editSchedule(path, is_flow)
}
@@ -644,6 +647,7 @@
displayName: 'View runs',
icon: List,
disabled: draft_only,
hide: wide.current,
href: `/runs/?schedule_path=${path}&job_trigger_kind=schedule&show_future_jobs=true`
},
{
@@ -1,5 +1,6 @@
<script lang="ts">
import { onDestroy, untrack } from 'svelte'
import { MediaQuery } from 'svelte/reactivity'
import { page } from '$app/stores'
import {
AzureTriggerService,
@@ -34,6 +35,7 @@
Database,
Eye,
FileUp,
List,
Mail,
Pause,
Pen,
@@ -95,6 +97,10 @@
const hosted = useHostedPage()
const config = $derived(TRIGGER_LIST_CONFIG[triggerKind])
// The row's buttons show from md up; their menu entries are there for narrower screens.
const wide = new MediaQuery('min-width: 768px')
const runsHref = (path: string) =>
`/runs?trigger_path=${encodeURIComponent(path)}&job_trigger_kind=${triggerKind}`
const isAdmin = $derived(
!!(operatingUser.current?.is_admin || operatingUser.current?.is_super_admin)
)
@@ -802,7 +808,16 @@
</div>
<div class="flex gap-2 items-center justify-end shrink-0">
<!-- Below md these two live only in the dropdown, which has both. -->
<Button
href={runsHref(path)}
disabled={draft_only}
unifiedSize="md"
startIcon={{ icon: List }}
variant="subtle"
wrapperClasses="max-md:hidden"
>
Runs
</Button>
{#if copy}
<Button
on:click={() => copyToClipboard(copy.value)}
@@ -835,6 +850,7 @@
{
displayName: copy.label,
icon: ClipboardCopy,
hide: wide.current,
action: () => copyToClipboard(copy.value)
}
]
@@ -853,8 +869,16 @@
{
displayName: canEdit ? 'Edit' : 'View',
icon: canEdit ? Pen : Eye,
hide: wide.current,
action: () => openEdit(path, is_flow)
},
{
displayName: 'View runs',
icon: List,
disabled: draft_only,
hide: wide.current,
href: runsHref(path)
},
...(isDeployable('trigger', path, deployUiSettings)
? [
{
@@ -10,7 +10,8 @@
import Button from '$lib/components/common/button/Button.svelte'
import RowIcon from '$lib/components/common/table/RowIcon.svelte'
import Dropdown from '$lib/components/DropdownV2.svelte'
import { Eye, Pen, RefreshCw, Trash } from 'lucide-svelte'
import { Eye, List, Pen, RefreshCw, Trash } from 'lucide-svelte'
import { MediaQuery } from 'svelte/reactivity'
import ConfirmationModal from '$lib/components/common/confirmationModal/ConfirmationModal.svelte'
import { isNewTabClick } from '$lib/navigation'
import Alert from '$lib/components/common/alert/Alert.svelte'
@@ -37,6 +38,11 @@
let { service, triggers = [], loading = false, onEdit, onRecreate, onUpdate }: Props = $props()
const serviceConfig = $derived(getServiceConfig(service))
// The row's buttons show from md up; their menu entries are there for narrower screens.
const wide = new MediaQuery('min-width: 768px')
// A native trigger's runs record its external id as their trigger.
const runsHref = (externalId: string) =>
`/runs?trigger_path=${encodeURIComponent(externalId)}&job_trigger_kind=${service}`
let deleteConfirmationOpen = $state(false)
let triggerToDelete = $state<ExtendedNativeTrigger | null>(null)
let isDeleting = $state(false)
@@ -174,6 +180,15 @@
hideToggleLabels
hideDropdown
/>
<Button
href={runsHref(trigger.external_id)}
unifiedSize="md"
startIcon={{ icon: List }}
variant="subtle"
wrapperClasses="max-md:hidden"
>
Runs
</Button>
<Button
on:click={() => onEdit?.(trigger)}
unifiedSize="md"
@@ -194,8 +209,15 @@
{
displayName: canEdit ? 'Edit' : 'View',
icon: canEdit ? Pen : Eye,
hide: wide.current,
action: () => onEdit?.(trigger)
},
{
displayName: 'View runs',
icon: List,
hide: wide.current,
href: runsHref(trigger.external_id)
},
{
displayName: 'Delete',
type: 'delete' as const,