feat(frontend/history): inline column filters via shared lib (refs #166)#790
feat(frontend/history): inline column filters via shared lib (refs #166)#790cristim wants to merge 4 commits into
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Warning Review limit reached
More reviews will be available in 51 minutes and 32 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
Rate Limit Exceeded
|
2f2a298 to
3cec781
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…ces (refs #166) Adds two new closed column-id enums and matching filter slices for the History page tables: PurchaseHistoryColumnId for the completed-purchases table and ApprovalQueueColumnId for the pending-approvals card. The two tables share Provider/Service/Term/Count/UpfrontCost/MonthlySavings columns but diverge on the queue's Account/Payment/MonthlyCost/CreatedBy vs Purchase History's ResourceType/Region, so each gets its own in-memory slice with set/clear/getAll accessors mirroring the existing recommendations equivalents. In-memory only on this iteration; localStorage persistence stays a follow-up under the same umbrella as the recommendations equivalent.
…se History table (refs #166) Adds per-column filter buttons to the Purchase History table headers. Filter columns: Provider, Service, Type (resource_type), Region, Term (categorical), and Count, Upfront Cost, Monthly Savings (numeric). Status is excluded — the existing status chip-row is the canonical filter for that column. Wires `applyColumnFilters` from lib/column-filters.ts through extractors that match the rendered cell shape: categorical extractors return the raw field; numeric extractors return the value rounded to display precision so typed numbers match the rendered cells (issue #484 contract). Filters compose with the existing status chip filter, and the column-filter popover lists distinct values from rows that survived the status filter (so picking "Failed" then opening Provider only lists providers with failed rows). Introduces a small lib/history-filter-popover.ts module shared by both History tables — keeps the popover DOM/teardown/keyboard wiring out of history.ts itself and reuses the existing .column-filter-popover CSS so the visual matches the recommendations equivalent.
…al Queue table (refs #166) Adds per-column filter buttons to the Approval Queue table headers. Filter columns: Provider, Account, Service, Term, Payment, Created by (categorical), and Count, Monthly Cost, Upfront Cost, Monthly Savings (numeric). Status is excluded — the queue scope is already pending| notified by definition; the broader Status chip-row above is the authoritative status filter for the page. Uses the same lib/history-filter-popover.ts helper introduced for the Purchase History table. Numeric extractors round to display precision (CURRENCY_DEFAULT_DIGITS) so a "$X" filter matches the rendered cell; monthly_cost returns NaN for null so a "= 0" predicate doesn't match rows where the provider didn't report a value. Categorical extractors mirror the cell rendering: account uses account_id with getAccountName as the display label, created_by prefers email then falls back to UUID. Test-suite mocks (history-* + allowed-accounts + xss-provider-class) extended with the new state accessors so they keep passing against the expanded state surface.
Adds two test files exercising the new History column-filter wiring:
* history-column-filters.test.ts — Purchase History table:
numeric expr, categorical set, stacked AND, invalid expr (no-op),
clear, and the term-as-stringified-categorical case.
* approval-queue-column-filters.test.ts — Approval Queue table:
numeric expr (monthly_cost >= N), categorical set (payment in
{…}), stacked AND across provider+created_by, invalid expr (no-op),
the NaN-as-missing contract for null monthly_cost (so "= 0" and
"> 0" don't coincidentally match unreported rows), and clear.
Both suites mock the heavy module transitive deps (api / navigation /
utils / state / confirmDialog / approval-details / toast / skeleton /
recommendations) so the pure column-filter helpers can be exercised
without standing up a DOM.
3cec781 to
03c7a40
Compare
|
Rebased on Conflict resolution: only Verification on the rebased head: @coderabbitai review |
|
🧠 Learnings used✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Wires the History page to the shared
frontend/src/lib/column-filters.tsextracted by merged PR #570. Adds inline per-column filter buttons to both History tables (Purchase History + Approval Queue) using the sameapplyColumnFilters<TRow, TColumnId>shape that recommendations.ts already uses.PurchaseHistoryColumnId+ApprovalQueueColumnId, each with its own in-memory filter record, get/set/clear accessors. Two separate enums because the queue uses Account/Payment/Monthly Cost/Created By while Purchase History uses Resource Type/Region — overlap is too narrow to share a single column-id type without ugly unions.frontend/src/lib/history-filter-popover.ts— small reusable popover helper shared by the two tables; reuses the existing.column-filter-popoverCSS so the visual matches recommendations.roundForDisplay(_, 0)so a typed$Xmatches the rendered cell (matches the issue ux(opportunities): numeric column filter doesn't match exact values (typed value compares against unrounded backend) #484 contract on recommendations).monthly_costreturnsNaNfor null (= 0and> 0filters don't coincidentally match unreported rows).Sibling PRs
Part of the issue #166 follow-up trio:
Each PR touches only its own state slice, so all three rebase cleanly against feat/multicloud-web-frontend.
Test plan
npm test -- history— all history-related suites green.npm test -- approval-queue— new regression suite passes.npm test -- column-filters— shared lib regression unchanged.npx tsc --noEmit— clean.npm test— 67 suites / 2154 tests / 1 skipped — all green.Refs #166.