feat(ui): analytics dashboard time-window selector (#2199) - #4747
feat(ui): analytics dashboard time-window selector (#2199)#4747RealDiligent wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Add a persisted 7d/30d/90d toggle on /app/analytics that re-keys the operator-dashboard fetch and threads days through the backend payload. Closes JSONbored#2199 Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4747 +/- ##
==========================================
- Coverage 94.22% 94.22% -0.01%
==========================================
Files 440 440
Lines 38714 38720 +6
Branches 14103 14105 +2
==========================================
+ Hits 36478 36483 +5
Misses 1576 1576
- Partials 660 661 +1
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 22:24:01 UTC
⏸️ Suggested Action - Manual Review
Review summary Blockers
Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
An AI reviewer flagged a likely defect, but its confidence was below this repository's configured close-confidence floor, so this is held for a maintainer to confirm instead of closing automatically. Resolve the flagged defect (see the review notes), or ask a maintainer to override. |
JSONbored
left a comment
There was a problem hiding this comment.
Blockers, closing:
Review summary
This PR threads a 7/30/90-day window selector from a new ToggleGroup through useLocalStorage persistence, into the operator-dashboard fetch path, and clamps it server-side via clampOperatorDashboardWindowDays. The wiring for the primary target (usage summary, command-usefulness) is correct and well tested, but the diff also silently changes several other panels' data windows by coupling gateEval/cycleTime/fleetAnalytics/recommendationQuality to the same selector, and it does so without updating a downstream label that assumes a fixed 7-day window.
Blockers
src/services/operator-dashboard.ts: computeGateEval and computeCycleTimeAggregate previously always used a fixed `days: 90` (per the adjacent https://github.com/JSONbored/gittensory/issues/2191/https://github.com/JSONbored/gittensory/issues/2194 comments, chosen for statistical stability on precision/percentile computations); this diff switches them to `days: windowDays`, whose default is 7 (DEFAULT_ANALYTICS_WINDOW_DAYS in apps/gittensory-ui/src/lib/analytics-window.ts), so every operator now sees gate-precision and cycle-time percentiles computed over 7 days by default instead of 90 unless they manually toggle to 90d — this is a real behavior regression not mentioned in the PR description and should either be reverted for these two calls or explicitly called out as intended.
apps/gittensory-ui/src/routes/app.analytics.tsx (MCP compatibility section, untouched by this diff but fed by src/services/operator-dashboard.ts:117 `summarizeMcpCompatibilityAdoption(env, usageSince)`): usageSince is now derived from the selected windowDays instead of the previously-fixed USAGE_WINDOW_DAYS=7, but the 'MCP events'/'Active clients' Stat hints still hardcode `last 7 days` — selecting 30d or 90d will show data spanning that window under a label that still claims 7 days, a real data/label mismatch on the default render path.
Summary
ToggleGroupto the/app/analyticsheaderuseApiResource(operatorDashboardPath(days))so the query key re-fetches on change?days=onGET /v1/app/operator-dashboardand clamp to supported windowsCloses #2199
Test plan
npm run test --workspace=@jsonbored/gittensory-ui -- src/lib/analytics-window.test.ts(6 tests: parse, path, persistence, re-key)npx vitest run test/unit/operator-dashboard.test.ts(windowDays clamp + metadata)mainUI Evidence
/app/analyticsheaderbefore: fixed 30d window, no selector
after: 7d/30d/90d toggle drives dashboard fetch