aboutsummaryrefslogtreecommitdiffstats
path: root/sb_builder
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-19 21:22:34 +0200
committerDanilo M. <danix@danix.xyz>2026-10-19 21:22:34 +0200
commit5609a744ef5e89c4d57a5239199a6afe5497590e (patch)
tree131c8613b5bdadf33a06b08e09066b628bc2f033 /sb_builder
parent3865fd7d10d76cd265800fd8d5915a5792be4619 (diff)
downloadsb-builder-5609a744ef5e89c4d57a5239199a6afe5497590e.tar.gz
sb-builder-5609a744ef5e89c4d57a5239199a6afe5497590e.zip
Dashboard: freshness dot on the slackpkg tile
Green when the last upgrade is within a day, yellow after one day, red after two; the age text beside it carries the meaning too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'sb_builder')
-rw-r--r--sb_builder/dashboard.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/sb_builder/dashboard.py b/sb_builder/dashboard.py
index 474af66..8c98040 100644
--- a/sb_builder/dashboard.py
+++ b/sb_builder/dashboard.py
@@ -34,6 +34,14 @@ GAP = 2 # px of surface between bar segments
SPARK_POINTS = 60 # ~30 min at the default 30 s dashboard refresh
+def upgrade_color(ts, now=None):
+ """Status color for the last upgrade: green within a day, yellow, red after two."""
+ if ts is None:
+ return None
+ age = (now or time.time()) - ts
+ return STATUS["failed"] if age > 2 * 86400 else STATUS["aborted"] if age > 86400 else STATUS["ok"]
+
+
def meter_color(pct, accent):
"""Fill color by severity: accent, then warning from 80%, critical from 90%."""
if pct >= 90:
@@ -306,7 +314,9 @@ class Dashboard(QWidget):
" · ".join(f"{o} {fmt_duration(None if ts is None else time.time() - ts)}"
for o, ts in sync.items()))
pkg = s.get("slackpkg") or {}
- t["slackpkg"].set(fmt_age(pkg.get("upgrade")) if pkg.get("upgrade") else NA,
+ dot = upgrade_color(pkg.get("upgrade"))
+ t["slackpkg"].set(f'<span style="color:{dot}">&#9679;</span> {fmt_age(pkg["upgrade"])}'
+ if dot else NA,
"last upgrade · lists updated " + fmt_duration(
None if pkg.get("update") is None else time.time() - pkg["update"]))
load, mem, disk = s.get("load"), s.get("mem"), s.get("disk") or {}