Add sort_by ordering for the log viewer, with a missing-param fallback/drop toggle (ticket 045)
/api/logs now accepts sort_by (an already-declared param name) and sort_missing_fallback: lines carrying that param are ordered by its value, while lines missing it are either appended in ottyl_seq order (fallback, the default) or dropped from the response. Default ottyl_ts-tracking order is unchanged when sort_by is omitted. The log viewer (both the inline panel and its popout) exposes this as a "Sort by" control next to the column picker, persisted to localStorage under one shared key (ottyl.logPreview.sort) — the same global-viewer- setting convention already used for visible param columns and the log viewer's height, since there's no per-dashboard scope for this to divide by. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
70d98562d1
commit
3d2652e95b
@@ -244,6 +244,10 @@ export function fetchLogs(params: {
|
||||
endMs?: number
|
||||
limit?: number
|
||||
filter?: string
|
||||
/** Ticket 045: an already-declared param name to order entries by, instead of the default (`ottyl_ts`-tracking) order. */
|
||||
sortBy?: string
|
||||
/** Ticket 045: only meaningful alongside `sortBy`. `true` (default) orders lines missing that param by `ottyl_seq`, appended after the sorted lines; `false` drops them. */
|
||||
sortMissingFallback?: boolean
|
||||
}): Promise<LogEntry[]> {
|
||||
const search = new URLSearchParams()
|
||||
if (params.sinceSequence !== undefined) search.set('since_sequence', String(params.sinceSequence))
|
||||
@@ -251,6 +255,8 @@ export function fetchLogs(params: {
|
||||
if (params.endMs !== undefined) search.set('end_ms', String(params.endMs))
|
||||
if (params.limit !== undefined) search.set('limit', String(params.limit))
|
||||
if (params.filter) search.set('filter', params.filter)
|
||||
if (params.sortBy) search.set('sort_by', params.sortBy)
|
||||
if (params.sortMissingFallback !== undefined) search.set('sort_missing_fallback', String(params.sortMissingFallback))
|
||||
return getJson(`/api/logs?${search.toString()}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user