Skip to content

Add continuous action labels and chat routing - #243

Merged
shayanmalinda merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
dileepapeiris:feat/add-fix-small-issues
Feb 24, 2026
Merged

shayanmalinda merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
dileepapeiris:feat/add-fix-small-issues

Conversation

@dileepapeiris

@dileepapeiris dileepapeiris commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Introduce toPresentContinuousActionLabel util and tests to show present-continuous labels (e.g., "Closing...") for pending case actions. Update CaseDetailsActionRow to track the pending action label, display the continuous label while an action is pending, and clear it on settle to avoid incorrect button text. Add conditional chat routing in CasesTable using getNoveraChatEnabled to navigate to the appropriate chat or create-case flow. Trim activation/deactivation date values in ProjectInformationCard before formatting to prevent whitespace-related display issues. Includes corresponding unit tests for the new label mappings.

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features

    • Enhanced case creation workflow with improved routing based on chat enablement.
    • Added visual feedback for support case actions—displays action status (e.g., "Closing...") while processing.
  • Bug Fixes

    • Improved handling of empty or invalid date fields in project information to display consistently.

Introduce toPresentContinuousActionLabel util and tests to show present-continuous labels (e.g., "Closing...") for pending case actions. Update CaseDetailsActionRow to track the pending action label, display the continuous label while an action is pending, and clear it on settle to avoid incorrect button text. Add conditional chat routing in CasesTable using getNoveraChatEnabled to navigate to the appropriate chat or create-case flow. Trim activation/deactivation date values in ProjectInformationCard before formatting to prevent whitespace-related display issues. Includes corresponding unit tests for the new label mappings.
@coderabbitai

coderabbitai Bot commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR enhances case management UX by introducing pending action state tracking in the case details header, adding a utility function for present-continuous action labels, implementing conditional routing in case creation based on Novera chat enablement, and improving date string validation robustness in project information display.

Changes

Cohort / File(s) Summary
Case Action State & UI
apps/customer-portal/webapp/src/components/support/case-details/header/CaseDetailsActionRow.tsx
Adds local pendingActionLabel state to track pending operations. Updates action button logic to disable based on pending state, display continuous-form labels while pending, and show progress indicator. Integrates toPresentContinuousActionLabel for dynamic label rendering.
Support Utility Functions
apps/customer-portal/webapp/src/utils/support.ts, apps/customer-portal/webapp/src/utils/__tests__/support.test.ts
Introduces new exported toPresentContinuousActionLabel() function mapping action labels to present-continuous forms (e.g., "Closed" → "Closing..."). Includes comprehensive test coverage for label mappings and fallback behavior.
Case Creation Routing
apps/customer-portal/webapp/src/components/dashboard/cases-table/CasesTable.tsx
Adds handleCreateCase() handler that conditionally routes to either chat/describe-issue (when Novera chat enabled) or chat/create-case with skipChat: true. Uses getNoveraChatEnabled to determine route path.
Date String Handling
apps/customer-portal/webapp/src/components/project-details/project-overview/project-information/ProjectInformationCard.tsx
Strengthens date string validation by trimming whitespace before formatting. Returns "--" placeholder for empty or whitespace-only date values instead of attempting formatting on invalid strings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

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

Suggested reviewers

  • Rashmika998
  • v15a1
  • shayanmalinda

Poem

🐰 A rabbit hops through pending states,
Where actions now await their fates,
With labels flowing like a stream,
And dates that trim to gleam,
The chat route hops—describe with glee! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. While it provides a brief summary of changes at the top, all required template sections (Purpose, Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Related PRs, Migrations, Test environment, Learning) contain only template placeholders with no substantive content filled in. Fill in all required template sections with appropriate content: provide issue links in Purpose, describe solutions in Goals, explain implementation approach with any UI details, summarize user stories, add a release note, document any API/documentation impact, and confirm security and test coverage details.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add continuous action labels and chat routing' clearly and concisely summarizes the two main changes: the new continuous action labels utility and the chat routing conditional logic.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@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 (3)
apps/customer-portal/webapp/src/components/project-details/project-overview/project-information/ProjectInformationCard.tsx (1)

48-55: Redundant double .trim() call — store the trimmed value once.

val?.trim() is called twice: once as a truthiness check and once as the argument to formatProjectDate. Storing the trimmed value avoids the duplication.

