diff --git a/routes/system.py b/routes/system.py index 271a2ef..4a96aad 100644 --- a/routes/system.py +++ b/routes/system.py @@ -452,7 +452,7 @@ def _get_observer_location() -> dict[str, Any]: if pos.altitude is not None: gps_meta['altitude'] = round(pos.altitude, 1) - # Fall back to config defaults + # Fall back to config env vars if lat is None: with contextlib.suppress(Exception): from config import DEFAULT_LATITUDE, DEFAULT_LONGITUDE @@ -460,6 +460,14 @@ def _get_observer_location() -> dict[str, Any]: if DEFAULT_LATITUDE != 0.0 or DEFAULT_LONGITUDE != 0.0: lat, lon, source = DEFAULT_LATITUDE, DEFAULT_LONGITUDE, 'config' + # Fall back to hardcoded constants (London) + if lat is None: + with contextlib.suppress(Exception): + from utils.constants import DEFAULT_LATITUDE as CONST_LAT + from utils.constants import DEFAULT_LONGITUDE as CONST_LON + + lat, lon, source = CONST_LAT, CONST_LON, 'default' + result: dict[str, Any] = {'lat': lat, 'lon': lon, 'source': source} if gps_meta: result['gps'] = gps_meta diff --git a/static/css/modes/system.css b/static/css/modes/system.css index 5593690..8d7a484 100644 --- a/static/css/modes/system.css +++ b/static/css/modes/system.css @@ -32,7 +32,6 @@ border: 1px solid var(--border-color, #2a2a4a); border-radius: 6px; padding: 16px; - min-height: 120px; } .sys-card-wide { @@ -464,17 +463,24 @@ background: var(--bg-primary, #0d0d1a); } -/* System info — horizontal layout */ +/* System info — vertical layout to fill card */ .sys-info-grid { display: flex; - flex-wrap: wrap; - gap: 4px 20px; - font-size: 11px; + flex-direction: column; + gap: 6px; + font-size: 12px; color: var(--text-dim, #8888aa); } .sys-info-item { - white-space: nowrap; + display: flex; + justify-content: space-between; + padding: 2px 0; + border-bottom: 1px solid rgba(255, 255, 255, 0.04); +} + +.sys-info-item:last-child { + border-bottom: none; } .sys-info-item strong { diff --git a/static/js/modes/system.js b/static/js/modes/system.js index 6731806..7bd0be2 100644 --- a/static/js/modes/system.js +++ b/static/js/modes/system.js @@ -612,19 +612,19 @@ const SystemHealth = (function () { var sys = m.system || {}; var html = '
System Info
'; - html += '
Host: ' + escHtml(sys.hostname || '--') + '
'; - html += '
OS: ' + escHtml(sys.platform || '--') + '
'; - html += '
Python: ' + escHtml(sys.python || '--') + '
'; - html += '
App: v' + escHtml(sys.version || '--') + '
'; - html += '
Uptime: ' + escHtml(sys.uptime_human || '--') + '
'; + html += '
Host' + escHtml(sys.hostname || '--') + '
'; + html += '
OS' + escHtml((sys.platform || '--').replace(/-with-glibc[\d.]+/, '')) + '
'; + html += '
Python' + escHtml(sys.python || '--') + '
'; + html += '
Appv' + escHtml(sys.version || '--') + '
'; + html += '
Uptime' + escHtml(sys.uptime_human || '--') + '
'; if (m.boot_time) { var bootDate = new Date(m.boot_time * 1000); - html += '
Boot: ' + escHtml(bootDate.toUTCString()) + '
'; + html += '
Boot' + escHtml(bootDate.toLocaleString()) + '
'; } if (m.network && m.network.connections != null) { - html += '
Connections: ' + m.network.connections + '
'; + html += '
Connections' + m.network.connections + '
'; } html += '
'; diff --git a/tests/test_system.py b/tests/test_system.py index 805ea11..bd5fdac 100644 --- a/tests/test_system.py +++ b/tests/test_system.py @@ -169,14 +169,17 @@ def test_location_from_gps(client): assert data['gps']['altitude'] == 45.0 -def test_location_falls_back_to_config(client): - """Location endpoint returns config defaults when GPS unavailable.""" +def test_location_falls_back_to_defaults(client): + """Location endpoint returns constants defaults when GPS and config unavailable.""" _login(client) - with patch('utils.gps.get_current_position', return_value=None): - resp = client.get('/system/location') + resp = client.get('/system/location') assert resp.status_code == 200 data = resp.get_json() assert 'source' in data + # Should get location from config or default constants + assert data['lat'] is not None + assert data['lon'] is not None + assert data['source'] in ('config', 'default') def test_weather_requires_location(client):