You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(frontend): Trends view consuming GET /api/analytics/trends #30
The savings-snapshot historical time-series is now collected and exposed via GET /api/analytics/trends (PR for LeanerCloud/cloud-commitments-cli#1023/#1033), but there is no frontend view
consuming it. Users cannot yet see coverage %, utilization, committed spend, or
realized savings over time by account/provider/service.
Proposed work
Add a basic "Trends" view in frontend/src that consumes /api/analytics/trends:
Render the monthly series (coverage %, committed spend, usage, realized
savings) and the by-provider / by-service breakdowns.
Account scoping: pass the top-bar chip account_id through to the endpoint
(the backend already enforces allowed_accounts scope).
Escape every API field rendered into any innerHTML template via escapeHtml() (feedback_innerhtml_xss).
Install event listeners once per element (stored ref / AbortController), never
re-add on a repeatedly-called render (feedback_event_listener_dedup).
Do NOT touch frontend/src/dashboard.tsServiceSavings or handler_dashboard.go / types.goServiceSavings (owned elsewhere).
Status update (2026-10-28): #1563 merged: each monthly row of GET /api/analytics/trends now has total_commitment (upfront amortized per month) and total_usage (recurring fees), with unknown kept unknown. Committed spend is their sum.
Left: showing them on the Trends view (UI owner), and a coverage data source (design call: the collector has no on-demand baseline).
Checked against main: the Trends view already exists (trends.ts, #1317 and later fixes, a sub-tab of Inventory & Coverage). Landed a503e37 (Part of #30): the monthly table now shows Committed spend (total_commitment + total_usage per month; unknown when any bucket is missing either part, never 0). Remaining: the coverage data source (the collector writes coverage_percentage nil because purchase_history has no on-demand baseline), which is a design call. Releasing my claim (claude-platform-2).
Verified on origin/main 447a98b: the Trends view is met.
Consumes the endpoint: frontend/src/api/analytics.ts (GET /analytics/trends), frontend/src/trends.ts:83-99 passes the chip account_id(s), provider and window.
Monthly series (savings, committed spend, coverage) and by-provider / by-service tables: trends.ts:139-180; chart in trends.ts. Tab: frontend/src/index.html:321 and :361.
XSS: trends.ts:10 builds everything with DOM methods and textContent, never innerHTML.
Listener dedup: trends.ts:61-70 wires change/click once per element via data-wired.
Landed in e3f2062 (feat(frontend): add a Trends sub-tab for the analytics trends endpoint).
Closing as completed.
Activity
IAmJSD commentedon Oct 24, 2026
Claiming: working on this
feat(frontend): add a Trends sub-tab for the analytics trends endpoint (
docs(api): describe total_commitment as amortized upfront and total_u…
feat(analytics): return committed spend and usage in the monthly tren…
IAmJSD commentedon Oct 28, 2026
Status update (2026-10-28): #1563 merged: each
monthlyrow ofGET /api/analytics/trendsnow hastotal_commitment(upfront amortized per month) andtotal_usage(recurring fees), with unknown kept unknown. Committed spend is their sum.Left: showing them on the Trends view (UI owner), and a coverage data source (design call: the collector has no on-demand baseline).
chore: align MonthlySummary docs and warn on capped ladder configs (#…
cristim commentedon Nov 11, 2026
Claimed by claude-platform-2.
feat(frontend): show committed spend in the Trends monthly table
cristim commentedon Nov 11, 2026
Checked against main: the Trends view already exists (trends.ts, #1317 and later fixes, a sub-tab of Inventory & Coverage). Landed a503e37 (Part of #30): the monthly table now shows Committed spend (total_commitment + total_usage per month; unknown when any bucket is missing either part, never 0). Remaining: the coverage data source (the collector writes coverage_percentage nil because purchase_history has no on-demand baseline), which is a design call. Releasing my claim (claude-platform-2).
cristim commentedon Nov 12, 2026
Verified on origin/main 447a98b: the Trends view is met.
Closing as completed.