♻️ Suggested simplification
-  const getStartDate = () => {
-    const val = project?.account?.activationDate;
-    return val?.trim() ? formatProjectDate(val.trim()) : "--";
-  };
-  const getEndDate = () => {
-    const val = project?.account?.deactivationDate;
-    return val?.trim() ? formatProjectDate(val.trim()) : "--";
-  };
+  const getStartDate = () => {
+    const val = project?.account?.activationDate?.trim();
+    return val ? formatProjectDate(val) : "--";
+  };
+  const getEndDate = () => {
+    const val = project?.account?.deactivationDate?.trim();
+    return val ? formatProjectDate(val) : "--";
+  };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/customer-portal/webapp/src/components/project-details/project-overview/project-information/ProjectInformationCard.tsx`
around lines 48 - 55, In getStartDate and getEndDate, avoid trimming the same
string twice: read the raw date (project?.account?.activationDate /
deactivationDate) into a variable, compute a single trimmed value (e.g., trimmed
= raw?.trim()), then use that trimmed value for the truthiness check and pass it
to formatProjectDate; update getStartDate and getEndDate to use the trimmed
variable instead of calling val?.trim() twice.
apps/customer-portal/webapp/src/utils/support.ts (1)

840-849: Consider extracting the label map as a module-level constant.

The map object is reallocated on every call. While the map is small and the impact is negligible, extracting it as a module-level const (the same improvement also applies to toPresentTenseActionLabel) avoids repeated allocation and makes the mapping directly visible at the module level.

♻️ Suggested refactor
+const PRESENT_CONTINUOUS_ACTION_LABEL_MAP: Record<string, string> = {
+  Closed: "Closing...",
+  Reopened: "Reopening...",
+  "Waiting on WSO2": "Waiting on WSO2...",
+  "Waiting On WSO2": "Waiting on WSO2...",
+  "Accept Solution": "Accepting...",
+  "Reject Solution": "Rejecting...",
+};
+
 export function toPresentContinuousActionLabel(label: string): string {
-  const map: Record<string, string> = {
-    Closed: "Closing...",
-    Reopened: "Reopening...",
-    "Waiting on WSO2": "Waiting on WSO2...",
-    "Waiting On WSO2": "Waiting on WSO2...",
-    "Accept Solution": "Accepting...",
-    "Reject Solution": "Rejecting...",
-  };
-  return map[label] ?? `${label}...`;
+  return PRESENT_CONTINUOUS_ACTION_LABEL_MAP[label] ?? `${label}...`;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/webapp/src/utils/support.ts` around lines 840 - 849,
Extract the inline mapping object in toPresentContinuousActionLabel into a
module-level constant (e.g., PRESENT_CONTINUOUS_ACTION_LABEL_MAP) and have the
function reference that constant instead of recreating the map on each call; do
the same refactor for toPresentTenseActionLabel (e.g.,
PRESENT_TENSE_ACTION_LABEL_MAP) so both functions use preallocated module-level
objects for their lookups.
apps/customer-portal/webapp/src/utils/__tests__/support.test.ts (1)

367-384: Missing test cases for "Waiting on WSO2" mapping and the fallback.

The new test suite covers 4 of the 6 explicit mappings. Two gaps:

  1. "Waiting on WSO2" → "Waiting on WSO2..." — this label is actually returned by getAvailableCaseActions and rendered in CaseDetailsActionRow, so leaving it untested is a real coverage gap.
  2. Fallback case — toPresentTenseActionLabel has an equivalent test ("Accept Solution" returns unchanged); the continuous variant has no test for an unmapped label (e.g., "Open Related Case" → "Open Related Case...").
✅ Suggested additions
+    it("should map Waiting on WSO2 to Waiting on WSO2...", () => {
+      expect(toPresentContinuousActionLabel("Waiting on WSO2")).toBe(
+        "Waiting on WSO2...",
+      );
+    });
+    it("should append ... for unmapped labels", () => {
+      expect(toPresentContinuousActionLabel("Open Related Case")).toBe(
+        "Open Related Case...",
+      );
+    });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/webapp/src/utils/__tests__/support.test.ts` around lines
367 - 384, Add two missing tests for toPresentContinuousActionLabel: one
asserting "Waiting on WSO2" maps to "Waiting on WSO2..." and one asserting an
unmapped label (e.g., "Open Related Case") falls back to appending "..." (so
"Open Related Case" -> "Open Related Case..."). Place them in the same
describe("toPresentContinuousActionLabel", ...) block in support.test.ts
alongside the existing cases so the behavior in getAvailableCaseActions /
CaseDetailsActionRow is covered and the fallback path is validated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/customer-portal/webapp/src/components/project-details/project-overview/project-information/ProjectInformationCard.tsx`:
- Around line 48-55: In getStartDate and getEndDate, avoid trimming the same
string twice: read the raw date (project?.account?.activationDate /
deactivationDate) into a variable, compute a single trimmed value (e.g., trimmed
= raw?.trim()), then use that trimmed value for the truthiness check and pass it
to formatProjectDate; update getStartDate and getEndDate to use the trimmed
variable instead of calling val?.trim() twice.

In `@apps/customer-portal/webapp/src/utils/__tests__/support.test.ts`:
- Around line 367-384: Add two missing tests for toPresentContinuousActionLabel:
one asserting "Waiting on WSO2" maps to "Waiting on WSO2..." and one asserting
an unmapped label (e.g., "Open Related Case") falls back to appending "..." (so
"Open Related Case" -> "Open Related Case..."). Place them in the same
describe("toPresentContinuousActionLabel", ...) block in support.test.ts
alongside the existing cases so the behavior in getAvailableCaseActions /
CaseDetailsActionRow is covered and the fallback path is validated.

In `@apps/customer-portal/webapp/src/utils/support.ts`:
- Around line 840-849: Extract the inline mapping object in
toPresentContinuousActionLabel into a module-level constant (e.g.,
PRESENT_CONTINUOUS_ACTION_LABEL_MAP) and have the function reference that
constant instead of recreating the map on each call; do the same refactor for
toPresentTenseActionLabel (e.g., PRESENT_TENSE_ACTION_LABEL_MAP) so both
functions use preallocated module-level objects for their lookups.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b469ddd and 22456ea.

📒 Files selected for processing (5)
  • apps/customer-portal/webapp/src/components/dashboard/cases-table/CasesTable.tsx
  • apps/customer-portal/webapp/src/components/project-details/project-overview/project-information/ProjectInformationCard.tsx
  • apps/customer-portal/webapp/src/components/support/case-details/header/CaseDetailsActionRow.tsx
  • apps/customer-portal/webapp/src/utils/__tests__/support.test.ts
  • apps/customer-portal/webapp/src/utils/support.ts

Comment on lines +844 to +845
"Waiting on WSO2": "Waiting on WSO2...",
"Waiting On WSO2": "Waiting on WSO2...",

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.

Why do we have 02 different conventions to these keys? on and On?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because of data inconsisistensy , will adress in later

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.

Created an issue to track this
#244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants