Commit 9f0653e
feat(sharing-server): add admin token usage dashboard
- New /admin route (admin-only, redirects non-admins to /dashboard)
- Per-user summary table showing 30d input/output tokens, interactions,
days active and last upload date
- Overview stat cards for 7d / 30d / 90d with period toggle:
total users, active users, total tokens, avg tokens per active user,
interactions
- Stacked trend chart (top-10 users + Others) with period toggle
(7d / 30d / 90d) and mode toggle (Total / Per-User Average)
Per-User Average mode shows a single-series bar: total tokens that
day divided by the number of active users that day
- Admin Panel link in the user dashboard header for admin users
- New DB functions getAdminUserSummaries() and getAdminDailyTotals()
using LEFT JOIN so zero-upload users still appear in the table
- New idx_uploads_day index for efficient admin-wide day-range queries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7c809df commit 9f0653e
2 files changed
Lines changed: 426 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
17 | 38 | | |
18 | 39 | | |
19 | 40 | | |
| |||
208 | 229 | | |
209 | 230 | | |
210 | 231 | | |
| 232 | + | |
211 | 233 | | |
212 | 234 | | |
213 | 235 | | |
| |||
358 | 380 | | |
359 | 381 | | |
360 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
0 commit comments