feat(home): add config-driven predefined home page cards - #714
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe portal home page now renders predefined cards from a configurable layout. A card registry handles component selection and visibility. ChangesHome card layouts
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant HomePage
participant configApi
participant getHomeCardConfig
participant HOME_CARD_REGISTRY
participant RecentDeploymentsCard
participant CatalogApi
participant OpenChoreoApi
HomePage->>configApi: Read openchoreo.home.cardConfig
HomePage->>getHomeCardConfig: Resolve named layout
HomePage->>HOME_CARD_REGISTRY: Resolve configured cardId
HOME_CARD_REGISTRY-->>HomePage: Return card component and visibility hook
HomePage->>RecentDeploymentsCard: Render configured placement
RecentDeploymentsCard->>CatalogApi: Fetch Component entities
RecentDeploymentsCard->>OpenChoreoApi: Fetch environment deployment data
OpenChoreoApi-->>RecentDeploymentsCard: Return deployment status and timestamps
RecentDeploymentsCard-->>HomePage: Render deployment rows
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
efcc934 to
dd3f0e1
Compare
Signed-off-by: isuruRuhu <isuru.ruhu@gmail.com>
dd3f0e1 to
8c42320
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@packages/portal-app/src/components/Home/RecentDeploymentsCard.tsx`:
- Around line 232-236: Update the component-loading flow around
catalogApi.getEntities and the components slice so deployment recency is
determined before applying MAX_COMPONENTS. Use a backend recency-ordered
endpoint or query, request only the fields needed for deployment timestamps and
display, then limit the recency-sorted results for the Recent Deployments card.
🪄 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 Plus
Run ID: 037f9490-0fd7-4010-bc1a-a06809f8e287
📒 Files selected for processing (12)
.changeset/home-page-predefined-cards.mdapp-config.yamlpackages/portal-app/src/components/Home/HomePage.tsxpackages/portal-app/src/components/Home/RecentDeploymentsCard.tsxpackages/portal-app/src/components/Home/RecentlyVisitedCard.tsxpackages/portal-app/src/components/Home/cards/configs.tspackages/portal-app/src/components/Home/cards/index.tspackages/portal-app/src/components/Home/cards/registry.tsxpackages/portal-app/src/components/Home/cards/types.tspackages/portal-app/src/components/Home/relativeTime.tspackages/portal-app/src/components/Home/styles.tsplugins/openchoreo-common/config.d.ts
Signed-off-by: isuruRuhu <isuru.ruhu@gmail.com>
Purpose
The portal home page currently hard-codes its layout. This adds a config-driven, predefined card system so the set and arrangement of home-page cards can be selected per deployment via app-config, plus one new card (Recent Deployments).
Approach
packages/portal-app/src/components/Home/cards/): each card is a registry entry (component, optional permission-gated visibility hook); a named layout config lists the cards and their grid sizes.openchoreo.home.cardConfig(new frontend-visible config key in@openchoreo/backstage-plugin-common) selects the layout, falling back tochoreo-defaultfor unknown names.relativeTimehelper extracted fromRecentlyVisitedCard(also used by the new card).Existing deployments keep working with no config change (default layout is
choreo-default, matching the current page).No component redesigns in this PR — the existing widgets render as they are today.
Release note
The home page's cards are now config-driven:
openchoreo.home.cardConfigselects a predefined card layout. A Recent Deployments card was added.Automation tests
tscclean; lint + prettier clean.Security checks
Summary by CodeRabbit