mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
fix(dashboard): keep the logs view when only the pod list is refused
The pod picker's values query counted as a scope-wide refusal, so a proxy that refused only that path replaced the whole view, filter and lines included, with a notice even though the log query itself worked. A real scope-wide refusal still reaches the history or tail query and shows the notice from there. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
e65d827cf9
commit
52087d92dc
2 files changed
+14
-1
No files matched your search
+12
@@ -212,6 +212,18 @@ describe("LogsView", () => {
|
||||
expect(within(frame).queryByText(/No log lines/)).toBeNull()
|
||||
})
|
||||
|
||||
it("keeps the view when only the pod list is refused", async () => {
|
||||
const status = JSON.stringify({ kind: "Status", apiVersion: "v1", status: "Failure", code: 404 })
|
||||
const { client } = clientWith((endpoint, params) =>
|
||||
endpoint.endsWith("stream_field_values") ? new Response(status, { status: 404 }) : defaultHandler(endpoint, params),
|
||||
)
|
||||
|
||||
renderWithK8sProvider(<LogsView scope={app} />, { client })
|
||||
|
||||
expect(await screen.findByText("ready to accept connections")).toBeInTheDocument()
|
||||
expect(screen.queryByText("Logs are not available on this cluster.")).toBeNull()
|
||||
})
|
||||
|
||||
it("names the source pod and container of each line", async () => {
|
||||
const { client } = clientWith(defaultHandler)
|
||||
|
||||
|
||||
+2
-1
@@ -106,7 +106,8 @@ export function LogsView({ scope }: { scope: ObservabilityScope }) {
|
||||
})
|
||||
const tail = useLogTail(root, query, followRun, { cap: FOLLOW_CAP })
|
||||
|
||||
const wide = [pods.error, history.error, tail.error].find(isScopeWide)
|
||||
// The pod list is optional: refusing it alone must not hide lines the query can still read.
|
||||
const wide = [history.error, tail.error].find(isScopeWide)
|
||||
if (wide) {
|
||||
return (
|
||||
<div className="p-6">
|
||||
|
||||
Reference in new issue
Block a user