fix(dashboard): link a tenant row to its detail page (#4004)

## What this PR does

Fixes #3822

Tenant list showed name as plain text and the only link in a row was
Edit button, so tenant detail page with its tabs and Delete was
reachable only by opening edit form and cancelling out of it. Name cell
is a link to that page now, it appears exactly where Edit appears and
points to the same CR. Plain click switches selected tenant to the row's
parent first, same as Edit does, because detail page takes namespace
from selected tenant. Ctrl, cmd and shift click don't run that switch,
so the tab you open a tenant from stays where it was.

First commit fixes what the link depends on. Console recovers a tenant's
parent from namespace name (`tenant-a-b` sits under `tenant-a`), but
root is the one level that naming skips: tenant `acme` ordered in
`tenant-root` owns `tenant-acme`, not `tenant-root-acme`. So
`realParentNamespace` returned undefined for every top level tenant,
which is most tenants on a normal cluster, and Edit button has been
missing there for as long as it exists. Ancestor labels carry the parent
that the name does not. Root level tenant named `root-x` resolves to CR
`root-x` now, not `x`.

### Notes

I first tried to make links carry their tenant in the url (`?tenant=`),
so a detail page opened in new tab resolves on its own. That turned into
questions about tenant context itself: what to do with a tenant in a
link the user can't see, what localStorage may hold, and TenantNamespace
LIST ignoring `labelSelector`. Detail route addresses a Tenant CR by
relative name and takes namespace from selected tenant, and making that
robust is a refactor of tenant context and routing, which should start
with study and planning, not with patches on patches. So this PR only
closes the UX gap (no way from tenant list into a tenant's page), going
deeper is out of scope.

Known limit that comes with it: link has no tenant in it, so opening it
in a new tab (ctrl/cmd/middle click, open in new tab, copied url)
resolves against the tenant last selected in any tab, because selection
lives in shared localStorage. For a row directly under that tenant it
opens the right page. For a row deeper in the tree the page says
`Application <name> not found.` and there is no Delete. If that tenant
also has a direct child tenant with the same relative name, new tab
opens that other tenant's page with working Edit and Delete, and delete
confirm says only `Delete Tenant "<name>"?`. Plain click in the same tab
is not affected. Detail page's own tabs and Edit link already behave
this way, it's how detail route resolves its namespace today and fixing
it properly is the refactor above.

A row links, and offers Edit, exactly when namespace holding its Tenant
CR is one the apiserver returns to this user. It returns a tenant
namespace only if the user is subject of a RoleBinding in it, so
sub-tenant admin that cant act in `tenant-root` sees no link there.

No row level Delete button. Issue allows either that or a route to
detail page, I took the route so confirm and mutation stay in one place.

Covered by tests, every source change here fails a test when reverted:

- top level tenant, nested one, root level tenant named `root-x`, forest
root without ancestor labels
- bridged row whose real parent is invisible gets neither link nor Edit
- plain click switches to the row's parent and opens detail page
- ctrl click leaves selection and location alone

### Screenshots

Tenant list under root on a dev cluster. Every row name is a link to
tenant page now (`pr4078` is hovered), top level tenants had neither
link nor Edit before. Host column redacted.

<!-- SCREENSHOT: drag in 01-tenant-list-links.png here -->
<img width="1440" height="900" alt="01-tenant-list-links"
src="https://github.com/user-attachments/assets/39cd723a-1ac5-4d3b-8c36-b70ddc626961"
/>


### Downstream repositories

<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.

Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.

IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:

1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

All changed files are under `packages/system/dashboard/images/console`,
console has no downstream copy (standalone UI repo is archived).

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
fix(dashboard): tenant name in the tenant list links to its detail page now (where Delete is), and top level tenants get their Edit button back.
```



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Root-level tenant names are now displayed without incorrectly removing
prefixes, and tenants ordered directly under the root are correctly
recognized in the hierarchy.
* Tenant rows link to their detail pages when the parent tenant is
accessible. Same-tab navigation updates the active tenant, while opening
a link in another tab leaves the current selection unchanged.
  * Edit links and navigation now use consistent tenant routes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: a2cc9a3016
This commit is contained in:
Myasnikov Daniil committed 2026-11-10 12:23:22 +00:00
commit 07f3716e47
6 files changed
+321 -21

No files matched your search

@@ -0,0 +1,33 @@
import { describe, it, expect } from "vitest"
import type { MouseEvent } from "react"
import { navigatesThisTab } from "./links.ts"
function click(overrides: Partial<MouseEvent> = {}): MouseEvent {
return {
button: 0,
metaKey: false,
altKey: false,
ctrlKey: false,
shiftKey: false,
...overrides,
} as MouseEvent
}
describe("navigatesThisTab", () => {
it("accepts a plain primary click", () => {
expect(navigatesThisTab(click())).toBe(true)
})
// Each of these hands the navigation to a new tab or window, so the tab the
// click happened in keeps whatever tenant it was showing.
it.each(["metaKey", "ctrlKey", "shiftKey", "altKey"] as const)(
"refuses a click modified with %s",
(modifier) => {
expect(navigatesThisTab(click({ [modifier]: true }))).toBe(false)
},
)
it("refuses a non-primary button", () => {
expect(navigatesThisTab(click({ button: 1 }))).toBe(false)
})
})
@@ -0,0 +1,13 @@
import type { MouseEvent } from "react"
/**
* Whether a click on an anchor will navigate the tab it happened in, rather
* than open a new tab or window. React runs `onClick` either way, and a
* cross-tenant link's handler aligns the tenant context of the tab it is
* leaving — which is wrong when that tab is staying where it is. Same button
* and modifier test react-router's own `Link` applies before it intercepts a
* click, minus the `target` check these links have no attribute for.
*/
export function navigatesThisTab(e: MouseEvent): boolean {
return e.button === 0 && !e.metaKey && !e.altKey && !e.ctrlKey && !e.shiftKey
}
@@ -0,0 +1,59 @@
import { describe, it, expect } from "vitest"
import type { TenantNamespace } from "@cozystack/types"
import { realParentNamespace } from "./tenant-tree.ts"
function tn(name: string, ancestors: string[]): TenantNamespace {
const labels: Record<string, string> = {}
for (const a of [...ancestors, name]) labels[`tenant.cozystack.io/${a}`] = ""
return {
apiVersion: "core.cozystack.io/v1alpha1",
kind: "TenantNamespace",
metadata: { name, labels },
} as TenantNamespace
}
describe("realParentNamespace", () => {
it("takes the deepest ancestor that prefixes the namespace", () => {
// The full chain is on the labels; only the longest prefix is the parent.
expect(
realParentNamespace(
tn("tenant-acme-eu-dev", ["tenant-root", "tenant-acme", "tenant-acme-eu"]),
),
).toBe("tenant-acme-eu")
})
it("names an inaccessible parent, which is the point of asking", () => {
// Visibility is the caller's problem: the CR of a bridged row lives in a
// namespace the user may not read, and the caller has to be able to tell.
expect(
realParentNamespace(tn("tenant-acme-eu", ["tenant-root", "tenant-acme"])),
).toBe("tenant-acme")
})
it("resolves a tenant ordered directly in the root", () => {
// A tenant `acme` created in `tenant-root` owns `tenant-acme`, not
// `tenant-root-acme`, so the prefix rule alone leaves every top-level
// tenant — most tenants on a normal cluster — looking parentless.
expect(realParentNamespace(tn("tenant-acme", ["tenant-root"]))).toBe(
"tenant-root",
)
})
it("does not mistake a root-level name that starts with root", () => {
// `tenant-root-x` is the tenant `root-x` ordered in the root, and the
// prefix branch answers with the same parent the label does.
expect(realParentNamespace(tn("tenant-root-x", ["tenant-root"]))).toBe(
"tenant-root",
)
})
it("has no parent for the hierarchy root", () => {
expect(realParentNamespace(tn("tenant-root", []))).toBeUndefined()
})
it("has no parent when the ancestor labels are gone", () => {
// A TenantNamespace carrying only its own label is either the root or
// mislabelled; either way there is no CR namespace to derive.
expect(realParentNamespace(tn("tenant-acme", []))).toBeUndefined()
})
})
@@ -1,4 +1,5 @@
import type { TenantNamespace } from "@cozystack/types"
import { ROOT_TENANT_NAMESPACE } from "./constants.ts"
import { tenantDisplayName } from "./tenant-context.tsx"
const ANCESTOR_LABEL_PREFIX = "tenant.cozystack.io/"
@@ -76,11 +77,18 @@ export function flattenTenantForest(
/**
* Row label relative to the visible parent: `tenant-whmcs-crpjxhwm` under
* `tenant-whmcs` shows as `crpjxhwm`. Forest roots keep their full display
* name — there is no parent on screen to be relative to.
* name — there is no parent on screen to be relative to, and neither do the
* root's own children, whose namespace never carries the parent's name: under
* `tenant-root` the tenant `root-x` owns `tenant-root-x`, and stripping the
* prefix there would label it `x` while its CR is `root-x`.
*/
export function relativeTenantName(node: TenantTreeNode): string {
const ns = node.tn.metadata.name
if (node.parentNs && ns.startsWith(`${node.parentNs}-`)) {
if (
node.parentNs &&
node.parentNs !== ROOT_TENANT_NAMESPACE &&
ns.startsWith(`${node.parentNs}-`)
) {
return ns.slice(node.parentNs.length + 1)
}
return tenantDisplayName(node.tn)
@@ -96,7 +104,16 @@ export function relativeTenantName(node: TenantTreeNode): string {
*/
export function realParentNamespace(tn: TenantNamespace): string | undefined {
const ns = tn.metadata.name
return ancestorNamespaces(tn)
const ancestors = ancestorNamespaces(tn)
const nested = ancestors
.filter((ancestor) => ns.startsWith(`${ancestor}-`))
.sort((a, b) => b.length - a.length)[0]
if (nested) return nested
// The root is the one level the naming rule skips: a tenant `x` ordered in
// `tenant-root` owns `tenant-x`, not `tenant-root-x`, so the prefix test
// never matches and every top-level tenant — most tenants on a normal
// cluster — looked parentless. The ancestor labels still say otherwise.
return ancestors.includes(ROOT_TENANT_NAMESPACE)
? ROOT_TENANT_NAMESPACE
: undefined
}
@@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeAll } from "vitest"
import { screen } from "@testing-library/react"
import { fireEvent, screen } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { useLocation } from "react-router"
import {
K8sClient,
type K8sList,
@@ -8,6 +9,7 @@ import {
} from "@cozystack/k8s-client"
import { TenantsPage } from "./TenantsPage.tsx"
import { TenantProvider } from "../lib/tenant-provider.tsx"
import { useTenantContext } from "../lib/tenant-context.tsx"
import { SELECTED_TENANT_KEY } from "../lib/constants.ts"
import { renderWithK8sProvider } from "../test-utils/render.tsx"
@@ -30,10 +32,19 @@ const VISIBLE = [
tn("tenant-whmcs-a-b", ["tenant-root", "tenant-whmcs", "tenant-whmcs-a"]),
]
function makeClient(): K8sClient {
function LocationProbe() {
const { pathname } = useLocation()
return <div data-testid="location">{pathname}</div>
}
function SelectedTenant() {
return <output data-testid="selected-tenant">{useTenantContext().selectedTenant}</output>
}
function makeClient(tenants: unknown[] = VISIBLE): K8sClient {
const client = new K8sClient()
vi.spyOn(client, "list").mockImplementation(async (_g, _v, plural) => {
const items = plural === "tenantnamespaces" ? VISIBLE : []
const items = plural === "tenantnamespaces" ? tenants : []
return {
apiVersion: "v1",
kind: `${plural}List`,
@@ -89,6 +100,12 @@ describe("TenantsPage tree", () => {
expect(editButtons).toHaveLength(1)
expect(screen.getByTitle("Edit tenant whmcs-x")).toBeInTheDocument()
expect(screen.queryByTitle("Edit tenant whmcs-a-b")).not.toBeInTheDocument()
// The name links to the detail page, where Delete is, exactly where Edit is
// offered: a row whose CR namespace cannot be read stays plain text.
expect(screen.getByRole("link", { name: "x" })).toHaveAttribute("href", "/admin/tenants/x")
expect(screen.queryByRole("link", { name: "a-b" })).toBeNull()
expect(screen.queryByRole("link", { name: "whmcs" })).toBeNull()
})
it("collapses a subtree via the row toggle", async () => {
@@ -109,3 +126,131 @@ describe("TenantsPage tree", () => {
expect(await screen.findByText("x")).toBeInTheDocument()
})
})
// Tenants ordered directly in the root are the common case on a normal
// cluster, and they are the one level the hierarchical namespace naming skips:
// `acme` created in `tenant-root` owns `tenant-acme`, not `tenant-root-acme`.
const ROOT_VISIBLE = [
tn("tenant-root", []),
tn("tenant-acme", ["tenant-root"]),
tn("tenant-acme-eu", ["tenant-root", "tenant-acme"]),
// A root-level tenant whose own name starts with `root`, which is the case
// that makes "strip the parent's prefix" the wrong rule rather than merely
// an incomplete one.
tn("tenant-root-x", ["tenant-root"]),
]
function renderTenants(tenants: unknown[], selected: string) {
localStorage.setItem(SELECTED_TENANT_KEY, selected)
renderWithK8sProvider(
<TenantProvider>
<TenantsPage />
<LocationProbe />
<SelectedTenant />
</TenantProvider>,
{ client: makeClient(tenants), initialRoute: "/admin/tenants" },
)
}
describe("TenantsPage under a visible root", () => {
it("offers Edit on a tenant ordered directly in the root", async () => {
renderTenants(ROOT_VISIBLE, "root")
await userEvent.click(await screen.findByTitle("Edit tenant acme"))
expect(screen.getByTestId("location")).toHaveTextContent("/admin/tenants/acme/edit")
})
it("names a nested tenant's CR relative to its parent", async () => {
renderTenants(ROOT_VISIBLE, "root")
await userEvent.click(await screen.findByTitle("Edit tenant acme-eu"))
expect(screen.getByTestId("location")).toHaveTextContent("/admin/tenants/eu/edit")
})
// `tenant-root-x` is the tenant `root-x`, not the tenant `x`: the row label
// and the CR the row opens have to agree on that.
it("keeps a root-level tenant named root-x whole", async () => {
renderTenants(ROOT_VISIBLE, "root")
expect(await screen.findByText("root-x")).toBeInTheDocument()
await userEvent.click(screen.getByTitle("Edit tenant root-x"))
expect(screen.getByTestId("location")).toHaveTextContent("/admin/tenants/root-x/edit")
})
})
// A forest root that carries no ancestor labels is self-referential: its CR
// lives in its own namespace, and deriving the CR name must not subtract the
// node's own name from itself and leave nothing.
describe("TenantsPage self-referential root", () => {
it("names the CR of a root that is not tenant-root", async () => {
renderTenants([tn("tenant-whmcs", [])], "whmcs")
await userEvent.click(await screen.findByTitle("Edit tenant whmcs"))
expect(screen.getByTestId("location")).toHaveTextContent("/admin/tenants/whmcs/edit")
})
})
describe("TenantsPage row link", () => {
it("links every row whose Tenant CR it can name", async () => {
renderTenants(ROOT_VISIBLE, "root")
// The root's CR is self-referential: `root` inside its own namespace.
expect(await screen.findByRole("link", { name: "root" })).toHaveAttribute(
"href",
"/admin/tenants/root",
)
expect(screen.getByRole("link", { name: "acme" })).toHaveAttribute("href", "/admin/tenants/acme")
expect(screen.getByRole("link", { name: "eu" })).toHaveAttribute("href", "/admin/tenants/eu")
expect(screen.getByRole("link", { name: "root-x" })).toHaveAttribute(
"href",
"/admin/tenants/root-x",
)
})
it("links a self-referential root to its own CR", async () => {
renderTenants([tn("tenant-whmcs", [])], "whmcs")
expect(await screen.findByRole("link", { name: "whmcs" })).toHaveAttribute(
"href",
"/admin/tenants/whmcs",
)
})
// The detail page resolves `eu` in the selected tenant's namespace, and eu's
// CR lives in acme's, so the click has to land the tab on acme.
it("switches to the row's parent and opens the detail page", async () => {
renderTenants(ROOT_VISIBLE, "root")
fireEvent.click(await screen.findByRole("link", { name: "eu" }))
expect(screen.getByTestId("selected-tenant").textContent).toBe("acme")
expect(screen.getByTestId("location")).toHaveTextContent("/admin/tenants/eu")
})
// Edit shares the route with the link, and its form resolves the CR the same
// way, so it has to land on the parent too.
it("switches to the row's parent before opening the edit form", async () => {
renderTenants(ROOT_VISIBLE, "root")
await userEvent.click(await screen.findByTitle("Edit tenant acme-eu"))
expect(screen.getByTestId("selected-tenant").textContent).toBe("acme")
})
// A ctrl-click opens a new tab; the tab it happened in stays where it is.
it("leaves the current tab alone on a ctrl-click", async () => {
renderTenants(ROOT_VISIBLE, "root")
const link = await screen.findByRole("link", { name: "eu" })
// jsdom cannot open the new tab; the handler under test has run by then.
link.addEventListener("click", (e) => e.preventDefault())
fireEvent.click(link, { ctrlKey: true })
expect(screen.getByTestId("selected-tenant").textContent).toBe("root")
expect(screen.getByTestId("location")).toHaveTextContent(/^\/admin\/tenants$/)
})
})
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react"
import { useNavigate } from "react-router"
import { Link, useNavigate } from "react-router"
import { Plus, Edit, Info, ChevronDown, ChevronRight, CornerDownRight } from "lucide-react"
import { Spinner, Section, Button } from "@cozystack/ui"
import { useK8sList } from "@cozystack/k8s-client"
@@ -13,7 +13,8 @@ import {
relativeTenantName,
type TenantTreeNode,
} from "../lib/tenant-tree.ts"
import { TENANT_NAMESPACE_PREFIX } from "../lib/constants.ts"
import { ROOT_TENANT_NAMESPACE, TENANT_NAMESPACE_PREFIX } from "../lib/constants.ts"
import { navigatesThisTab } from "../lib/links.ts"
import { formatAge } from "../lib/status.ts"
import { TenantQuotaCompact } from "../components/QuotaDisplay.tsx"
import type { ResourceQuota } from "../components/QuotaDisplay.tsx"
@@ -34,11 +35,17 @@ type TreeNode = TenantTreeNode
/**
* The Tenant CR of a namespace lives in its parent's namespace under the
* short name: `tenant-whmcs-jzmnbwum` under `tenant-whmcs` is CR `jzmnbwum`.
* Root-level children (`tenant-kvaps` under `tenant-root`) collapse to the
* same rule via the plain `tenant-` prefix strip.
* Under the root the naming rule drops a level — a tenant `kvaps` ordered in
* `tenant-root` owns `tenant-kvaps` — so there the CR name is the plain
* prefix strip, which also names the root's own self-referential CR (`root`).
* Excluding the root from the prefix branch rather than dropping the branch
* keeps two things right at once: a root-level tenant called `root-x`
* resolves to the CR `root-x` and not `x`, and a self-referential node whose
* namespace is not `tenant-root` still names itself instead of the empty
* string that subtracting its own name would leave.
*/
function tenantCrName(ns: string, parentNs: string): string {
return ns.startsWith(`${parentNs}-`)
return parentNs !== ROOT_TENANT_NAMESPACE && ns.startsWith(`${parentNs}-`)
? ns.slice(parentNs.length + 1)
: ns.slice(TENANT_NAMESPACE_PREFIX.length)
}
@@ -125,8 +132,8 @@ export function TenantsPage() {
// A node's Tenant CR lives in its REAL parent's namespace, which is not
// necessarily the parent it hangs under: a node whose real parent is
// inaccessible is bridged onto the nearest visible ancestor. Deriving the CR
// from that bridged ancestor names a CR that does not exist, so the edit
// target comes from realParentNamespace instead — and is offered only when
// from that bridged ancestor names a CR that does not exist, so Tenant CR
// routes come from realParentNamespace instead — and are offered only when
// that namespace is actually readable, since otherwise there is no CR the
// user could open. The hierarchy root (no ancestor labels at all) is
// self-referential: its CR (`root`) lives in its own namespace.
@@ -137,12 +144,20 @@ export function TenantsPage() {
const real = realParentNamespace(node.tn)
return real && visibleNs.has(real) ? real : undefined
}
const canEdit = (node: TreeNode) => !!editParentNs(node)
const editNode = (node: TreeNode) => {
const tenantRoute = (node: TreeNode) => {
const parentNs = editParentNs(node)
if (!parentNs) return
selectTenant(parentNs.slice(TENANT_NAMESPACE_PREFIX.length))
navigate(`${basePath}/tenants/${tenantCrName(node.tn.metadata.name, parentNs)}/edit`)
if (!parentNs) return undefined
return {
parentTenant: parentNs.slice(TENANT_NAMESPACE_PREFIX.length),
path: `${basePath}/tenants/${tenantCrName(node.tn.metadata.name, parentNs)}`,
}
}
const canEdit = (node: TreeNode) => !!tenantRoute(node)
const editNode = (node: TreeNode) => {
const route = tenantRoute(node)
if (!route) return
selectTenant(route.parentTenant)
navigate(`${route.path}/edit`)
}
return (
@@ -183,6 +198,7 @@ export function TenantsPage() {
const modules = modulesByNamespace.get(ns) ?? []
const tenantQuotas = quotasByNamespace.get(ns) ?? []
const host = node.tn.metadata.labels?.[HOST_LABEL]
const route = tenantRoute(node)
return (
<tr key={ns} className="hover:bg-slate-50">
<td className="px-4 py-3">
@@ -207,9 +223,26 @@ export function TenantsPage() {
<CornerDownRight className="size-3.5 shrink-0 text-slate-300" />
) : null}
<div className="min-w-0">
<p className="truncate text-sm font-medium text-slate-900">
{relativeTenantName(node)}
</p>
{route ? (
<Link
to={route.path}
// The detail page reads the namespace from the
// tenant context, so the tab that navigates has
// to be on the row's parent first; a ctrl-click
// opens another tab and leaves this one alone.
onClick={(e) => {
if (!navigatesThisTab(e)) return
selectTenant(route.parentTenant)
}}
className="block truncate text-sm font-medium text-slate-900 hover:underline"
>
{relativeTenantName(node)}
</Link>
) : (
<p className="truncate text-sm font-medium text-slate-900">
{relativeTenantName(node)}
</p>
)}
<p className="truncate font-mono text-[11px] text-slate-400">
{ns}
</p>