Skip to content

[CSM Portal] Fix case updated-time display, add sort, gate git-issue action - #1119

Merged
Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
rksk:csm-cases-updated-time-and-git-issue-controls
Jul 10, 2026
Merged

[CSM Portal] Fix case updated-time display, add sort, gate git-issue action#1119
Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
rksk:csm-cases-updated-time-and-git-issue-controls

Conversation

@rksk

@rksk rksk commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

The cases list "Updated" column silently rendered a case's creation time whenever the search endpoint omitted updatedOn (confirmed against staging: this is common on real data, not an edge case), mislabeling created-time as updated-time. Separately, "Raise internal Git issue" was clickable regardless of case state, and the Update Level / Public Git Issue fields showed for cloud-subscription projects even though those projects file issues via the repository picker instead.

Goals

  • Never show a case's creation time under an "Updated" label without saying so.
  • Let the user sort the cases list by update recency in either direction.
  • Block filing a Git issue on a case that isn't in an active state, with a clear reason.
  • Hide fields in the Git-issue dialog that don't apply to cloud-subscription projects.
  • Remove a stale "N mine" chip from the cases list header.

Approach

  • CsmCaseRow gains updatedAtIsCreatedFallback; both case-list API hooks set it when the backend didn't return updatedOn, and CasesList prefixes the cell with a plain "Created" label in that case instead of an unlabeled date.
  • Added a TableSortLabel on the "Updated" header, threaded through CsmIssuesViewuseGetCsmCases → the search request's sortBy.order.
  • CaseActionBar disables "Raise internal Git issue" unless the case state is one of Open / Work in progress / Waiting on client / Waiting on WSO2 / Reopened, with an explanatory tooltip (mirrors the existing closed-case gating pattern).
  • CreateGithubIssueDialog hides Update Level / Public Git Issue when showRepoField is true (cloud-subscription projects), inverting the existing repo-picker condition.
  • Removed the unused "mine" chip and its count computation from CsmIssuesView.

Verification

Confirmed directly against the staging backend (authenticated session) that:

  • /cases/search correctly sorts by both createdOn and updatedOn in either direction.
  • updatedOn is genuinely absent from live case rows (not a hypothetical), validating the fallback-display fix.

pnpm build, pnpm test, and pnpm lint all pass on the touched files.

Release note

Cases list now clearly labels a fallback "Created" time when no update timestamp is available, supports sorting by update recency, and blocks filing a Git issue against an inactive case.

Documentation

N/A — internal UI behavior change, no external-facing docs.

Automation tests

  • Unit tests: none added; change is presentational/gating logic on top of existing, already-tested data hooks.
  • Integration tests: N/A, no integration test harness for this app.

Security checks

Samples

N/A

Related PRs

None

Test environment

Verified against the staging CSM portal backend (Choreo) via an authenticated browser session; local typecheck/lint on macOS/Node+pnpm.

Learning

N/A

Summary by CodeRabbit

  • New Features

    • Added sortable “Updated” column for cases, including ascending and descending order.
    • Cases without an update date are now labeled “Created” with the creation timestamp.
    • Git issue actions are available only for supported case states, with clearer guidance when unavailable.
    • Updated issue dialog fields to display appropriately based on case type.
  • Updates

    • Replaced the “Mine” case indicator with a “Breached” indicator for overdue open cases.

…action

Fix the cases list "Updated" column to never mislabel a case's creation
time as an update: when the search view omits updatedOn (common on the
live data), the cell now shows "Created <time>" with a tooltip instead
of silently rendering the created date under the "Updated" heading.
Verified against staging that updatedOn is genuinely absent on live
case rows, and that /cases/search honors createdOn/updatedOn sort in
both directions.

Add a sort toggle on the "Updated" column (asc/desc), since the search
endpoint already supports it.

Disable "Raise internal Git issue" on the case action bar unless the
case is in an active state (Open, Work in progress, Waiting on client,
Waiting on WSO2, Reopened), with a tooltip explaining why when blocked.

Hide the Update Level and Public Git Issue fields in the git-issue
dialog for cloud subscription projects, mirroring how the repository
picker is already shown only for those projects.

Remove the "N mine" chip from the cases list header.
Drop the Tooltip wrapper from the last review — a "Created" text
prefix in front of the relative time is enough to distinguish it from
an actual update; no need for hover-only context.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The CSM cases list now supports server-side ascending or descending sorting, labels created-time fallbacks, restricts Git issue actions to allowed states, and conditionally renders non-cloud GitHub issue fields. The “mine” status chip is removed while breached-case counting remains.

Changes

CSM case sorting and display

Layer / File(s) Summary
Server-side case sorting
apps/csm-portal/webapp/src/features/csm-cases/utils/casesSort.ts, apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCases.ts, apps/csm-portal/webapp/src/features/csm-cases/components/CsmIssuesView.tsx, apps/csm-portal/webapp/src/features/csm-cases/components/CasesList.tsx
Defines sort types and defaults, propagates sort direction through view state and query caching, sends it to /cases/search, and makes the Updated column sortable.
Fallback timestamp labeling
apps/csm-portal/webapp/src/features/csm-cases/types/csmCases.ts, apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCases.ts, apps/csm-portal/webapp/src/features/csm-dashboard/api/useGetMyAssignedOpenCases.ts, apps/csm-portal/webapp/src/features/csm-cases/components/CasesList.tsx
Marks rows whose updated timestamp falls back to creation time and displays those values with a Created prefix.
Git issue action and dialog gating
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx, apps/csm-portal/webapp/src/features/csm-cases/components/CreateGithubIssueDialog.tsx
Restricts internal Git issue actions to an explicit state allowlist and conditionally renders update-level and issue-link fields for non-cloud routing.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CsmIssuesView
  participant CasesList
  participant useGetCsmCases
  participant CasesSearchAPI
  CsmIssuesView->>CasesList: pass current sortOrder and change handler
  CasesList->>CsmIssuesView: request asc or desc toggle
  CsmIssuesView->>useGetCsmCases: query cases with selected sortOrder
  useGetCsmCases->>CasesSearchAPI: POST /cases/search with sortBy.order
  CasesSearchAPI-->>useGetCsmCases: return sorted case results
  useGetCsmCases-->>CsmIssuesView: provide mapped case rows
Loading

Possibly related PRs

Suggested labels: Type/Bug, Type/Improvement

Suggested reviewers: cloby99, Rashmika998

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main changes: timestamp display, sorting, and Git issue gating.
Description check ✅ Passed The description covers the main purpose, goals, approach, release note, tests, and security details, with only some optional sections omitted.
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.
✨ 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 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

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

@Rashmika998
Rashmika998 merged commit 9fc194d into wso2-open-operations:main Jul 10, 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/csm-portal/webapp/src/features/csm-dashboard/api/useGetMyAssignedOpenCases.ts (1)

150-152: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the shared updatedAt fallback logic.

The updatedAt fallback and updatedAtIsCreatedFallback computation are now duplicated identically in useGetCsmCases.ts:241-242 and here at lines 151-152. If the fallback semantics change, both sites must be updated in lockstep. A small shared helper (e.g., in csmCases.ts or a utils module) would keep them aligned.

♻️ Optional: extract a shared fallback helper
// In a shared location, e.g. csmCases.ts or a utils file:
+export function resolveUpdatedAt(
+  updatedOn?: string | null,
+  createdOn?: string | null,
+): { updatedAt: string; updatedAtIsCreatedFallback: boolean } {
+  return {
+    updatedAt: updatedOn ?? createdOn ?? "",
+    updatedAtIsCreatedFallback: !updatedOn && !!createdOn,
+  };
+}

Then in both hooks:

-          updatedAt: c.updatedOn ?? c.createdOn ?? "",
-          updatedAtIsCreatedFallback: !c.updatedOn && !!c.createdOn,
+          ...resolveUpdatedAt(c.updatedOn, c.createdOn),
🤖 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-dashboard/api/useGetMyAssignedOpenCases.ts`
around lines 150 - 152, Extract the shared updatedAt fallback and
updatedAtIsCreatedFallback calculation into a helper in csmCases.ts or an
appropriate utilities module, then use that helper in both
useGetMyAssignedOpenCases and useGetCsmCases to keep the fallback semantics
consistent.
🤖 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/features/csm-cases/components/CaseActionBar.tsx`:
- Around line 248-263: Update GIT_ISSUE_ALLOWED_STATES in CaseActionBar to
include "awaiting_info", preserving the existing normalized state format so the
Git issue action remains enabled for that case state.

---

Nitpick comments:
In
`@apps/csm-portal/webapp/src/features/csm-dashboard/api/useGetMyAssignedOpenCases.ts`:
- Around line 150-152: Extract the shared updatedAt fallback and
updatedAtIsCreatedFallback calculation into a helper in csmCases.ts or an
appropriate utilities module, then use that helper in both
useGetMyAssignedOpenCases and useGetCsmCases to keep the fallback semantics
consistent.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0d241b16-aa5d-4ccb-a61f-165bfe7cbd06

📥 Commits

Reviewing files that changed from the base of the PR and between 9f35af0 and 723b336.

📒 Files selected for processing (8)
  • apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCases.ts
  • apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CasesList.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CreateGithubIssueDialog.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/components/CsmIssuesView.tsx
  • apps/csm-portal/webapp/src/features/csm-cases/types/csmCases.ts
  • apps/csm-portal/webapp/src/features/csm-cases/utils/casesSort.ts
  • apps/csm-portal/webapp/src/features/csm-dashboard/api/useGetMyAssignedOpenCases.ts

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