[CSM Portal] Deployment management + deployed-products view - #958
Conversation
The engagements UI merge left v2 with a failing unit test and a blocking lint error: - casesFiltersUrl.test.ts: the 'fully-populated query string' case was not updated for the new engagementTypes field the parser now returns ([] when the query carries no engagement-type param). - CsmCaseDetailPage.tsx: detailPath is referenced inside the onAction useCallback but was missing from its dependency array (react-hooks/ preserve-manual-memoization error).
Deployments tab on the project detail page (Customers > Projects > project):
- List a project's deployments via POST /deployments/search.
- Edit a deployment's name/description and deactivate it via the new
PATCH /deployments/{id} (active:false) endpoint. Deployment type and
create are deferred: they need the ServiceNow type->key integer, which no
endpoint exposes yet.
- Click a row (or the row's 'View details' action) to open a read-only
details modal listing the deployment's deployed products
(POST /deployments/{id}/products/search): product, version, support EOL,
cores, TPS, category.
Case overview: the deployment field in CaseMetaBand is now a button that
opens the same deployment-details modal when the case carries a deploymentId.
Fixes the empty Product cell on the case overview: the mapper now falls back
to the CaseView 'product' ref name when no deployedProduct is linked.
Shared date formatting via formatDeploymentDate (timezone-aware) and blank
sizing values render as a dash.
|
Warning Review limit reached
More reviews will be available in 36 minutes and 10 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 To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. 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)
📝 WalkthroughWalkthroughThe PR adds deployment-aware case detail rendering, a deployment details dialog with deployed products, and a new Deployments tab with edit and deactivate actions. ChangesDeployment detail and management UI
Sequence Diagram(s)Deployment details flow sequenceDiagram
participant User
participant CsmProjectDetailPage
participant DeploymentsTab
participant DeploymentDetailsDialog
participant useSearchDeployedProducts
participant useBackendApi
User->>CsmProjectDetailPage: open Deployments tab
CsmProjectDetailPage->>DeploymentsTab: render projectId
User->>DeploymentsTab: click View details
DeploymentsTab->>DeploymentDetailsDialog: show deployment
DeploymentDetailsDialog->>useSearchDeployedProducts: load products by deploymentId
useSearchDeployedProducts->>useBackendApi: POST /deployments/{id}/products/search
useBackendApi-->>useSearchDeployedProducts: deployedProducts pages
useSearchDeployedProducts-->>DeploymentDetailsDialog: products list
DeploymentDetailsDialog-->>User: render metadata and table
Deployment update flow sequenceDiagram
participant User
participant DeploymentsTab
participant EditDeploymentDialog
participant useUpdateDeployment
participant useBackendApi
User->>DeploymentsTab: choose Edit details or Deactivate
alt Edit details
DeploymentsTab->>EditDeploymentDialog: show dialog
User->>EditDeploymentDialog: save changes
EditDeploymentDialog->>DeploymentsTab: onSave(payload)
DeploymentsTab->>useUpdateDeployment: PATCH name/description
else Deactivate
DeploymentsTab->>DeploymentsTab: open deactivate confirmation
User->>DeploymentsTab: confirm Deactivate
DeploymentsTab->>useUpdateDeployment: PATCH active:false
end
useUpdateDeployment->>useBackendApi: PATCH /deployments/{id}
useBackendApi-->>useUpdateDeployment: BeDeploymentUpdateResponse
useUpdateDeployment-->>DeploymentsTab: invalidate DEPLOYMENTS query
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/api/backend/types.ts`:
- Around line 682-701: `BeDeploymentUpdatePayload` currently allows empty detail
updates and mixed deactivation/detail fields, so tighten the shapes in
`BeDeploymentDetailUpdatePayload` and `BeDeploymentDeactivatePayload` to be
mutually exclusive and non-empty. In the types around
`BeDeploymentUpdatePayload`, use `never`-based exclusions so deactivation can
only be `{ active: false }` with no other keys, and make detail updates require
at least one of `name` or `description` while preventing `active` from appearing
in that variant.
In `@apps/csm-portal/webapp/src/features/csm-cases/components/CaseMetaBand.tsx`:
- Around line 300-309: The DeploymentDetailsDialog is receiving
product.deploymentCategory as its type value, but that prop is meant for
BeDeploymentType and can render incorrect lowercase labels for categories like
qa, stress, or uat. Update the CaseMetaBand deployment object to either map the
category to a valid BeDeploymentType in this render path or remove the type
field entirely when the exact deployment type is not known. Use the
DeploymentDetailsDialog and deploymentTypeLabel usage to locate the fix.
In
`@apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsx`:
- Around line 139-143: The error feedback in DeploymentsTab is rendered in the
page-level Alert while the edit/deactivate dialog stays open, so failures are
hidden behind the modal backdrop. Update handleSaveEdit and handleDeactivate to
either close the dialog before setting feedback on error or move the feedback
display into the active dialog, using the existing editing, deactivating, and
feedback state so the user can actually see the error.
🪄 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: a92ef77e-c22e-4874-a150-2c9483e22a8b
📒 Files selected for processing (15)
apps/csm-portal/webapp/src/api/backend/types.tsapps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCaseDetail.tsapps/csm-portal/webapp/src/features/csm-cases/components/CaseMetaBand.tsxapps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsxapps/csm-portal/webapp/src/features/csm-cases/types/csmCases.tsapps/csm-portal/webapp/src/features/csm-cases/utils/casesFiltersUrl.test.tsapps/csm-portal/webapp/src/features/csm-projects/api/useSearchDeployedProducts.tsapps/csm-portal/webapp/src/features/csm-projects/api/useUpdateDeployment.tsapps/csm-portal/webapp/src/features/csm-projects/components/DeployedProductsPanel.tsxapps/csm-portal/webapp/src/features/csm-projects/components/DeploymentDetailsDialog.tsxapps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsxapps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.test.tsxapps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.tsxapps/csm-portal/webapp/src/features/csm-projects/pages/CsmProjectDetailPage.tsxapps/csm-portal/webapp/src/features/csm-projects/utils/deployments.ts
…pen-operations#957 contract) Per PR wso2-open-operations#957 the BE now accepts the string `type` enum (primary_production|staging|qa|stress|uat|development) instead of the old integer typeKey for both POST /deployments and PATCH /deployments/{id}. Type payload changes (types.ts): - BeDeploymentDetailUpdatePayload now includes `type?: BeDeploymentType` and uses a never-based discriminated union so deactivate and detail payloads are mutually exclusive and type-safe (CodeRabbit CR #1). - Add BeDeploymentCreatePayload and BeDeploymentCreateResponse for POST /deployments. EditDeploymentDialog: replace the read-only type chip ("Type changes aren't available yet") with a Select over all 6 BeDeploymentType values. Type is included in change detection and sent in the PATCH payload only when changed. Tests updated accordingly. CreateDeploymentDialog + useCreateDeployment: new dialog (name, type selector, description; projectId locked to context) and mutation hook that POST /deployments and invalidates the project deployment list. "Create deployment" button added to DeploymentsTab. DeploymentsTab: close edit/deactivate dialog before surfacing page-level error alert so the feedback is not hidden behind the modal backdrop (CodeRabbit CR wso2-open-operations#3). CaseMetaBand: cast deploymentCategory to BeDeploymentType when passing to DeploymentDetailsDialog — both unions share identical values; the cast removes the type mismatch without changing runtime behaviour (CodeRabbit CR #2).
|
@coderabbitai review |
✅ Action performedReview finished.
|
What
Adds deployment management and a deployed-products view to the CSM portal, and links the case overview's deployment field to it.
Deployments tab (Customers → Projects → project)
POST /deployments/search): name, type, description, created/updated.PATCH /deployments/{id}(active:false).POST /deployments/{id}/products/search): product, version, support EOL, cores, TPS, category.Case overview
CaseMetaBandis now a button that opens the same deployment-details modal when the case carries adeploymentId.productref. The detail mapper now falls back to theCaseView.productname.Deliberately deferred (no BE endpoints yet)
typeKey), which no endpoint exposes (search only returns the string label). Unlike case create/update, the deployment endpoints pass the raw SN integer through.Also includes
A small first commit fixing pre-existing breakage on
v2left by the engagements-UI merge (so this branch's CI is green):casesFiltersUrlunit test not updated for the newengagementTypesfield, andreact-hookslint error inCsmCaseDetailPage(detailPathmissing from anonActiondependency array).Testing
pnpm lint(0 errors),pnpm build, andpnpm test(96 passing, incl. newEditDeploymentDialogtests) all green.Summary by CodeRabbit
New Features
Bug Fixes