Skip to content

[Customer Portal][FE][Web] Enhance Dashboard Cases Table and Add Configurable Sorting for Change Requests - #726

Merged
Rashmika998 merged 5 commits into
wso2-open-operations:mainfrom
dileepapeiris:BT-Tasks-V3
May 25, 2026
Merged

Rashmika998 merged 5 commits into
wso2-open-operations:mainfrom
dileepapeiris:BT-Tasks-V3

Conversation

@dileepapeiris

@dileepapeiris dileepapeiris commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

This pull request introduces improvements to the dashboard cases table and adds configurable sorting to the change requests list in the operations section. The main changes include a new utility for formatting case identifiers, updates to display logic and tests, and the implementation of user-selectable sorting for change requests.

Dashboard Cases Table Improvements:

  • Added a new utility function, formatCasesTableCaseIdentifier, which formats the display of case numbers and internal IDs in the cases table. This ensures consistent and clear identification, even when one or both values are missing. The cases list component and its tests have been updated to use this function. [1] [2] [3] [4] [5] [6] [7]

Change Requests List Sorting:

  • Added support for sorting the change requests list by either "Updated on" or "Created on" in ascending or descending order. This includes new constants and types for sort options, state management for sort field and order, UI wiring for sort controls, and updates to the request-building logic and tests. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Summary by CodeRabbit

  • New Features
    • Enhanced case identifiers in the dashboard cases table to display both the case reference number and internal ID in a unified format
    • Added sorting capabilities to the change requests list, allowing users to organize results by "Updated on" or "Created on" with flexible sort direction control

Review Change Stack

Add sortField and sortOrder parameters to buildChangeRequestSearchRequest (defaulting to ChangeRequestSortField.UpdatedOn and SortOrder.DESC). Update JSDoc and use the new params in the request's sortBy field so callers can control sorting while preserving previous default behavior.
Introduce sort field and order state to ChangeRequestsPage (session-persisted) and pass them into the search request. Import SortOrder and ChangeRequestSortField, add CHANGE_REQUESTS_SORT_FIELD_OPTIONS, and wire handlers to update sort field/order and reset pagination. Update the list UI props to expose sort options and callbacks. Add/adjust tests to assert default sort (updatedOn desc) and a new test for applying custom sort field and order.
Introduce formatCasesTableCaseIdentifier to build a display string for portal case numbers and WSO2 internal IDs (returns values like "ID: CS-001 | INT-1" and falls back to "ID: --" when missing). Also import ChangeRequestSortField and add ChangeRequestSortFieldOption plus CHANGE_REQUESTS_SORT_FIELD_OPTIONS (UpdatedOn, CreatedOn) to support sorting change requests in the UI.
Import formatCasesTableCaseIdentifier and add unit tests covering its behavior: number + internal id (uses "ID: <number> | <internal>"), missing internal id (returns "ID: <number>"), missing number (returns "ID: <internal>"), and both missing (returns "ID: --"). Ensures the formatter produces the expected prefix, separator, and placeholder.
Use formatCasesTableCaseIdentifier(row.number, row.internalId) instead of rendering `ID: {row.number}` to display the combined case identifier. Added the utility import and updated the unit test fixture to include internalId and assert the combined label (e.g. `ID: CS-001 | INT-001`). This ensures internal IDs are surfaced in the cases table UI and tests reflect the new output.
@dileepapeiris dileepapeiris changed the title Bt tasks v3 [Customer Portal][FE][Web] Enhance Dashboard Cases Table and Add Configurable Sorting for Change Requests May 25, 2026
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds case identifier formatting to the dashboard and introduces parameterized sorting to change request search. The case identifier utility combines case number and internal ID fields into a formatted string, while change request sorting is implemented through utility function parameters, page-level state persistence, and UI controls.

Changes

Case Identifier Formatting and Change Request Sorting

Layer / File(s) Summary
Case identifier formatting utility
apps/customer-portal/webapp/src/features/dashboard/utils/casesTable.ts, apps/customer-portal/webapp/src/features/dashboard/utils/__tests__/casesTable.test.ts
New formatCasesTableCaseIdentifier utility function formats case identifiers by combining optional case number and internal ID fields, with -- fallback when both are missing. Comprehensive test coverage validates all input combinations.
Case list component integration
apps/customer-portal/webapp/src/features/dashboard/components/cases-table/CasesList.tsx, apps/customer-portal/webapp/src/features/dashboard/components/cases-table/__tests__/CasesList.test.tsx
CasesList component imports and uses the new formatting utility to display case identifiers in table Details column. Mock case data and assertions updated to expect formatted output combining case number and internal ID.
Change request sort options definition
apps/customer-portal/webapp/src/features/operations/constants/operationsConstants.ts
New ChangeRequestSortFieldOption type and CHANGE_REQUESTS_SORT_FIELD_OPTIONS constant define available sort fields ("Updated on", "Created on") marked as chronological. Imports ChangeRequestSortField enum for consuming code.
Change requests page sorting integration
apps/customer-portal/webapp/src/features/operations/pages/ChangeRequestsPage.tsx
ChangeRequestsPage adds session-persisted sortField and sortOrder state with defaults, threads values into search request building, implements handlers for sort field/order changes with pagination reset, and connects sort controls to ListResultsBar component.
Change request search sorting support
apps/customer-portal/webapp/src/features/operations/utils/operationsPages.ts, apps/customer-portal/webapp/src/features/operations/utils/__tests__/operationsPages.test.ts
buildChangeRequestSearchRequest utility function accepts new sortField and sortOrder parameters (defaults: UpdatedOn/DESC) and applies them to search payload, replacing hardcoded sort values. Tests verify default behavior and custom sort application.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Type/New Feature, Type/Improvement, Type/Task, App/Customer Portal, Area/Frontend, Platform/Web

Suggested reviewers

  • Rashmika998
  • v15a1
  • cloby99

🐰 A case's ID now shines so bright,
With sorting controls held just right!
The formatter trims and combines with care,
While change requests sort without despair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear overview of changes but does not follow the required template structure with sections like Purpose, Goals, Approach, User Stories, Release Notes, Documentation, Security Checks, and Test Environment. Restructure the description to follow the required template, including mandatory sections such as Purpose (with issue links), Goals, Approach, User Stories, Release Notes, Documentation, and Test Environment information.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: enhancements to the dashboard cases table and the addition of configurable sorting for change requests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@dileepapeiris dileepapeiris self-assigned this May 25, 2026
@dileepapeiris dileepapeiris added Type/Improvement Marks enhancements or improvements to existing features Type/Task General task that does not fit into other categories Type/UX Refers to user experience-related tasks or issues App/Customer Portal Area/Frontend Platform/Web labels May 25, 2026

@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.

🧹 Nitpick comments (1)
apps/customer-portal/webapp/src/features/dashboard/utils/__tests__/casesTable.test.ts (1)

63-87: ⚡ Quick win

Cover null and whitespace-only inputs in formatter tests.

The formatter accepts null and trims input; adding these assertions will lock that contract and prevent regressions.

✅ Suggested test additions
   describe("formatCasesTableCaseIdentifier", () => {
@@
     it("should return ID placeholder when both are missing", () => {
       expect(formatCasesTableCaseIdentifier(undefined, undefined)).toBe(
         "ID: --",
       );
     });
+
+    it("should treat null values as missing", () => {
+      expect(formatCasesTableCaseIdentifier(null, null)).toBe("ID: --");
+    });
+
+    it("should trim whitespace-only values to placeholder", () => {
+      expect(formatCasesTableCaseIdentifier("   ", "  ")).toBe("ID: --");
+    });
   });
🤖 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
`@apps/customer-portal/webapp/src/features/dashboard/utils/__tests__/casesTable.test.ts`
around lines 63 - 87, Add tests covering null and whitespace-only inputs for
formatCasesTableCaseIdentifier: assert that null is treated like undefined
(e.g., formatCasesTableCaseIdentifier(null, "INT-1") => "ID: INT-1" and
formatCasesTableCaseIdentifier(null, null) => "ID: --"), and that values with
only whitespace are trimmed and treated as missing (e.g.,
formatCasesTableCaseIdentifier("  ", " INT-1 ") => "ID: INT-1" and
formatCasesTableCaseIdentifier("CS-001", "  ") => "ID: CS-001"). Use the
existing describe/it structure in casesTable.test.ts and reference the
formatCasesTableCaseIdentifier function name so these assertions lock the
contract.
🤖 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.

Nitpick comments:
In
`@apps/customer-portal/webapp/src/features/dashboard/utils/__tests__/casesTable.test.ts`:
- Around line 63-87: Add tests covering null and whitespace-only inputs for
formatCasesTableCaseIdentifier: assert that null is treated like undefined
(e.g., formatCasesTableCaseIdentifier(null, "INT-1") => "ID: INT-1" and
formatCasesTableCaseIdentifier(null, null) => "ID: --"), and that values with
only whitespace are trimmed and treated as missing (e.g.,
formatCasesTableCaseIdentifier("  ", " INT-1 ") => "ID: INT-1" and
formatCasesTableCaseIdentifier("CS-001", "  ") => "ID: CS-001"). Use the
existing describe/it structure in casesTable.test.ts and reference the
formatCasesTableCaseIdentifier function name so these assertions lock the
contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c08e9806-c771-4c8c-aca6-f9b400c28c94

📥 Commits

Reviewing files that changed from the base of the PR and between c190176 and 229af8b.

📒 Files selected for processing (8)
  • apps/customer-portal/webapp/src/features/dashboard/components/cases-table/CasesList.tsx
  • apps/customer-portal/webapp/src/features/dashboard/components/cases-table/__tests__/CasesList.test.tsx
  • apps/customer-portal/webapp/src/features/dashboard/utils/__tests__/casesTable.test.ts
  • apps/customer-portal/webapp/src/features/dashboard/utils/casesTable.ts
  • apps/customer-portal/webapp/src/features/operations/constants/operationsConstants.ts
  • apps/customer-portal/webapp/src/features/operations/pages/ChangeRequestsPage.tsx
  • apps/customer-portal/webapp/src/features/operations/utils/__tests__/operationsPages.test.ts
  • apps/customer-portal/webapp/src/features/operations/utils/operationsPages.ts

@Rashmika998
Rashmika998 merged commit 2b6b340 into wso2-open-operations:main May 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/Customer Portal Area/Frontend Platform/Web Type/Improvement Marks enhancements or improvements to existing features Type/Task General task that does not fit into other categories Type/UX Refers to user experience-related tasks or issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants