Skip to content

[CSM Portal] gate case reassign while work is in-progress + ongoing - #1039

Merged
Rashmika998 merged 1 commit into
wso2-open-operations:v2from
rksk:csm-gate-reassign-wip-ongoing
Jul 4, 2026
Merged

[CSM Portal] gate case reassign while work is in-progress + ongoing#1039
Rashmika998 merged 1 commit into
wso2-open-operations:v2from
rksk:csm-gate-reassign-wip-ongoing

Conversation

@rksk

@rksk rksk commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What

Disable the Assign / reassign engineer overflow action on the case detail page when the case is Work in progress with an ongoing work-state, and add a tooltip explaining why.

Why

The backend rejects an assignee change on a WIP + ongoing case: it silently reverts the change and still returns 200 success. The portal therefore showed a "Case reassigned" success toast while the assignee never actually changed — a confusing false success.

Rather than fire a request we know will no-op, we gate the action in the UI. The tooltip tells the user to pause the work first (via the existing Pause action, available to the current assignee) or have a lead handle the reassignment.

Notes

  • This is a case-state gate, mirroring the existing state-based enablement of the pause/resume action. It is not a data-source gate.
  • Interim guard: a backend change to surface the rejection as a real error (instead of a false success) is tracked separately. Once that lands, this UI gate can be revisited.

Testing

  • pnpm test — added 3 cases to CaseActionBar.test.tsx (disabled when WIP+ongoing and no dispatch on click; enabled when paused; enabled for non-WIP states). Full file passes (11/11).
  • pnpm build — passes.
  • pnpm lint — the changed file is clean (the 2 remaining repo lint errors are pre-existing on v2 in unrelated files).

Summary by CodeRabbit

  • Bug Fixes
    • Prevented reassignment of an engineer when a case is actively in progress, avoiding actions that would have no effect.
    • Added clearer hover guidance for disabled actions in the overflow menu.
    • Kept reassignment available in paused or non-in-progress states, with the action behaving as expected.

The backend rejects an assignee change on a case that is Work in progress
with an ongoing work-state: it silently reverts the change and still returns
success, so the portal would show "Case reassigned" while the assignee stays
put. Disable the "Assign / reassign engineer" overflow action under those
conditions and add a tooltip explaining that the work must be paused first
(by the current assignee) or the reassignment handled by a lead.

This mirrors the existing state-based enablement of the pause/resume action;
it is a case-state gate, not a data-source gate. A backend change to surface
the rejection as a real error is tracked separately.
@rksk rksk added the Type/Bug Identifies a bug in the project label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a gating condition to the "Assign / Reassign engineer" overflow menu item in CaseActionBar, disabling it when a case is work_in_progress with ongoing workState, and introduces a tooltip mechanism to explain the disabled state. Corresponding tests verify the enabled/disabled behavior across state combinations.

Changes

Reassign Engineer Gating

Layer / File(s) Summary
Reassign blocking logic and tooltip support
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx
SecondaryItem gains an optional tooltip field; buildSecondaryItems computes reassignBlocked for work_in_progress + workState === "ongoing" and disables the reassign_engineer item with a tooltip message; overflow menu rendering wraps disabled items with Tooltip and a non-interactive wrapper so tooltips fire despite the disabled MenuItem.
Gating test coverage
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx
Adds a helper to open the reassign menu item and tests confirming the item is disabled (and non-actionable) when ongoing/work_in_progress, and enabled (and actionable) when paused or in non-work_in_progress states.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • wso2-open-operations/cs-tools#893: Both PRs modify the same CaseActionBar reassign_engineer overflow menu item; #893 implements the base action/assignment flow that this PR adds gating and tooltip logic on top of.

Suggested reviewers: cloby99, dilshanfardil

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the core why, what, notes, and testing, but it omits most required template sections like docs, release note, and security. Add the missing template sections, especially Purpose, Goals, Approach, Release note, Documentation, Security checks, and Test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: gating case reassignment when work is in progress and ongoing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

@rksk

rksk commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews resumed.

@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/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx (1)

230-247: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider asserting the tooltip message itself is shown, not just the disabled state.

The three new tests validate aria-disabled and click-blocking, but none confirm the tooltip text actually renders for the blocked case — the explanatory tooltip is the feature this PR is adding on top of the gate.

✅ Example addition to the first test
     const item = openReassignItem();
     expect(item).toHaveAttribute("aria-disabled", "true");
+    fireEvent.mouseOver(item);
+    expect(
+      await screen.findByText(/pause the work first/i),
+    ).toBeInTheDocument();
     fireEvent.click(item);
     expect(onAction).not.toHaveBeenCalled();
🤖 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/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx`
around lines 230 - 247, The new reassign gate test only checks aria-disabled and
click blocking, but it does not verify the tooltip that explains the
restriction. Update the CaseActionBar test around openReassignItem to also
assert the tooltip text is rendered/shown for the Work in progress + Ongoing
case, so the new explanatory UI is covered in addition to the disabled state.
🤖 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/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx`:
- Around line 230-247: The new reassign gate test only checks aria-disabled and
click blocking, but it does not verify the tooltip that explains the
restriction. Update the CaseActionBar test around openReassignItem to also
assert the tooltip text is rendered/shown for the Work in progress + Ongoing
case, so the new explanatory UI is covered in addition to the disabled state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 16528b38-6197-40d7-8e84-aff888e68d7a

📥 Commits

Reviewing files that changed from the base of the PR and between 265fd90 and 00b1f4a.

📒 Files selected for processing (2)
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants