mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
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:
1 parent
f9ed2afad7
commit
c5b57bffd1
2 files changed
+5
-5
No files matched your search
+4
-4
@@ -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>
|
||||
)
|
||||
}
|
||||
+1
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user