feat(apiproduct): show public URL in API Product overview tab#538
feat(apiproduct): show public URL in API Product overview tab#538namansh70747 wants to merge 1 commit into
Conversation
Adds an Address field to the API Product overview tab so users can see and copy the product's public URL without leaving the page (KuadrantGH-534). The APIProduct carries no address field of its own, so the URL is derived from the HTTPRoute referenced by spec.targetRef: its first non-empty spec.hostnames entry becomes https://<hostname>. This reuses the cached-targetRef + useK8sWatchResource pattern already in APIProductPoliciesTab to survive transient watch reconnections, and the ClipboardCopy pattern already used in APIKeyRevealModal for copy-to-clipboard. When no route hostname is resolvable the field renders "Not set", matching the other optional overview fields. Refs Kuadrant#534 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Naman Sharma <namsh70747@gmail.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Is this ready for review? |
Yes |
@namansh70747 please move PR from draft to ready for review, pr will also require conflicts to be fixed |
Yes, will move it. |
Description
Adds an Address field to the API Product overview tab so users can see and copy the product's public URL directly from the overview, instead of navigating to the underlying route.
Fixes #534
Opening as a draft because the source of the public URL is a design choice I'd like to confirm with @eguzki (see Open question below). The implementation here is complete and working for the UI-derivation approach; if a controller-populated status field is preferred, the change to swap the source is small.
Type of change
[feat]New featureChanges made
spec.targetRef: its first non-emptyspec.hostnamesentry becomeshttps://<hostname>. The APIProduct itself carries no address field (confirmed againsttypes.tsand the CRD), so resolving it from the linked route is the only source available without controller changes.useK8sWatchResourcepattern already inAPIProductPoliciesTab.tsx, so a transient watch reconnection (wherespecis briefly absent) doesn't drop the linked route.ClipboardCopypattern fromAPIKeyRevealModal.tsxfor copy-to-clipboard.Open question for reviewers
Where should the public URL come from?
APIProduct.statuspopulated by the controller (likeAPIKey.status.apiHostname), if one is planned.If (2) is the intended direction, I'll point the field at that status field instead — the rest of the UI stays the same.
Test plan
yarn lintpasses (no changes after running)yarn i18npasses (committed the generatedAddresskey)yarn tsc --noEmitreports no errors insrc/Checklist
t()and are added to the locale file.pf-*/.co-*selectors or hex colors (reuses existing--pf-v6-global--Color--200for the empty state)console.logstatements left inSigned-off-by🤖 Generated with Claude Code