yumoqing ffdc7fc983 feat: modern UI redesign - shell layout, theme switching, dashboard revamp
Phase 1-2 deliverables:
- shell.ui: Global layout framework (topbar + collapsible sidebar + main content)
- shell_theme.css: Dark/light theme CSS custom properties system
- shell_theme.js: Theme toggle + sidebar collapse with localStorage persistence
- global_menu.ui: Unified module navigation menu with RBAC visibility
- index.ui: Redesigned dashboard homepage with modern stat cards + quick links
- Stat card widgets: today_usage, today_amount, total_users, concurrent, errors
- chart_top_models.ui + api/top_models.dspy: ChartBar with data_url pattern
- table_top_users_amount.ui: Jinja2-rendered user ranking table
- build.sh: Added .css file linking support

Design system:
- Dark theme (default): slate color palette (#0B1120, #111827, #1E293B)
- Light theme: clean white palette with matching structure
- Theme persisted in localStorage, toggled via topbar button
- Sidebar collapsible with icon-only mode, state persisted in localStorage
- Responsive stat cards with hover effects and trend indicators
- Quick link cards for model management, users, knowledge base, errors
2026-05-25 16:53:36 +08:00

53 lines
1.4 KiB
Bash

#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
MODULE_NAME="dashboard_for_sage"
# Try to find Sage root
for candidate in "$SCRIPT_DIR/../.." "$SCRIPT_DIR/../../../sage" "$HOME/repos/sage"; do
if [ -d "$candidate/wwwroot" ] && [ -d "$candidate/py3/bin" ]; then
SAGE_ROOT="$(cd "$candidate" && pwd)"
break
fi
done
if [ -z "$SAGE_ROOT" ]; then
echo "ERROR: Cannot find Sage root. Run this script from within a Sage environment."
exit 1
fi
VENV_PIP="$SAGE_ROOT/py3/bin/pip"
WWWROOT="$SAGE_ROOT/wwwroot"
echo "=== Building $MODULE_NAME ==="
echo "Sage root: $SAGE_ROOT"
# Install the module
cd "$SCRIPT_DIR"
$VENV_PIP install -e .
# Link wwwroot files to Sage wwwroot
MODULE_WWWROOT="$SCRIPT_DIR/wwwroot"
SAGE_MODULE_WWWROOT="$WWWROOT/$MODULE_NAME"
echo "Linking wwwroot..."
mkdir -p "$SAGE_MODULE_WWWROOT/api"
# Link all .ui, .js, and .css files (must be at wwwroot root per bricks convention)
for f in "$MODULE_WWWROOT"/*.ui "$MODULE_WWWROOT"/*.js "$MODULE_WWWROOT"/*.css; do
[ -f "$f" ] && ln -sf "$f" "$SAGE_MODULE_WWWROOT/"
done
# Link api/ directory
for f in "$MODULE_WWWROOT/api"/*.dspy; do
[ -f "$f" ] && ln -sf "$f" "$SAGE_MODULE_WWWROOT/api/"
done
echo "=== $MODULE_NAME build complete ==="
echo ""
echo "Next steps:"
echo "1. Add permissions to load_path.py (already done in Sage repo)"
echo "2. Run: cd \$SAGE_ROOT && ./py3/bin/python load_path.py"
echo "3. Restart Sage: ./stop.sh && ./start.sh"