feat(portal): show domain name on project cards #898
Conversation
|
Warning Review limit reached
More reviews will be available in 44 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughProject cards now display domain names by fetching identity domains concurrently with projects on the server, enriching responses with resolved names, and rendering with fallback to domain ID or translated "Unknown domain" on the client. ChangesProject Card Domain Display Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Pull request overview
This PR updates the projects overview cards to display each project’s domain name (resolved from Keystone) above the project name, and adjusts the card layout to clamp descriptions to two lines. It also extends the server-side Project schema/response to include an optional domain_name derived from auth/domains.
Changes:
- Add
domain_nameto theProjectschema and attach it server-side by fetchingauth/projectsandauth/domains. - Redesign project cards to render domain label → project name (
h5) → optional 2-line-clamped description. - Add a changeset to release the feature as a minor version bump.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/aurora/src/server/Project/types/models.ts | Extends the Project Zod schema with optional domain_name. |
| packages/aurora/src/server/Project/routers/projectRouter.ts | Fetches domains alongside projects and enriches projects with domain_name. |
| packages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.tsx | Updates card layout to display domain label and clamp description. |
| .changeset/full-signs-cheat.md | Declares a minor changeset for the feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…domain fallback - domains fetch is now best-effort: failure yields empty map, projects still return - guard .json() parse against invalid JSON responses - render <Trans>Unknown domain</Trans> when neither domain_name nor domain_id is available - update tests to cover domains-fetch failure and unknown-domain fallback
andypf
left a comment
There was a problem hiding this comment.
Like it, keep working on it
# Conflicts: # packages/aurora/src/locales/de/messages.ts # packages/aurora/src/locales/en/messages.ts
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
packages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.test.tsx (1)
67-78: ⚡ Quick winAdd coverage for the third fallback branch (
Unknown domain).Line 67 covers
domain_idfallback, but there’s no test for when bothdomain_nameanddomain_idare missing. Please add one assertion for the localized"Unknown domain"path to fully cover the new fallback chain.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.test.tsx` around lines 67 - 78, Add a new test for ProjectCardView that simulates the third fallback by rendering a project with both domain_name and domain_id set to undefined and asserting the localized "Unknown domain" text is rendered; reuse the I18nProvider/i18n and pattern from the existing test ("falls back to domain_id when domain_name is missing") but create a projectLike variable such as [{ ...projects[0], domain_name: undefined, domain_id: undefined }] and in the waitFor assert screen.getByText(/Unknown domain|localized string/) or the exact i18n key’s resolved string to cover the `Unknown domain` fallback branch in ProjectCardView.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/full-signs-cheat.md:
- Line 5: The changeset message incorrectly says a "new juno heading system" was
used; update the description to accurately reflect the implementation in
ProjectCardView.tsx by stating that ContentHeading was replaced with a plain h5
element and that the change shows domain name on project cards by fetching
auth/domains (remove any mention of a Juno heading component). Ensure the text
references the actual behavior (replaced ContentHeading -> h5 and fetch
auth/domains to display domain) so it matches the code.
In `@packages/aurora/src/locales/de/messages.po`:
- Around line 3112-3113: The PO entry for msgid "Unknown domain" has an empty
msgstr; update the locale file (packages/aurora/src/locales/de/messages.po) by
filling msgstr for the msgid "Unknown domain" with the German translation (e.g.,
"Unbekannte Domain") so German users see the localized string instead of the
English fallback.
In `@packages/aurora/src/server/Project/routers/projectRouter.ts`:
- Around line 116-119: The parsed domainsResponse is not runtime-validated like
projectsResponseSchema, so create a domainsResponseSchema (e.g., z.object({
domains: z.array(z.object({ id: z.string(), name: z.string() })) })) and use
domainsResponseSchema.safeParse(domainsData) before constructing domainMap; if
safeParse fails, treat domainsData as null/empty (same fallback behavior as
projects parsing) and only map validated items to build domainMap from the
parsed.data.domains to ensure domain_name values are safe.
---
Nitpick comments:
In
`@packages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.test.tsx`:
- Around line 67-78: Add a new test for ProjectCardView that simulates the third
fallback by rendering a project with both domain_name and domain_id set to
undefined and asserting the localized "Unknown domain" text is rendered; reuse
the I18nProvider/i18n and pattern from the existing test ("falls back to
domain_id when domain_name is missing") but create a projectLike variable such
as [{ ...projects[0], domain_name: undefined, domain_id: undefined }] and in the
waitFor assert screen.getByText(/Unknown domain|localized string/) or the exact
i18n key’s resolved string to cover the `Unknown domain` fallback branch in
ProjectCardView.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: aa597158-b0cd-426b-87c0-01a1ac29ac66
📒 Files selected for processing (10)
.changeset/full-signs-cheat.mdpackages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.test.tsxpackages/aurora/src/client/routes/_auth/projects/-components/ProjectCardView.tsxpackages/aurora/src/locales/de/messages.popackages/aurora/src/locales/de/messages.tspackages/aurora/src/locales/en/messages.popackages/aurora/src/locales/en/messages.tspackages/aurora/src/server/Project/routers/projectRouter.test.tspackages/aurora/src/server/Project/routers/projectRouter.tspackages/aurora/src/server/Project/types/models.ts
Summary
Closes #893
Redesigns the project card layout to show the domain name above the project name, with description truncated to 2 lines. Domain names are resolved by fetching
auth/domainsin parallel withauth/projectsso there is no added latency.Changes Made
ProjectCardView.tsx— new card layout: domain name (small, muted) → project name (h5) → description (2-line clamp, only when present). ReplacedContentHeadingwith a plainh5so Juno's global heading styles apply automatically.projectRouter.ts—getAuthProjectsnow fetchesauth/projectsandauth/domainsin parallel viaPromise.all, builds adomain_id → namemap, and attachesdomain_nameto each project.Projectschema — addeddomain_name: z.string().optional()toprojectSchema.Testing Instructions
pnpm ipnpm run testDefault) above the project name.Notes
auth/domainsis fetched viacallIdentityAPI(direct HTTP with the auth token) rather thangetUserInfobecause the projects overview runs with an unscoped token — unscoped tokens have no service catalog, sogetUserInfo'sopenstackSession.service("identity")returnsundefinedand the domain fetch silently fails.Checklist
Summary by CodeRabbit
New Features
Localization