Resolve tickets 058, 062-066: frontend UI fixes
- 058: poll loop now refetches param declarations so auto-declared params appear live without a page reload - 062: browser tab title says "ottyl" instead of "webapp" - 063: declared params list omits the redundant capture-group suffix when it matches the param name - 064: dashboard autosave no longer clobbers in-flight PromQL edits; reconciliation is guarded against edits made after the save request was sent - 065: filter bar placeholder/help icons lead with filter-bar syntax instead of regex - 066: filter bar surfaces the active time-range preset/sort order and resyncs its draft when the value prop changes externally Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1ZJ3SrayzLzVndhVq9BmS
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
a03ec1fb93
commit
4ace654019
+37
-3
@@ -254,6 +254,28 @@ function StandaloneRanged({
|
||||
)
|
||||
}
|
||||
|
||||
/// Ticket 058: only replaces `params` state when the declaration list actually changed, so a param
|
||||
/// list refetched on every poll tick doesn't force `Params.tsx` to re-render when nothing changed.
|
||||
function updateParamsIfChanged(
|
||||
setParams: (updater: (current: ParamDeclaration[]) => ParamDeclaration[]) => void,
|
||||
next: ParamDeclaration[],
|
||||
) {
|
||||
setParams((current) => (JSON.stringify(current) === JSON.stringify(next) ? current : next))
|
||||
}
|
||||
|
||||
/// Ticket 066: text shown under the filter bar when the user hasn't typed a manual filter, so an active preset/sort order is still visible somewhere near the filter input instead of leaving it looking empty/stale.
|
||||
function describeActiveState(activePreset: TimeRangePresetId | null, sortSettings: LogSortSettings): string | null {
|
||||
const parts: string[] = []
|
||||
if (activePreset && activePreset !== 'all') {
|
||||
const preset = TIME_RANGE_PRESETS.find((p) => p.id === activePreset)
|
||||
parts.push(`last ${preset?.label ?? activePreset}`)
|
||||
}
|
||||
if (sortSettings.sortBy) {
|
||||
parts.push(`sorted by ${sortSettings.sortBy}`)
|
||||
}
|
||||
return parts.length > 0 ? parts.join(', ') : null
|
||||
}
|
||||
|
||||
/// The log viewer has its own `LogTimeline`, so it needs its own copy of App's log/timeline polling state instead of a carried-over range.
|
||||
function StandaloneLog() {
|
||||
const [logs, setLogs] = useState<LogEntry[]>([])
|
||||
@@ -311,7 +333,7 @@ function StandaloneLog() {
|
||||
)
|
||||
}
|
||||
try {
|
||||
const [nextBuckets, nextLogs] = await Promise.all([
|
||||
const [nextBuckets, nextLogs, nextParams] = await Promise.all([
|
||||
fetchTimeline({
|
||||
startMs: effectiveRange?.startMs,
|
||||
endMs: effectiveRange?.endMs,
|
||||
@@ -327,10 +349,13 @@ function StandaloneLog() {
|
||||
sortBy: sortSettings.sortBy ?? undefined,
|
||||
sortMissingFallback: sortSettings.sortBy ? sortSettings.sortMissingFallback : undefined,
|
||||
}),
|
||||
// Ticket 058: params can get auto-declared from freshly ingested lines mid-run, not just from a user's own edit.
|
||||
fetchParamDeclarations(),
|
||||
])
|
||||
if (!cancelled) {
|
||||
setBuckets(nextBuckets)
|
||||
setLogs(nextLogs)
|
||||
updateParamsIfChanged(setParams, nextParams)
|
||||
setFilterError(null)
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -352,7 +377,12 @@ function StandaloneLog() {
|
||||
return (
|
||||
<StandalonePage>
|
||||
<div className="flex h-full min-h-0 flex-col">
|
||||
<FilterBar value={filter} onChange={setFilter} error={filterError} />
|
||||
<FilterBar
|
||||
value={filter}
|
||||
onChange={setFilter}
|
||||
error={filterError}
|
||||
activeSummary={describeActiveState(activePreset, sortSettings)}
|
||||
/>
|
||||
<div className="flex min-h-0 flex-1 flex-col">
|
||||
<LogTimeline
|
||||
buckets={buckets}
|
||||
@@ -458,7 +488,7 @@ function FullApp() {
|
||||
)
|
||||
}
|
||||
try {
|
||||
const [nextStats, nextBuckets, nextLogs] = await Promise.all([
|
||||
const [nextStats, nextBuckets, nextLogs, nextParams] = await Promise.all([
|
||||
fetchStats(),
|
||||
fetchTimeline({
|
||||
startMs: effectiveRange?.startMs,
|
||||
@@ -475,11 +505,14 @@ function FullApp() {
|
||||
sortBy: sortSettings.sortBy ?? undefined,
|
||||
sortMissingFallback: sortSettings.sortBy ? sortSettings.sortMissingFallback : undefined,
|
||||
}),
|
||||
// Ticket 058: params can get auto-declared from freshly ingested lines mid-run, not just from a user's own edit.
|
||||
fetchParamDeclarations(),
|
||||
])
|
||||
if (!cancelled) {
|
||||
setStats(nextStats)
|
||||
setBuckets(nextBuckets)
|
||||
setLogs(nextLogs)
|
||||
updateParamsIfChanged(setParams, nextParams)
|
||||
setFilterError(null)
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -508,6 +541,7 @@ function FullApp() {
|
||||
value={filter}
|
||||
onChange={setFilter}
|
||||
error={filterError}
|
||||
activeSummary={describeActiveState(activePreset, sortSettings)}
|
||||
collapseToggle={
|
||||
<>
|
||||
<CollapseToggle collapsed={logViewerCollapsed} onToggle={() => setLogViewerCollapsed(!logViewerCollapsed)} />
|
||||
|
||||
Reference in New Issue
Block a user