fix(dashboard): open log history at the newest line

A historical query lists lines oldest first, so the viewer opened at
the top of a 500-line window while the line a user looks for is
usually the latest. The chart's value axis also clipped wide labels
such as "476.8 MiB".

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
ZverGuy committed 2026-11-04 05:39:27 +07:00
1 parent f9ed2afad7
commit c5b57bffd1
2 files changed
+5 -5

No files matched your search

@@ -50,11 +50,11 @@ function Picker({ label, value, options, onChange }: { label: string; value: str
)
}
function LogLines({ entries, follow }: { entries: LogEntry[]; follow: boolean }) {
function LogLines({ entries }: { entries: LogEntry[] }) {
const ref = useRef<HTMLOListElement>(null)
useEffect(() => {
if (follow && ref.current) ref.current.scrollTop = ref.current.scrollHeight
}, [entries, follow])
if (ref.current) ref.current.scrollTop = ref.current.scrollHeight
}, [entries])
if (entries.length === 0) return <p className="text-sm text-slate-500">No log lines for this range and filter.</p>
return (
<ol ref={ref} className="max-h-[60vh] overflow-auto rounded-md bg-slate-950 p-3 font-mono text-xs leading-5 text-slate-100">
@@ -146,7 +146,7 @@ export function LogsView({ scope }: { scope: ObservabilityScope }) {
</p>
)}
{error ? <ProxyNotice what="Logs" error={error} /> : null}
{!follow && history.isLoading ? <Spinner /> : <LogLines entries={entries} follow={follow} />}
{!follow && history.isLoading ? <Spinner /> : <LogLines entries={entries} />}
</div>
)
}
@@ -33,7 +33,7 @@ export function TimeSeriesChart({ data, format }: TimeSeriesChartProps) {
value: (_: uPlot, v: number | null) => fmt(v),
})),
],
axes: [{}, { size: 70, values: (_: uPlot, splits: number[]) => splits.map(format) }],
axes: [{}, { size: 84, values: (_: uPlot, splits: number[]) => splits.map(format) }],
},
[data.timestamps, ...data.series.map((s) => s.values)],
el,