[CSM Portal] Fix case updated-time display, add sort, gate git-issue action - #1119
Conversation
…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.
📝 WalkthroughWalkthroughThe 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. ChangesCSM case sorting and display
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
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 valueConsider extracting the shared
updatedAtfallback logic.The
updatedAtfallback andupdatedAtIsCreatedFallbackcomputation are now duplicated identically inuseGetCsmCases.ts:241-242and here at lines 151-152. If the fallback semantics change, both sites must be updated in lockstep. A small shared helper (e.g., incsmCases.tsor 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
📒 Files selected for processing (8)
apps/csm-portal/webapp/src/features/csm-cases/api/useGetCsmCases.tsapps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsxapps/csm-portal/webapp/src/features/csm-cases/components/CasesList.tsxapps/csm-portal/webapp/src/features/csm-cases/components/CreateGithubIssueDialog.tsxapps/csm-portal/webapp/src/features/csm-cases/components/CsmIssuesView.tsxapps/csm-portal/webapp/src/features/csm-cases/types/csmCases.tsapps/csm-portal/webapp/src/features/csm-cases/utils/casesSort.tsapps/csm-portal/webapp/src/features/csm-dashboard/api/useGetMyAssignedOpenCases.ts
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
Approach
CsmCaseRowgainsupdatedAtIsCreatedFallback; both case-list API hooks set it when the backend didn't returnupdatedOn, andCasesListprefixes the cell with a plain "Created" label in that case instead of an unlabeled date.TableSortLabelon the "Updated" header, threaded throughCsmIssuesView→useGetCsmCases→ the search request'ssortBy.order.CaseActionBardisables "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).CreateGithubIssueDialoghides Update Level / Public Git Issue whenshowRepoFieldis true (cloud-subscription projects), inverting the existing repo-picker condition.CsmIssuesView.Verification
Confirmed directly against the staging backend (authenticated session) that:
/cases/searchcorrectly sorts by bothcreatedOnandupdatedOnin either direction.updatedOnis genuinely absent from live case rows (not a hypothetical), validating the fallback-display fix.pnpm build,pnpm test, andpnpm lintall 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
Security checks
pnpm lint(eslint) ran cleanSamples
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
Updates