feat(ui): Disk, Traefik, UniFi and Settings say things plainly (#5212)
#5212 "Plain labels: no raw ids, scopes, metric keys or unexplained jargon", batch 3: - Disk page: each tile says what it holds. "Writable layers" becomes "Container files" and Build cache says it is safe to clear. Shared is "Shared with other images" with a tooltip, and "dangling" is gone. Untagged images show by id instead of "<none>", a capped list says "The 50 largest of N images", and each host shows "as of" its report. - Traefik: an expired certificate reads "expired 12 days ago", not "-12 days" (cert_left). The Traffic empty state knows whether the access log is on: off points to Settings → Plugins → Traefik; on says to check the mounted log path. - Moments use |ago with an exact UTC tooltip: UniFi last seen, alarms, events, speed test and DPI; AI token last used. - Settings: the Auth tab is "Authentication" like its breadcrumb, plugin fields read "Metrics URL" not metrics_url (field_label), a source's pull interval is "every 1h", and the last report time drops the ISO "T". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,3 +102,24 @@ async def test_every_template_compiles_with_the_app_filters(app):
|
||||
except jinja2.TemplateError as exc:
|
||||
failed[str(path.relative_to(_REPO))] = str(exc)
|
||||
assert not failed, failed
|
||||
|
||||
|
||||
@pytest.mark.parametrize("key, label", [
|
||||
("metrics_url", "Metrics URL"), ("scrape_interval_seconds", "Scrape interval seconds"),
|
||||
("geoip_db", "GeoIP database"), ("db", "Database"), ("verify_ssl", "Verify SSL"),
|
||||
("enabled", "Enabled"), ("", ""),
|
||||
])
|
||||
def test_a_settings_key_reads_as_a_label(key, label):
|
||||
"""#5212: plugin settings are labelled in words, not snake_case."""
|
||||
from steward.core.formatting import field_label
|
||||
assert field_label(key) == label
|
||||
|
||||
|
||||
def test_metric_names_and_units_read_in_words():
|
||||
from steward.core.formatting import metric_label, metric_unit, source_label
|
||||
assert metric_label("disk_used_pct_worst") == "Fullest disk" and metric_unit("disk_used_pct_worst") == "%"
|
||||
assert metric_label("hrStorageUsed") == "hrStorageUsed" and metric_unit("hrStorageUsed") == ""
|
||||
assert metric_label("if_in_octets") == "if in octets"
|
||||
assert metric_unit("cert_expiry_days") == "days" and metric_unit("seconds_since_seen") == "seconds"
|
||||
assert metric_unit("is_up") == "" and metric_unit("request_rate") == "req/s"
|
||||
assert source_label("host_agent") == "Host agent" and source_label("my_plugin") == "my plugin"
|
||||
|
||||
Reference in New Issue
Block a user