fix(frontend): keep IPAM namespace context on IP links from namespace relationship tabs

Merged
ID
4mo ago
+74-5

Closes #9892

Problem

When viewing an IPAM namespace object and its relationship tabs (e.g. /ipam/namespaces/IpamNamespace/<id>/ip_prefixes), clicking an IP prefix/address link dropped the namespace context and the target resolved to the default namespace.

Those pages render through the generic object-relationship table, whose links are built by getObjectDetailsUrl with no namespace context. IPAM links preserve the active namespace via the ?namespace=<id> query param, but on a namespace object detail page the namespace lives in the route path, not that query param — so there was nothing to preserve and the link fell back to the default namespace.

Fix

Thread an optional identifierOverrideParams through the relationship table column builder (getObjectTableColumns → getObjectIdentifierColumns → TableIdentifierCell). RelationshipTable injects namespace=<parentId> only when the relationship's parent object is an IP namespace (isOfKind(IP_NAMESPACE_GENERIC, parentSchema)). All params are optional/additive, so other object tables are unaffected.

Scope note

This fixes the entry point from a namespace object's relationship tabs. Once you land on the IP detail page with ?namespace=<id>, the existing IpNamespaceProvider keeps that namespace for subsequent links. Other places that link to an IP without namespace context (e.g. an IP relationship shown on a Device page) are out of scope for this change.

Testing

  • Added src/entities/nodes/utils.test.ts covering getObjectDetailsUrl with/without a namespace override for IP prefix kinds.
  • biome check clean on touched files; touched files are type-clean under tsc --noEmit.

Summary by cubic

Fixes IPAM links on a namespace’s relationship tabs so they keep the current namespace instead of jumping to the default. Clicking an IP prefix or address now stays in the same namespace.

  • Bug Fixes
    • Pass the parent namespace into child links via ?namespace=<id> when the relationship parent is an IP namespace.
    • Thread optional overrideParams through getObjectTableColumns → getObjectIdentifierColumns → TableIdentifierCell to getObjectDetailsUrl.
    • Add tests covering getObjectDetailsUrl with and without a namespace override.