From e671aaedf9afdbd43cd0e8dfa45e9b7b9cc3aeda Mon Sep 17 00:00:00 2001 From: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Date: Thu, 26 Feb 2026 18:41:59 +0100 Subject: [PATCH] Runs page nits (#8084) * nit warning toast * timeframe as URL param * all workspaces filter only in admins workspace * nit bold todays date --- frontend/src/lib/components/RunsPage.svelte | 13 ++++--- .../auditLogs/AuditLogsFilters.svelte | 2 +- .../common/InlineCalendarInput.svelte | 6 ++- .../src/lib/components/runs/runsFilter.ts | 39 ++++++++++++++----- .../components/runs/useJobsLoader.svelte.ts | 2 +- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/frontend/src/lib/components/RunsPage.svelte b/frontend/src/lib/components/RunsPage.svelte index 635a805511..f01e068132 100644 --- a/frontend/src/lib/components/RunsPage.svelte +++ b/frontend/src/lib/components/RunsPage.svelte @@ -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..." /> diff --git a/frontend/src/lib/components/auditLogs/AuditLogsFilters.svelte b/frontend/src/lib/components/auditLogs/AuditLogsFilters.svelte index 3bc97538d9..1af551d82e 100644 --- a/frontend/src/lib/components/auditLogs/AuditLogsFilters.svelte +++ b/frontend/src/lib/components/auditLogs/AuditLogsFilters.svelte @@ -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) }] : [] diff --git a/frontend/src/lib/components/common/InlineCalendarInput.svelte b/frontend/src/lib/components/common/InlineCalendarInput.svelte index bbcd9e9060..2ef2e4bd2f 100644 --- a/frontend/src/lib/components/common/InlineCalendarInput.svelte +++ b/frontend/src/lib/components/common/InlineCalendarInput.svelte @@ -503,7 +503,11 @@ {cell.day} diff --git a/frontend/src/lib/components/runs/runsFilter.ts b/frontend/src/lib/components/runs/runsFilter.ts index 289ed66535..589c44a984 100644 --- a/frontend/src/lib/components/runs/runsFilter.ts +++ b/frontend/src/lib/components/runs/runsFilter.ts @@ -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 | 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' }] + : []) ] diff --git a/frontend/src/lib/components/runs/useJobsLoader.svelte.ts b/frontend/src/lib/components/runs/useJobsLoader.svelte.ts index 384e925564..b4cb93d94b 100644 --- a/frontend/src/lib/components/runs/useJobsLoader.svelte.ts +++ b/frontend/src/lib/components/runs/useJobsLoader.svelte.ts @@ -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) }] : []