From b88ad09678a234ff351173a1cc0674b9721d795f Mon Sep 17 00:00:00 2001
From: ZverGuy
Date: Wed, 4 Nov 2026 18:47:25 +0700
Subject: [PATCH] fix(dashboard): keep the log console on screen when it has no
lines
With no matching lines, while loading, and while Follow waits for the
first line, the dark log console vanished and left a line of small
grey text or a bare spinner, so the page jumped and an empty result
looked like a broken view. The console frame now keeps a fixed height
in every state and says inside it what is going on.
The pod and container pickers move to the console Select and the
filter to the console Input, so the toolbar is keyboard and screen
reader friendly and a long pod name truncates instead of widening it.
Assisted-by: LLM
Signed-off-by: ZverGuy
---
.../observability/EmptyState.test.tsx | 17 +++++
.../components/observability/EmptyState.tsx | 25 ++++++++
.../observability/LogLines.test.tsx | 35 ++++++++---
.../src/components/observability/LogLines.tsx | 44 +++++++------
.../observability/LogsView.test.tsx | 50 ++++++++++++++-
.../src/components/observability/LogsView.tsx | 62 +++++++++++++------
6 files changed, 184 insertions(+), 49 deletions(-)
create mode 100644 packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.test.tsx
create mode 100644 packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.tsx
diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.test.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.test.tsx
new file mode 100644
index 000000000..8872f4d43
--- /dev/null
+++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.test.tsx
@@ -0,0 +1,17 @@
+import { describe, it, expect } from "vitest"
+import { render, screen } from "@testing-library/react"
+import { EmptyState } from "./EmptyState.tsx"
+
+describe("EmptyState", () => {
+ it("announces its message as a status", () => {
+ render()
+
+ expect(screen.getByRole("status")).toHaveTextContent("No data for this range.Pick a longer range.")
+ })
+
+ it("marks itself busy while something is loading", () => {
+ render()
+
+ expect(screen.getByRole("status")).toHaveAttribute("aria-busy", "true")
+ })
+})
diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.tsx
new file mode 100644
index 000000000..0cf58224b
--- /dev/null
+++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/EmptyState.tsx
@@ -0,0 +1,25 @@
+import type { ReactNode } from "react"
+import { cn, Spinner } from "@cozystack/ui"
+
+interface EmptyStateProps {
+ title: ReactNode
+ hint?: ReactNode
+ busy?: boolean
+ tone?: "light" | "dark"
+ className?: string
+}
+
+export function EmptyState({ title, hint, busy, tone = "light", className }: EmptyStateProps) {
+ const dark = tone === "dark"
+ return (
+
+ {busy && }
+
{title}
+ {hint &&
{hint}
}
+
+ )
+}
diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.test.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.test.tsx
index 7110fe464..dd8c503eb 100644
--- a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.test.tsx
+++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.test.tsx
@@ -10,40 +10,59 @@ function sized(list: HTMLElement, scrollHeight: number) {
}
describe("LogLines", () => {
+ it("keeps the console frame and shows the placeholder inside it when there are no lines", () => {
+ render()
+
+ const frame = screen.getByRole("region", { name: "Log lines" })
+ expect(frame).toHaveTextContent("Waiting for new log lines…")
+ expect(screen.queryByRole("list")).toBeNull()
+ })
+
+ it("puts the lines in the same frame once they arrive", () => {
+ const { rerender } = render()
+ const frame = screen.getByRole("region", { name: "Log lines" })
+
+ rerender()
+
+ expect(screen.getByRole("region", { name: "Log lines" })).toBe(frame)
+ expect(frame).toContainElement(screen.getByRole("list"))
+ expect(frame).not.toHaveTextContent("Waiting")
+ })
+
it("keeps following the newest line while the reader is at the bottom", () => {
- const { rerender } = render()
+ const { rerender } = render()
const list = screen.getByRole("list")
sized(list, 500)
- rerender()
+ rerender()
expect(list.scrollTop).toBe(500)
})
it("leaves the position alone once the reader scrolls up", () => {
- const { rerender } = render()
+ const { rerender } = render()
const list = screen.getByRole("list")
sized(list, 500)
list.scrollTop = 120
fireEvent.scroll(list)
- rerender()
+ rerender()
expect(list.scrollTop).toBe(120)
})
it("follows again once the list is cleared for a new run", () => {
- const { rerender } = render()
+ const { rerender } = render()
const first = screen.getByRole("list")
sized(first, 500)
first.scrollTop = 120
fireEvent.scroll(first)
- rerender()
- rerender()
+ rerender()
+ rerender()
const second = screen.getByRole("list")
sized(second, 300)
- rerender()
+ rerender()
expect(second.scrollTop).toBe(300)
})
diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.tsx
index 452faac72..14b941ab2 100644
--- a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.tsx
+++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogLines.tsx
@@ -1,10 +1,10 @@
-import { useEffect, useRef } from "react"
+import { useEffect, useRef, type ReactNode } from "react"
import { CONTAINER_FIELD, POD_FIELD } from "../../lib/observability/logs.ts"
import type { LogEntry } from "../../lib/observability/proxy.ts"
const BOTTOM_SLACK_PX = 24
-export function LogLines({ entries }: { entries: LogEntry[] }) {
+export function LogLines({ entries, placeholder }: { entries: LogEntry[]; placeholder: ReactNode }) {
const ref = useRef(null)
const pinned = useRef(true)
@@ -13,23 +13,31 @@ export function LogLines({ entries }: { entries: LogEntry[] }) {
else if (ref.current && pinned.current) ref.current.scrollTop = ref.current.scrollHeight
}, [entries])
- if (entries.length === 0) return