From 6740ed445899fdd689ef7676840bc2d7a74936bc Mon Sep 17 00:00:00 2001 From: ZverGuy Date: Wed, 4 Nov 2026 18:53:47 +0700 Subject: [PATCH] fix(dashboard): offer All once when a log stream has no pod name VictoriaLogs can return an empty value for the pod or container field when some streams lack the label. That empty value is the picker's own "All" sentinel, so the list showed two selected "All" entries with the same key. Empty values are dropped from the field values. The tests now also pin what the log console says when Follow stops before any line and when the history query fails, so those messages cannot silently swap with the empty-result one. Assisted-by: LLM Signed-off-by: ZverGuy --- .../components/observability/LogsView.test.tsx | 18 ++++++++++++++++++ .../src/components/observability/LogsView.tsx | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.test.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.test.tsx index 31c6fac0e..47b6b4ef9 100644 --- a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.test.tsx +++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.test.tsx @@ -135,6 +135,8 @@ describe("LogsView", () => { expect(await screen.findByText(/Stopped/)).toBeInTheDocument() expect(screen.getByText("pipe not allowed in tail")).toBeInTheDocument() + const frame = screen.getByRole("region", { name: "Log lines" }) + expect(within(frame).getByText("Follow stopped before any line arrived.")).toBeInTheDocument() }) it("renders a cluster without the proxy as not available", async () => { @@ -165,6 +167,22 @@ describe("LogsView", () => { expect(await screen.findByText("cannot parse query")).toBeInTheDocument() expect(screen.getByLabelText("LogsQL filter")).toBeInTheDocument() + const frame = screen.getByRole("region", { name: "Log lines" }) + expect(within(frame).getByText("No log lines to show.")).toBeInTheDocument() + }) + + it("offers All once when some lines carry no pod name", async () => { + const { client } = clientWith((endpoint, params) => + endpoint.endsWith("stream_field_values") && params.get("field") === "kubernetes_pod_name" + ? values("", "db-0") + : defaultHandler(endpoint, params), + ) + renderWithK8sProvider(, { client }) + + await userEvent.click(screen.getByRole("combobox", { name: "Pod" })) + + await screen.findByRole("option", { name: "db-0" }) + expect(screen.getAllByRole("option").map((o) => o.textContent)).toEqual(["All", "db-0"]) }) it("names the source pod and container of each line", async () => { diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.tsx index d2a000010..1976c7dfc 100644 --- a/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.tsx +++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/LogsView.tsx @@ -36,7 +36,7 @@ function windowFor(range: LogRangeKey) { const ALL = "" function Picker({ label, value, options, onChange }: { label: string; value: string; options: string[]; onChange: (v: string) => void }) { - const items = [{ value: ALL, label: "All" }, ...options.map((o) => ({ value: o, label: o }))] + const items = [{ value: ALL, label: "All" }, ...options.filter((o) => o !== ALL).map((o) => ({ value: o, label: o }))] return ( onChange(v ?? ALL)}>