15 Commits

Author SHA1 Message Date
f565672aa1 bugfix 2026-05-24 23:56:40 +08:00
ac9a0e9fd3 fix: ChartBar data param 'data' -> 'user_data' to match EchartsExt constructor 2026-05-24 23:08:31 +08:00
40648df92a fix: export load_dashboard_for_sage alias in init.py for sage.py import 2026-05-24 19:24:59 +08:00
fabd127e6f add accounting errors monitoring card (accounting_status='failed') 2026-05-24 17:27:23 +08:00
a2a6e9a2d5 refactor: use individual RefreshWidget per stat card with Jinja2 .ui templates
Architecture:
- load_dashboard.py: async data functions registered via load_dashboard()
- init.py: calls load_dashboard() to expose on ServerEnv
- Individual .ui files (Jinja2 templates):
  - today_usage.ui: calls get_today_usage(request)
  - today_amount.ui: calls get_today_amount(request)
  - total_users.ui: calls get_total_users(request)
  - concurrent_users.ui: calls get_concurrent_users(request)
  - top_models_chart.ui: calls get_top_models(request) for ChartBar
- index.ui: each stat card wrapped in own RefreshWidget (10s period)
- Removed deprecated .dspy files (dashboard_cards, get_today_usage,
  get_user_stats, get_top_models)
2026-05-24 17:20:22 +08:00
d2210a2996 refactor: use RefreshWidget for stat cards + fix .dspy import violations
Architecture:
- index.ui: title + RefreshWidget(cards) + ChartBar with refresh_period
- RefreshWidget wraps dashboard_cards.dspy → returns full card widget tree
  with live data (cnt, amount, total_users, concurrent_users)
- ChartBar handles its own auto-refresh via refresh_period: 10
- No more JS polling file needed

.dspy import fixes:
- get_today_usage.dspy: remove import json, from datetime import date
- get_user_stats.dspy: remove from datetime import datetime, timedelta
- get_top_models.dspy: remove from datetime import date
- All use pre-loaded datetime module (datetime.date.today(), etc.)
- dashboard_cards.dspy: same pattern, no imports

Permission:
- load_path.py: add dashboard_cards.dspy logined
2026-05-24 16:45:45 +08:00
99e6fed5ef refactor: replace JS polling with RefreshWidget
- Delete dashboard_refresh.js (no longer needed)
- Add api/dashboard_content.dspy returns dynamic UI with live data
  (queries llmusage + users tables server-side, returns full widget tree)
- Simplify index.ui to use RefreshWidget with period_seconds=10
- ChartBar in dashboard_content.dspy auto-fetches top models via data_url
- load_path.py updated separately in sage repo
2026-05-24 16:31:29 +08:00
c7180bda77 fix: rewrite dashboard_refresh.js with correct bricks API
- Replace non-existent bricks.app.find_widget_by_id() with bricks.getWidgetById(id, bricks.app)
- Replace widget.el.textContent with widget.set_text() method
- Fix getBaseUrl() to handle /modulename paths (no .ui suffix) returning /undefined
- Remove chart refresh from JS — use ChartBar's built-in refresh_period: 10
- Update index.ui ChartBar widget with refresh_period: 10
- Also fixed all find_widget_by_id references across skills:
  * bricks-framework SKILL.md (2 occurrences)
  * bricks-framework references: auto-refresh-dashboard.md, auto-refresh-pattern.md, bar.md, line.md, websocket.md
  * module-development-spec references: read-only-module-pattern.md
  * harnessed-module-development SKILL.md (2 occurrences)
  * harnessed-module-development references: reasoning-visualization.md, bricks-ui-pitfalls.md
  * rbac-permission-initialization-pattern references: websocket-debugging.md
2026-05-24 16:05:56 +08:00
b83131146a fix: getBaseUrl() returns correct module prefix for /dashboard_for_sage path 2026-05-24 15:41:57 +08:00
1a3412176d Move JS file to wwwroot root per bricks convention (no subdirectories for JS/CSS) 2026-05-24 14:46:00 +08:00
ae613a1dc2 Update build.sh and README with load_path.py RBAC setup step 2026-05-24 14:34:39 +08:00
89a1e1eb59 Add README, .gitignore, and fix build.sh Sage root detection 2026-05-24 14:10:26 +08:00
3e18ed58b5 Add build.sh symlink fix and README 2026-05-24 14:09:14 +08:00
6ae20954f3 Initial commit: dashboard module for Sage with auto-refresh statistics 2026-05-24 14:06:38 +08:00
089411c72e Initial commit 2026-05-24 13:54:39 +08:00