Skip to content

[CSM Portal] Deployment management + deployed-products view - #958

Merged
Rashmika998 merged 3 commits into
wso2-open-operations:v2from
rksk:csm-portal-deployment-management
Jun 26, 2026
Merged

Rashmika998 merged 3 commits into
wso2-open-operations:v2from
rksk:csm-portal-deployment-management

Conversation

@rksk

@rksk rksk commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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)

  • List a project's deployments (POST /deployments/search): name, type, description, created/updated.
  • Edit name/description and deactivate a deployment via the new PATCH /deployments/{id} (active:false).
  • Details modal: clicking a row (or its "View details" action) opens a read-only 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.
  • Bug fix: the case overview's Product cell was empty when a case had no linked deployed-product but did have a product ref. The detail mapper now falls back to the CaseView.product name.

Deliberately deferred (no BE endpoints yet)

  • Create deployment and change a deployment's type — both require the ServiceNow deployment-type integer (typeKey), which no endpoint exposes (search only returns the string label). Unlike case create/update, the deployment endpoints pass the raw SN integer through.
  • Managing deployed products (add / re-version / remove) — deployed products are search-only on both the backend and entity service.

Also includes

A small first commit fixing pre-existing breakage on v2 left by the engagements-UI merge (so this branch's CI is green):

  • a casesFiltersUrl unit test not updated for the new engagementTypes field, and
  • a blocking react-hooks lint error in CsmCaseDetailPage (detailPath missing from an onAction dependency array).

Testing

pnpm lint (0 errors), pnpm build, and pnpm test (96 passing, incl. new EditDeploymentDialog tests) all green.

Summary by CodeRabbit

  • New Features

    • Added a new Deployments tab on project pages to view deployment details and related deployed products.
    • Users can now open an in-page deployment details dialog from case and project views.
    • Deployment details can be edited directly, including name and description, and deployments can be deactivated from the UI.
  • Bug Fixes

    • Improved case product display by falling back to a linked product name when the primary deployment label is missing.
    • Fixed filter parsing so empty engagement types are handled consistently.

rksk added 2 commits June 26, 2026 16:16
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.
@rksk rksk added App/CSM Portal Area/Frontend Type/New Feature Represents a request or task for a new feature labels Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rksk, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9aa615d8-69ad-480a-bdfb-0029292da9fb

📥 Commits

Reviewing files that changed from the base of the PR and between 12363db and 7132d3e.

📒 Files selected for processing (9)
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseMetaBand.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/api/useCreateDeployment.ts
  • apps/csm-portal/webapp/src/features/csm-projects/api/useUpdateDeployment.ts
  • apps/csm-portal/webapp/src/features/csm-projects/components/CreateDeploymentDialog.test.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/CreateDeploymentDialog.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.test.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.tsx
📝 Walkthrough

Walkthrough

The PR adds deployment-aware case detail rendering, a deployment details dialog with deployed products, and a new Deployments tab with edit and deactivate actions.

Changes

Deployment detail and management UI

Layer / File(s) Summary
Deployment contracts
apps/csm-portal/webapp/src/api/backend/types.ts
Backend deployment types add update payload and response shapes, renamed timestamps, and string-based deployed-product sizing fields.
Deployment viewer
apps/csm-portal/webapp/src/features/csm-projects/utils/deployments.ts, apps/csm-portal/webapp/src/features/csm-projects/api/useSearchDeployedProducts.ts, apps/csm-portal/webapp/src/features/csm-projects/components/DeployedProductsPanel.tsx, apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentDetailsDialog.tsx
Deployment date and type helpers, the deployed-product search hook, and the details dialog load deployment products and render metadata, labels, and sizing rows.
Case deployment link
apps/csm-portal/webapp/src/api/backend/types.ts, apps/csm-portal/webapp/src/features/csm-cases/types/csmCases.ts, apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCaseDetail.ts, apps/csm-portal/webapp/src/features/csm-cases/components/CaseMetaBand.tsx, apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
Case detail now carries deploymentId, falls back from deployed-product labels to product names, and renders the deployment field as a dialog trigger.
Deployments tab
apps/csm-portal/webapp/src/features/csm-projects/pages/CsmProjectDetailPage.tsx, apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsx
The project detail page adds a Deployments tab, and the tab renders deployment rows with loading, error, empty, and action-menu states.
Deployment updates
apps/csm-portal/webapp/src/features/csm-projects/api/useUpdateDeployment.ts, apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsx, apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.tsx, apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.test.tsx
The update hook, tab mutation handlers, edit dialog, and tests patch deployment details, deactivate deployments, and render the related dialogs.

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
Loading

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

Type/UX

Suggested reviewers

  • cloby99
  • Rashmika998

Poem

Hop hop, I found a tab for deployments tonight,
With dialogs of dates and product rows in sight.
A click, a patch, a neat refetch dance—
My whiskers twitch at the code's little prance.
🐇 Carrots for everyone, and the UI feels bright.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is on-topic, but it does not follow the required template and omits many mandatory sections. Rewrite the PR body to match the template and fill in Purpose, Goals, Approach, User stories, Release note, Documentation, tests, security, and other required sections.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately captures the main change: deployment management plus the deployed-products view.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3a98caa and 12363db.

📒 Files selected for processing (15)
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCaseDetail.ts
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseMetaBand.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/pages/CsmCaseDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/types/csmCases.ts
  • apps/csm-portal/webapp/src/features/csm-cases/utils/casesFiltersUrl.test.ts
  • apps/csm-portal/webapp/src/features/csm-projects/api/useSearchDeployedProducts.ts
  • apps/csm-portal/webapp/src/features/csm-projects/api/useUpdateDeployment.ts
  • apps/csm-portal/webapp/src/features/csm-projects/components/DeployedProductsPanel.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentDetailsDialog.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/DeploymentsTab.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.test.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/components/EditDeploymentDialog.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/pages/CsmProjectDetailPage.tsx
  • apps/csm-portal/webapp/src/features/csm-projects/utils/deployments.ts

Comment thread apps/csm-portal/webapp/src/api/backend/types.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).
@rksk

rksk commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Rashmika998
Rashmika998 merged commit 3e0cc9f into wso2-open-operations:v2 Jun 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/CSM Portal Area/Frontend Type/New Feature Represents a request or task for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants