From a49078682746e15076538a99d24fd5a1ac48d5d5 Mon Sep 17 00:00:00 2001 From: Reditus <33814724+ReditusDraco@users.noreply.github.com> Date: Fri, 4 Dec 2026 09:35:24 +0000 Subject: [PATCH] Sync local changes 2026-12-04 --- .gitignore | 9 +++ app/routes/api.py | 13 +++- static/style.css | 71 ++++++++++++++++++++ templates/base.html | 151 +++++++++++++++++++++++++++++++++++++++++- templates/server.html | 118 ++++++++++++++++++++++++++++----- 5 files changed, 342 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index c6d1e9b..18402e0 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,9 @@ instance/ *.tmp *.bak +# Pre-change rollback backups (restorable copies of edited files) +rollback/ + # PowerShell profiles Microsoft.PowerShell_profile.ps1 @@ -125,3 +128,9 @@ node_modules/ package-lock.json yarn.lock pnpm-lock.yaml + +# Local browser automation artifacts +.playwright-mcp/ + +# Shared AI docs copies (top-level AI_DOCS has its own repo) +AI_DOCS/ diff --git a/app/routes/api.py b/app/routes/api.py index 756df45..934daec 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -137,8 +137,17 @@ def register_api_routes(app, services, settings): def server_metrics(): metrics = k8s.get_node_metrics() if metrics: - return jsonify(metrics) - return jsonify({'cpu': 'N/A', 'memory': 'N/A'}) + pass + else: + metrics = {'cpu': 'N/A', 'memory': 'N/A'} + try: + row = db.query( + "SELECT COUNT(*) AS c FROM dune.player_state " + "WHERE online_status::text = 'Online'", one=True) or {} + metrics['online'] = int(row.get('c') or 0) + except Exception: + pass + return jsonify(metrics) # Battlegroup @app.route('/server/battlegroup/status') diff --git a/static/style.css b/static/style.css index 0ad4892..8c8a6be 100644 --- a/static/style.css +++ b/static/style.css @@ -1490,3 +1490,74 @@ body[data-nav-layout="vertical"] .theme-dropdown::after { top: auto; bottom: 100%; } + +/* Nav live stats: CPU/RAM sparklines + online count. Compact strip in the + horizontal top bar, stacked block in the vertical sidebar. */ +.nav-stats-h { + display: flex; + align-items: center; + gap: 12px; + font-size: 12px; + color: var(--nav-text); + white-space: nowrap; +} +.nav-stats-h .ns-item { + display: inline-flex; + align-items: center; + gap: 5px; +} +.nav-stats-h canvas { + width: 64px; + height: 18px; +} +.nav-stats-h canvas, +.nav-stats-v canvas { + border: 1px solid rgba(128,128,128,0.35); + border-radius: 3px; +} +.nav-stats-v { + padding: 10px 8px; + border-top: 1px solid rgba(255,255,255,0.08); + font-size: 12px; + color: var(--nav-text); +} +.nav-stats-v .ns-vrow { + display: flex; + align-items: center; + gap: 6px; + margin-bottom: 6px; +} +.nav-stats-v .ns-vrow:last-child { + margin-bottom: 0; +} +.nav-stats-v .ns-vlabel { + opacity: 0.7; + font-size: 11px; +} +.nav-stats-v canvas { + flex: 1; + height: 28px; + min-width: 0; +} +/* Graph rows share one grid template so both canvases are pixel-identical + regardless of label/value text widths. */ +.nav-stats-v .ns-vgraph { + display: grid; + grid-template-columns: 34px 1fr 64px; + align-items: center; + gap: 6px; +} +.nav-stats-v .ns-vgraph canvas { + width: 100%; +} +/* Fixed-width value column so CPU and RAM graphs align regardless of + label length ("10%" vs "17947Mi"); values sit left, against the graphs. */ +.nav-stats-v .ns-vrow > span:last-child { + min-width: 64px; + text-align: left; + flex-shrink: 0; +} +.nav-stats-v strong { + font-size: 15px; + color: #fff; +} diff --git a/templates/base.html b/templates/base.html index 3ac0bdd..7a0f83b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -47,6 +47,16 @@ {% endfor %}
+ +