Commit 85d0a01
authored
fix(analytics): dashboard predicate, tab dedup, chart a11y, ISO timestamps (#55)
## Summary
Four small fixes to the analytics dashboard surfaced from a 7-day audit
of `mcp.copilotkit.ai/analytics`. All independent, no behavior change to
data collection.
### 1. Top Queries vs Empty Result Queries — single predicate for
"empty"
`getTopQueries` previously returned every `(query_text, tool_name)`
group ordered by count, with no filter on `result_count`. A query that
ONLY ever returned zero results therefore appeared in **both** tables:
Top Queries (count > 0) and Empty Result Queries (`result_count = 0`).
The two tables disagreed on what "empty" means, which let rows like
`count=1, avg_results=0.0, avg_score=—` sit in Top Queries.
Fix: add `HAVING bool_or(result_count > 0)` so Top Queries narrows to
groups with at least one non-empty event. Pure-empty groups stay
exclusively in Empty Result Queries.
### 2. Hide the "All" tool-type pill when only one tool type exists
With a single tool type (typical install with only `search`), `All
(3,214)` rendered next to `Search (3,214)` — identical counts, looked
like a broken filter. Now the `All` pill is suppressed when
`toolCounts.length <= 1` and reappears automatically once a second tool
type is recorded.
### 3. Chart accessibility / scrape-ability
The two `<canvas>` charts ("Queries per Day", "Queries by Source") were
opaque to assistive tech and to HTML scrapers — only the tooltip prompt
was reachable in the accessibility tree. Added:
- `role="img"` + `aria-labelledby` + `aria-describedby` on each canvas.
- Sibling `.sr-only` tables (`#dailyChartTable`, `#sourceChartTable`)
populated with the same numbers the bars/slices encode, kept off-screen
with the standard visually-hidden CSS pattern.
Visible UI is unchanged. Screen readers now announce per-day and
per-source counts; the dashboard's own MCP indexer can now read them
too.
### 4. Empty Queries `Last Seen` → ISO-8601 in UTC
`toLocaleString()` rendered `4/29/2026, 6:10:04 AM` — month-first
ordering, 12-hour time, no timezone. The dashboard is internal and read
across timezones. Now renders `2026-04-29 06:10:04 UTC`: explicit,
sortable, unambiguously parseable.
## Test plan
- [x] `npm run build` clean.
- [x] `npm test` — 3,250 passed (added one regression test asserting the
`HAVING bool_or(result_count > 0)` predicate is in the SQL).
- [x] Manual: open the dashboard with a single tool type and confirm the
`All` pill is hidden; with multiple tool types, confirm it reappears.
- [ ] Manual: VoiceOver / NVDA reads the sr-only tables alongside each
chart.
- [x] Manual: confirm `Last Seen` renders as `YYYY-MM-DD HH:MM:SS UTC`.3 files changed
Lines changed: 142 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
373 | 391 | | |
374 | 392 | | |
375 | 393 | | |
| |||
382 | 400 | | |
383 | 401 | | |
384 | 402 | | |
385 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
386 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
387 | 420 | | |
388 | 421 | | |
389 | | - | |
390 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
391 | 439 | | |
392 | 440 | | |
393 | 441 | | |
| |||
1106 | 1154 | | |
1107 | 1155 | | |
1108 | 1156 | | |
1109 | | - | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1110 | 1162 | | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1118 | 1172 | | |
1119 | 1173 | | |
1120 | 1174 | | |
| |||
1834 | 1888 | | |
1835 | 1889 | | |
1836 | 1890 | | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1837 | 1913 | | |
1838 | 1914 | | |
1839 | 1915 | | |
| |||
1870 | 1946 | | |
1871 | 1947 | | |
1872 | 1948 | | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
1873 | 1971 | | |
1874 | 1972 | | |
1875 | 1973 | | |
| |||
1911 | 2009 | | |
1912 | 2010 | | |
1913 | 2011 | | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
1914 | 2020 | | |
1915 | 2021 | | |
1916 | 2022 | | |
1917 | | - | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
1918 | 2027 | | |
1919 | 2028 | | |
1920 | 2029 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
422 | 436 | | |
423 | 437 | | |
424 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
600 | 605 | | |
601 | 606 | | |
602 | 607 | | |
| |||
628 | 633 | | |
629 | 634 | | |
630 | 635 | | |
| 636 | + | |
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
| |||
0 commit comments