[CSM Portal] case-create project search, deployed-product labels, dashboard count cells - #871
Conversation
…hboard count cells
- Case create: replace the eager full-catalogue project Select with a
type-ahead AsyncProjectSelect that searches the backend as the user types,
so the page no longer loads hundreds of projects up front.
- Deployed-product picker: read the embedded product/version objects the
backend now returns and build "{product} {version}" labels directly,
dropping the obsolete per-product name/version resolution calls.
- Case list: filter panel now starts expanded.
- Dashboard case-counts matrix: render 0 cells with the same styling and
link treatment as non-zero counts for a consistent grid.
|
Warning Review limit reached
More reviews will be available in 57 minutes and 24 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughUpdates ChangesCSM Portal: deployed-product enrichment, async project picker, and case detail refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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.
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
`@apps/csm-portal/webapp/src/features/csm-cases/components/AsyncProjectSelect.tsx`:
- Around line 57-58: Search failures from the useProjectSearch hook are
currently being treated as empty results, displaying "No projects found" instead
of surfacing the actual error to the user. In AsyncProjectSelect.tsx at line
57-58, destructure an error state from the useProjectSearch hook call alongside
data and isFetching. Then in the rendering logic at lines 102-115, check for the
error state and conditionally display an error message instead of the
empty-results message when a search failure occurs. This ensures users see an
explicit failure state with a clear recovery path rather than a misleading empty
results state.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fd24ecf9-db48-478e-8411-d3c89d5d66bd
📒 Files selected for processing (6)
apps/csm-portal/webapp/src/api/backend/types.tsapps/csm-portal/webapp/src/features/csm-cases/api/useDeployedProductOptions.tsapps/csm-portal/webapp/src/features/csm-cases/components/AsyncProjectSelect.tsxapps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseCreatePage.tsxapps/csm-portal/webapp/src/features/csm-cases/pages/CsmCasesPage.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/CaseCountsMatrix.tsx
A failed project search collapsed into the "No projects found" empty state, which is misleading and (since project is required) blocks case creation with no signal it was a failure. Surface isError as an explicit "Could not load projects" / field error with a retry hint; typing re-runs the query.
…ix account hydration
- Fix account hydration: GET /projects/{id} embeds the account (id, name,
tier, region) under `account`, but the detail builder read a non-existent
top-level `accountId`, so the customer and tier never resolved. Read the
embedded account directly and drop the redundant /accounts/{id} call.
- Tier now reflects the real account tier (basic/enterprise) instead of a
hardcoded value; align CustomerTier and its label/colour maps accordingly
(tier stays off the brand accent).
- Overview box: replace the Version cell (version already shows in the product
label) with a Project type cell, derived for now from the second
" - "-delimited segment of the project name.
- Reorder overview cells: Account, Project, Project type, Deployment, Product.
|
@coderabbitai review |
✅ Action performedReview finished.
|
POST /cases returns { message, case: { id, ... } }, but the mutation typed the
response as a bare case and read `created.id`, so it was undefined and the
redirect went to /cases/undefined. Unwrap the envelope and return the inner
case. The envelope has no projectId, so the project-scoped search invalidation
now uses the submitted payload's projectId.
…ree-form tier
The CaseView embeds the account as { id, name, type }, where `type` is the
account/support tier ("Enterprise" for ServiceNow-sourced cases — a free-form
string, not the PG basic|enterprise enum). Two fixes:
- Read account (name + tier) straight off the CaseView instead of fetching the
project detail; drops a network hop and resolves the customer + tier from the
one /cases/{id} response.
- Tolerate free-form tier values: CustomerTier is now a string, and the closed
TIER_LABEL/TIER_COLOR maps become tierLabel()/tierColor() helpers that
title-case any value and fall back to a neutral colour. This fixes the page
crash where an unmapped tier left SemanticChip reading `.main` off undefined.
- Harden SemanticChip itself to degrade an unknown role to the outlined default
chip rather than throwing.
Tier still shows in the Overview band and the Customer widget; the chip above the subject was redundant.
What
Frontend-only changes to the CSM portal.
Case create page
AsyncProjectSelectthat queries the backend as the user types (debounced, first page of matches only), mirroring the existing async project filter on the case list.productandversionobjects, but the option builder was reading flat fields that don't exist in that shape, so every option collapsed to a genericProductlabel. It now reads the embedded objects and renders"{product name} {version}"directly. This also removes the obsolete secondary lookups (paging/products/searchand a per-product versions search), so the dropdown populates from the single deployed-products call.Case list page
Dashboard
0cells now use the same size, weight, and link treatment as non-zero counts, so the grid reads consistently instead of muting the zeros.Notes
BeDeployedProducttype was corrected to match the nested shape the backend actually returns.pnpm lintandpnpm build.Summary by CodeRabbit
New Features
UI/UX Improvements
Data & Display Updates