feat(homeassistant): the page shows the device's storage and how full it is (#6753)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,8 @@
|
||||
|
||||
<div class="stat-strip">
|
||||
{{ stat_tile("System problems", problems|length if health.repairs_read else "—", state="degraded" if problems else none) }}
|
||||
{{ stat_tile("Disk free", (health.disk_free_gb ~ " GB") if health.disk_free_gb is not none and health.disk_free_gb is defined else "—") }}
|
||||
{{ stat_tile("Storage", (health.disk_total_gb ~ " GB") if health.disk_total_gb else "—",
|
||||
hint=("%.0f%% full"|format(100 - health.disk_free_pct)) if health.disk_free_pct is number else none) }}
|
||||
{{ stat_tile("Updates waiting", installable|length if connection.last_ok_at else "—") }}
|
||||
{{ stat_tile("Last good backup", (backup_at|ago) if backup_at else "—", state="degraded" if backup_tone == 'warn' else none) }}
|
||||
{{ stat_tile("Next backup", (backup_next|ago) if backup_next else "—") }}
|
||||
|
||||
@@ -533,6 +533,18 @@ def test_a_poll_keeps_the_system_problems_and_records_them(app):
|
||||
assert metrics["problems_open"] == 2.0 and metrics["disk_free_pct"] == 50.0 and metrics["update_failed"] == 0.0
|
||||
|
||||
|
||||
def test_the_page_shows_the_devices_storage_and_how_full_it_is(app):
|
||||
async def go():
|
||||
await _clean(app, health={"repairs_read": True, "problems": [], "disk_free_gb": 99.8,
|
||||
"disk_total_gb": 116.5, "disk_free_pct": 85.7})
|
||||
web, _ = await _admin_client(app)
|
||||
return await (await web.get("/plugins/homeassistant/")).get_data(as_text=True)
|
||||
|
||||
page = asyncio.run(go())
|
||||
assert "116.5 GB" in page and "14% full" in page
|
||||
assert "Disk free" not in page
|
||||
|
||||
|
||||
def test_a_report_it_couldnt_read_leaves_the_last_one_and_home_assistant_still_answers(app):
|
||||
sched = _ha("scheduler")
|
||||
ha = FakeHomeAssistant()
|
||||
|
||||
Reference in New Issue
Block a user