Skip to content

feat(admin-dashboard): add usage dashboard and improve admin insights#48

Merged
KerwinTsaiii merged 9 commits intodevelopfrom
feat/admin-dashboard
Apr 1, 2026
Merged

feat(admin-dashboard): add usage dashboard and improve admin insights#48
KerwinTsaiii merged 9 commits intodevelopfrom
feat/admin-dashboard

Conversation

@MioYuuIH
Copy link
Copy Markdown
Contributor

@MioYuuIH MioYuuIH commented Mar 31, 2026

Summary

Add an Admin Usage Dashboard to provide visibility into platform activity, sessions, and course usage.

The dashboard aggregates real-time and historical metrics to help administrators monitor system usage and identify potential issues.

Key capabilities include:

  • Live session monitoring
  • Course usage statistics
  • Session activity trends
  • Spawn queue visibility
  • Idle session warnings

Features

  • Usage Dashboard showing overall platform statistics
  • Live sessions table with SSE updates
  • Course usage statistics for active courses
  • Hourly session distribution chart
  • Daily Active Users (DAU) trend line
  • Pending spawns panel for monitoring spawn delays
  • Idle session warnings to highlight inactive resources

Improvements

  • Display course and accelerator labels in usage data
  • Convert session timestamps to the admin's local timezone
  • Make hourly charts timezone-aware
  • Fill zero values in time-series data for days/weeks with no sessions
  • Always initialize QuotaManager so session tracking works even when quotas are disabled

Test plan

  • Open the admin dashboard and verify the Usage Dashboard appears
  • Confirm live sessions update automatically without refreshing the page
  • Verify course and accelerator labels display correctly
  • Check that session timestamps match the browser's local timezone
  • Ensure hourly charts align with local time
  • Confirm pending spawns panel shows active spawn requests
  • Verify idle session warnings appear for inactive sessions

Jira: AUPPM-16

- Add Dashboard page to Admin UI with Recharts line/pie charts and
  Bootstrap table showing daily usage, resource distribution, and
  top users ranking
- Add Tailwind v4 with tw: prefix to Admin UI for modern card layouts
  without conflicting with Bootstrap 5
- Add NavBar component shared across Users/Groups/Dashboard pages
- Add shared TypeScript types and API helpers for stats endpoints
- Add three stats API handlers: overview, usage time series,
  distribution breakdown
- Decouple UsageSession writes from quota system: sessions are now
  always recorded regardless of quota_enabled, so all deployments
  get dashboard data by default
- New Dashboard page: date range picker, usage trend chart (daily/weekly),
  course usage ranking with avg session duration, top users table
- Active Now panel: SSE-based live feed of running sessions (5s refresh)
- NavBar: unified tab navigation across Users/Groups/Dashboard pages;
  removed redundant 'Manage Groups' / 'Back to Users' buttons
- stats_handlers: add StatsActiveSSEHandler, avg_minutes in distribution,
  ActiveSession type; remove redundant REST active endpoint
- spawner stop(): fallback session recovery when usage_session_id lost
  after Hub restart (finds active DB session by username)
- dark mode: use Bootstrap semantic classes instead of Tailwind dark variant
…ion times

- Backend StatsHourlyHandler accepts tz_offset (minutes ahead of UTC) and
  applies SQLite datetime offset before extracting hour, so the distribution
  reflects the viewer's local time instead of server UTC
- Frontend getHourlyDistribution sends tz_offset derived from
  new Date().getTimezoneOffset() (negated to get offset from UTC)
- Active session start_time is now parsed as UTC and displayed in the
  browser's local timezone using toLocaleString()
- store accelerator display labels alongside session data so stats APIs surface both course and accelerator names
- extend shared stats types to expose `accelerator_display`
- update admin dashboard tables and user detail modal to render friendly course + accelerator labels with
fallbacks

The change ensures admins always see which course and accelerator a user is consuming, even while quota tracking
still keys sessions by accelerator.
@MioYuuIH MioYuuIH requested a review from KerwinTsaiii as a code owner March 31, 2026 05:01
@KerwinTsaiii KerwinTsaiii merged commit f9ee942 into develop Apr 1, 2026
9 checks passed
@MioYuuIH MioYuuIH deleted the feat/admin-dashboard branch April 2, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants