[Customer Portal] feat: Date Range Filters for SR & Engagements + Time Tracking CSV/PDF Export - #891
Conversation
…gagements Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 44 minutes and 35 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo independent features are added: (1) created/updated date range filters are wired into the engagements and service-requests search request builders and surfaced as ChangesDate Range Filters for Engagements and Operations
Time Cards CSV/PDF Export
Sequence Diagram(s)sequenceDiagram
participant User
participant TimeCardsCsvExportButton
participant fetchAllCaseTimeCards
participant Backend
participant downloadTimeCardsCsv
participant downloadTimeCardsPdf
User->>TimeCardsCsvExportButton: clicks Export, selects CSV or PDF
TimeCardsCsvExportButton->>TimeCardsCsvExportButton: set isExportingRef=true
alt prefetchedCards sufficient
TimeCardsCsvExportButton->>TimeCardsCsvExportButton: reuse prefetchedCards
else full fetch needed
loop paginated pages
TimeCardsCsvExportButton->>fetchAllCaseTimeCards: POST filters + limit/offset
fetchAllCaseTimeCards->>Backend: authenticated POST /time-cards
Backend-->>fetchAllCaseTimeCards: page of CaseTimeCard[]
end
fetchAllCaseTimeCards-->>TimeCardsCsvExportButton: full CaseTimeCard[]
end
alt format = csv
TimeCardsCsvExportButton->>downloadTimeCardsCsv: cards, filenamePrefix
else format = pdf
TimeCardsCsvExportButton->>downloadTimeCardsPdf: cards, filenamePrefix, projectName
end
TimeCardsCsvExportButton->>TimeCardsCsvExportButton: reset isExportingRef, clear exportingFormat
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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: 2
🧹 Nitpick comments (2)
apps/customer-portal/webapp/src/features/engagements/utils/engagements.ts (1)
89-92: ⚡ Quick winNormalize optional date fields before building the search payload.
These fields can be empty strings when a user clears a date filter. Coercing empty values to
undefinedavoids sending ambiguous date values to/cases/search.Suggested change
- startCreatedDate: filters.startCreatedDate, - endCreatedDate: filters.endCreatedDate, - startUpdatedDate: filters.startUpdatedDate, - endUpdatedDate: filters.endUpdatedDate, + startCreatedDate: filters.startCreatedDate || undefined, + endCreatedDate: filters.endCreatedDate || undefined, + startUpdatedDate: filters.startUpdatedDate || undefined, + endUpdatedDate: filters.endUpdatedDate || undefined,🤖 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/engagements/utils/engagements.ts` around lines 89 - 92, In the search payload construction where the date fields startCreatedDate, endCreatedDate, startUpdatedDate, and endUpdatedDate are being assigned from the filters object, normalize these optional date fields to handle empty strings. When any of these date filter values are empty strings (indicating the user cleared the filter), convert them to undefined instead of passing the empty string value. This prevents sending ambiguous date values to the /cases/search endpoint. Apply this normalization logic to all four date fields before assigning them to the search payload.apps/customer-portal/webapp/src/features/operations/utils/operationsPages.ts (1)
317-320: ⚡ Quick winApply the same date-value normalization in service-request payloads.
Optional date fields should be omitted when empty instead of sent as
""values.Suggested change
- startCreatedDate: filters.startCreatedDate, - endCreatedDate: filters.endCreatedDate, - startUpdatedDate: filters.startUpdatedDate, - endUpdatedDate: filters.endUpdatedDate, + startCreatedDate: filters.startCreatedDate || undefined, + endCreatedDate: filters.endCreatedDate || undefined, + startUpdatedDate: filters.startUpdatedDate || undefined, + endUpdatedDate: filters.endUpdatedDate || undefined,🤖 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/operations/utils/operationsPages.ts` around lines 317 - 320, The date fields (startCreatedDate, endCreatedDate, startUpdatedDate, endUpdatedDate) in the service-request payload are being included even when they contain empty string values. Apply conditional logic to omit these optional date fields from the payload when they are empty, similar to the normalization pattern used elsewhere in the codebase. Only include each date field in the payload if it has a non-empty value.
🤖 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/customer-portal/webapp/src/features/project-details/components/time-tracking/TimeCardsCsvExportButton.tsx`:
- Line 59: The filenamePrefix assignment in TimeCardsCsvExportButton uses the
nullish coalescing operator which only falls back to projectId when projectName
is null or undefined, but not when it is an empty string. When projectName is an
empty string, the replace and toLowerCase operations still execute and return an
empty string, causing filenames to start with a dash instead of using the
projectId fallback. Update the filenamePrefix assignment to check for both
null/undefined AND empty strings before applying the replace and toLowerCase
transformations, ensuring that when projectName is falsy or empty after
trimming, it falls back to projectId as the prefix.
In
`@apps/customer-portal/webapp/src/features/project-details/utils/timeCardsCsvExport.ts`:
- Around line 54-56: The buildFilename function currently uses toISOString() to
generate the date portion of the filename, which returns UTC time and can result
in off-by-one day errors when the user's local timezone differs from UTC,
particularly around midnight. Replace the toISOString() call with a method that
retrieves the user's local date in YYYY-MM-DD format, such as using the local
date components (year, month, day) from the Date object padded appropriately to
ensure consistent formatting.
---
Nitpick comments:
In `@apps/customer-portal/webapp/src/features/engagements/utils/engagements.ts`:
- Around line 89-92: In the search payload construction where the date fields
startCreatedDate, endCreatedDate, startUpdatedDate, and endUpdatedDate are being
assigned from the filters object, normalize these optional date fields to handle
empty strings. When any of these date filter values are empty strings
(indicating the user cleared the filter), convert them to undefined instead of
passing the empty string value. This prevents sending ambiguous date values to
the /cases/search endpoint. Apply this normalization logic to all four date
fields before assigning them to the search payload.
In
`@apps/customer-portal/webapp/src/features/operations/utils/operationsPages.ts`:
- Around line 317-320: The date fields (startCreatedDate, endCreatedDate,
startUpdatedDate, endUpdatedDate) in the service-request payload are being
included even when they contain empty string values. Apply conditional logic to
omit these optional date fields from the payload when they are empty, similar to
the normalization pattern used elsewhere in the codebase. Only include each date
field in the payload if it has a non-empty value.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6c44cd68-5a18-48f4-a432-7452df2f45dc
📒 Files selected for processing (7)
apps/customer-portal/webapp/src/features/engagements/components/EngagementsListSection.tsxapps/customer-portal/webapp/src/features/engagements/utils/engagements.tsapps/customer-portal/webapp/src/features/operations/utils/operationsPages.tsapps/customer-portal/webapp/src/features/project-details/components/time-tracking/ProjectTimeTracking.tsxapps/customer-portal/webapp/src/features/project-details/components/time-tracking/TimeCardsCsvExportButton.tsxapps/customer-portal/webapp/src/features/project-details/utils/timeCardsCsvExport.tsapps/customer-portal/webapp/src/features/usage-metrics/api/fetchAllCaseTimeCards.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
startCreatedDate,endCreatedDate,startUpdatedDate,endUpdatedDatefrom the existing filter UI to the/cases/searchAPI (values were silentlydropped before)
DateRangeFilterpickers to the customfilter panel and wires them through to the search request; active filter badge count updated
accordingly
Tracking tab, matching the UX of the existing case list export; respects the active date range
filter and includes a totals row
Out of Scope
Change Request date filters are intentionally excluded — the backend API does not support them
in this release.
Files Changed
features/operations/utils/operationsPages.tsfeatures/engagements/components/EngagementsListSection.tsxDateRangeFilterUI + badge countfeatures/engagements/utils/engagements.tsfeatures/usage-metrics/api/fetchAllCaseTimeCards.tsfeatures/project-details/utils/timeCardsCsvExport.tsfeatures/project-details/components/time-tracking/TimeCardsCsvExportButton.tsxfeatures/project-details/components/time-tracking/ProjectTimeTracking.tsxSummary by CodeRabbit
Release Notes