Runs page nits (#8084)

* nit warning toast

* timeframe as URL param

* all workspaces filter only in admins workspace

* nit bold todays date
This commit is contained in:
Diego Imbert
2026-02-26 18:41:59 +01:00
committed by GitHub
parent 7d44ff4346
commit e671aaedf9
5 changed files with 44 additions and 18 deletions

View File

@@ -82,7 +82,8 @@
usernames,
folders,
jobTriggerKinds,
isSuperAdmin: !!$superadmin
isSuperAdmin: !!$superadmin,
isAdminsWorkspace: $workspaceStore === 'admins'
})
)
let perPage = useLocalStorageValue('runs_per_page', 1000, 'number')
@@ -117,18 +118,17 @@
type?: ConfirmationModal['$$prop_def']['type']
} = $state(undefined)
let automaticTimeframeState = useLocalStorageValue('runs_automatic_timeframe', 'null', 'string')
let _timeframe = useSyncedTimeframe(
runsTimeframes,
() => ({
maxTs: filters.val.max_ts?.toISOString(),
minTs: filters.val.min_ts?.toISOString(),
timeframe: automaticTimeframeState.val === 'null' ? null : automaticTimeframeState.val
timeframe: filters.val.timeframe
}),
(v) => {
v.maxTs ? (filters.val.max_ts = new Date(v.maxTs)) : delete filters.val.max_ts
v.minTs ? (filters.val.min_ts = new Date(v.minTs)) : delete filters.val.min_ts
automaticTimeframeState.val = v.timeframe ?? 'null'
v.timeframe ? (filters.val.timeframe = v.timeframe) : delete filters.val.timeframe
}
)
let timeframe = $derived(_timeframe.val)
@@ -724,7 +724,10 @@
ButtonType.UnifiedMinHeightClasses.md
)}
schema={runsFilterSearchbarSchema}
presets={buildRunsFilterPresets({ isSuperadmin: !!$superadmin })}
presets={buildRunsFilterPresets({
isSuperadmin: !!$superadmin,
isAdminsWorkspace: $workspaceStore === 'admins'
})}
bind:value={filters.val}
placeholder="Filter runs..."
/>

View File

@@ -117,7 +117,7 @@
promise = CancelablePromiseUtils.onTimeout(promise, 4000, () => {
sendUserToast(
'Loading audit logs is taking longer than expected...',
true,
'warning',
perPage > 25
? [{ label: 'Reduce to 25 items per page', callback: () => (perPage = 25) }]
: []

View File

@@ -503,7 +503,11 @@
<span
class={twMerge(
'relative z-10',
selected ? 'text-white dark:text-white' : isToday && !disabled ? 'text-accent' : ''
selected
? 'text-white dark:text-white'
: isToday && !disabled
? 'text-accent font-semibold'
: ''
)}
>
{cell.day}

View File

@@ -16,19 +16,22 @@ import {
} from 'lucide-svelte'
import { triggerDisplayNamesMap } from '../triggers/utils'
import type { FilterInstanceRec, FilterSchemaRec } from '../FilterSearchbar.svelte'
import { runsTimeframes } from './TimeframeSelect.svelte'
export function buildRunsFilterSearchbarSchema({
paths,
usernames,
folders,
jobTriggerKinds,
isSuperAdmin
isSuperAdmin,
isAdminsWorkspace
}: {
paths: string[]
usernames: string[]
folders: string[]
jobTriggerKinds: JobTriggerKind[]
isSuperAdmin: boolean
isAdminsWorkspace: boolean
}) {
return {
_default_: {
@@ -51,6 +54,13 @@ export function buildRunsFilterSearchbarSchema({
mode: 'end',
otherField: 'min_ts'
},
timeframe: {
type: 'oneof' as const,
label: 'Timeframe',
icon: Calendar,
description: 'Predefined timeframes',
options: runsTimeframes.map((tf) => ({ label: tf.label, value: tf.label }))
},
path: {
type: 'oneof' as const,
options: paths.map((s) => ({ label: s, value: s })),
@@ -196,13 +206,14 @@ export function buildRunsFilterSearchbarSchema({
label: 'Show future jobs (Default: true)',
description: 'Include jobs that are planned later'
},
...(isSuperAdmin && {
all_workspaces: {
type: 'boolean' as const,
label: 'All workspaces',
description: 'Show jobs of all workspaces (superadmin only)'
}
})
...(isSuperAdmin &&
isAdminsWorkspace && {
all_workspaces: {
type: 'boolean' as const,
label: 'All workspaces',
description: 'Show jobs of all workspaces (superadmin only)'
}
})
} satisfies FilterSchemaRec
}
@@ -218,8 +229,16 @@ export function allowWildcards(filters: Partial<RunsFilterInstance> | undefined)
)
}
export const buildRunsFilterPresets = ({ isSuperadmin }: { isSuperadmin: boolean }) => [
export const buildRunsFilterPresets = ({
isSuperadmin,
isAdminsWorkspace
}: {
isSuperadmin: boolean
isAdminsWorkspace: boolean
}) => [
{ name: 'Hide schedules', value: 'job_trigger_kind:\\ !schedule' },
{ name: 'Hide future jobs', value: 'show_future_jobs:\\ false' },
...(isSuperadmin ? [{ name: 'All workspaces', value: 'all_workspaces:\\ true' }] : [])
...(isSuperadmin && isAdminsWorkspace
? [{ name: 'All workspaces', value: 'all_workspaces:\\ true' }]
: [])
]

View File

@@ -116,7 +116,7 @@ export function useJobsLoader(args: () => UseJobLoaderArgs) {
promise = CancelablePromiseUtils.onTimeout(promise, 4000, () => {
sendUserToast(
'Loading jobs is taking longer than expected...',
true,
'warning',
perPage > 25 && onSetPerPage
? [{ label: 'Reduce to 25 items per page', callback: () => onSetPerPage(25) }]
: []