fix(dashboard): move the tenant logs page under observability/

The fixed /console/logs route came before the generic :plural route,
so an application kind with the plural "logs" would have its list page
replaced by the logs page. A two-segment path cannot shadow an
application list, the same way the backups and migration pages avoid
it.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
ZverGuy committed 2026-11-05 00:16:49 +07:00
1 parent 8e6048eb4a
commit e65d827cf9
4 files changed
+27 -3

No files matched your search

@@ -70,4 +70,28 @@ describe("ConsolePage routing", () => {
await waitFor(() => expect(client.list).toHaveBeenCalled())
expect(screen.queryByText(/Cluster-scoped capacity/i)).toBeNull()
})
it("serves the tenant logs page under observability/", async () => {
renderWithK8sProvider(
<TenantProvider>
<ConsolePage />
</TenantProvider>,
{ client: makeClient(), initialRoute: "/observability/logs" },
)
expect(await screen.findByText(/^Every application in/)).toBeInTheDocument()
})
it("leaves /logs to an application kind whose plural is logs", async () => {
const client = makeClient()
renderWithK8sProvider(
<TenantProvider>
<ConsolePage />
</TenantProvider>,
{ client, initialRoute: "/logs" },
)
await waitFor(() => expect(client.list).toHaveBeenCalled())
expect(screen.queryByText(/^Every application in/)).toBeNull()
})
})
@@ -97,7 +97,7 @@ export function ConsolePage() {
path="migration/vmimporttasks/:name"
element={<MigrationTaskDetailPage />}
/>
<Route path="logs" element={<LogsPage />} />
<Route path="observability/logs" element={<LogsPage />} />
<Route path="new/:appName" element={<ApplicationOrderPage />} />
<Route path=":plural/:name/edit" element={<ApplicationEditRoute />} />
<Route path=":plural/:name/*" element={<ApplicationDetailPage />} />
@@ -117,7 +117,7 @@ describe("useConsoleSidebarSections — admin areas moved out", () => {
wrapper: makeWrapper(client),
})
await waitFor(() => expect(result.current.length).toBeGreaterThan(0))
expect(findItem(result.current, "Logs")?.to).toBe("/console/logs")
expect(findItem(result.current, "Logs")?.to).toBe("/console/observability/logs")
expect(result.current.find((s) => s.title === "Observability")?.items).toHaveLength(1)
})
})
@@ -121,7 +121,7 @@ export function useConsoleSidebarSections(): SidebarSection[] {
const observabilitySection: SidebarSection = {
title: "Observability",
items: [{ label: "Logs", to: "/console/logs", icon: ScrollText }],
items: [{ label: "Logs", to: "/console/observability/logs", icon: ScrollText }],
}
return [...categorySections, backupsSection, migrationSection, observabilitySection]