mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
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 <maximbel2003@gmail.com>
This commit is contained in:
1 parent
05b0ea0c45
commit
6740ed4458
2 files changed
+19
-1
No files matched your search
+18
@@ -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(<LogsView scope={app} />, { 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 () => {
|
||||
|
||||
+1
-1
@@ -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 (
|
||||
<SelectRoot items={items} value={value} onValueChange={(v) => onChange(v ?? ALL)}>
|
||||
<div className="flex min-w-0 items-center gap-1.5">
|
||||
|
||||
Reference in new issue
Block a user