refactor(tui): extract Activity readout and show local time

Move activity data assembly out of tui.py into activity_readout, behind
readout(conn, selection, now). Dashboard and fenris-monitor enable now show
local time with a timezone label, inspected points keep a secondary UTC line,
and the legacy UTC-relabelled day and hour branches are gone. Time formatting
(including freshness_age_human) lives in timefmt. Hour offsets now render as
+05:30 to match day labels.
This commit is contained in:
xavierk
2026-10-05 20:21:22 +05:30
parent ef61ececc1
commit 79ebb10dea
20 changed files with 1297 additions and 834 deletions
+7 -8
View File
@@ -18,12 +18,9 @@ from fenris.activity_selection import IntervalIdentity
from fenris.monitoring_periods import ensure_period_open
from fenris.status import ACCURACY_SEC, CADENCE_DEFAULT_S, FRESH_THRESHOLD_S
from fenris.store import init_store
from fenris.tui import (
LIVE_WINDOW_H,
FenrisTuiApp,
LiveActivityGraph,
_query_live_graph_data,
)
from fenris.timefmt import local_clock, tz_label, utc_range_label
from fenris.activity_readout import LIVE_WINDOW_H, _query_live_graph_data
from fenris.tui import FenrisTuiApp, LiveActivityGraph
# ---------------------------------------------------------------------------
# Helpers
@@ -70,8 +67,10 @@ def _live_intervals(count=4):
intervals.append({
"start_ts": start.isoformat(),
"end_ts": end.isoformat(),
"start_label": start.strftime("%H:%M"),
"end_label": end.strftime("%H:%M"),
"start_label": local_clock(start, "UTC"),
"end_label": local_clock(end, "UTC"),
"timezone_label": tz_label(end, "UTC"),
"utc_label": utc_range_label(start, end),
"bytes_written": (index + 1) * 1000,
"bytes_read": (index + 1) * 500,
"elapsed_s": 180,