Stabilize dashboard loading hotfix
This commit is contained in:
@@ -25,6 +25,8 @@ nach einer ausdrücklichen Freigabe ausführen.
|
|||||||
[`docs/V1_4_0_OPERATING_GUIDE.md`](docs/V1_4_0_OPERATING_GUIDE.md)
|
[`docs/V1_4_0_OPERATING_GUIDE.md`](docs/V1_4_0_OPERATING_GUIDE.md)
|
||||||
- Version 1.5.0 Menü-Dashboard und kompakte Detaildaten:
|
- Version 1.5.0 Menü-Dashboard und kompakte Detaildaten:
|
||||||
[`docs/V1_5_0_OPERATING_GUIDE.md`](docs/V1_5_0_OPERATING_GUIDE.md)
|
[`docs/V1_5_0_OPERATING_GUIDE.md`](docs/V1_5_0_OPERATING_GUIDE.md)
|
||||||
|
- Version 1.5.1 Stabilisierung der Dashboard-Ladepfade:
|
||||||
|
[`docs/V1_5_1_OPERATING_GUIDE.md`](docs/V1_5_1_OPERATING_GUIDE.md)
|
||||||
- Arbeitsregeln für Coding-Agenten: [`AGENTS.md`](AGENTS.md)
|
- Arbeitsregeln für Coding-Agenten: [`AGENTS.md`](AGENTS.md)
|
||||||
|
|
||||||
## Reifegrad
|
## Reifegrad
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: SillyHome Next
|
name: SillyHome Next
|
||||||
version: "1.5.0"
|
version: "1.5.1"
|
||||||
slug: sillyhome_next
|
slug: sillyhome_next
|
||||||
description: Lernt automatisch aus deinem Verhalten und steuert freigegebene Aktoren
|
description: Lernt automatisch aus deinem Verhalten und steuert freigegebene Aktoren
|
||||||
url: http://192.168.6.31:3000/pino/sillyhome-next
|
url: http://192.168.6.31:3000/pino/sillyhome-next
|
||||||
|
|||||||
@@ -306,15 +306,25 @@ def list_configured_summary(request: Request) -> list[ActuatorSummary]:
|
|||||||
|
|
||||||
@router.get("/dashboard", response_model=DashboardOverview)
|
@router.get("/dashboard", response_model=DashboardOverview)
|
||||||
def dashboard_overview(request: Request) -> DashboardOverview:
|
def dashboard_overview(request: Request) -> DashboardOverview:
|
||||||
return _dashboard_overview(request, include_background=True)
|
return _dashboard_overview(request, include_background=True, include_actuators=True)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/dashboard/start", response_model=DashboardOverview)
|
@router.get("/dashboard/start", response_model=DashboardOverview)
|
||||||
def dashboard_start(request: Request) -> DashboardOverview:
|
def dashboard_start(request: Request) -> DashboardOverview:
|
||||||
return _dashboard_overview(request, include_background=False)
|
return _dashboard_overview(request, include_background=False, include_actuators=True)
|
||||||
|
|
||||||
|
|
||||||
def _dashboard_overview(request: Request, *, include_background: bool) -> DashboardOverview:
|
@router.get("/dashboard/system", response_model=DashboardOverview)
|
||||||
|
def dashboard_system(request: Request) -> DashboardOverview:
|
||||||
|
return _dashboard_overview(request, include_background=False, include_actuators=False)
|
||||||
|
|
||||||
|
|
||||||
|
def _dashboard_overview(
|
||||||
|
request: Request,
|
||||||
|
*,
|
||||||
|
include_background: bool,
|
||||||
|
include_actuators: bool,
|
||||||
|
) -> DashboardOverview:
|
||||||
cache_payload = _load_entity_cache_payload(request)
|
cache_payload = _load_entity_cache_payload(request)
|
||||||
raw_entities = cache_payload.get("entities", [])
|
raw_entities = cache_payload.get("entities", [])
|
||||||
if not isinstance(raw_entities, list):
|
if not isinstance(raw_entities, list):
|
||||||
@@ -329,7 +339,7 @@ def _dashboard_overview(request: Request, *, include_background: bool) -> Dashbo
|
|||||||
] if include_background and isinstance(raw_groups, list) else []
|
] if include_background and isinstance(raw_groups, list) else []
|
||||||
reconciliation = _reconciliation_state_or_default(request)
|
reconciliation = _reconciliation_state_or_default(request)
|
||||||
ws_status = getattr(request.app.state, "ws_status", None)
|
ws_status = getattr(request.app.state, "ws_status", None)
|
||||||
actuators = list_configured_summary(request)
|
actuators = list_configured_summary(request) if include_actuators else []
|
||||||
store = getattr(request.app.state, "actuator_store", None)
|
store = getattr(request.app.state, "actuator_store", None)
|
||||||
jobs = (
|
jobs = (
|
||||||
store.load_job_queue()
|
store.load_job_queue()
|
||||||
@@ -348,7 +358,11 @@ def _dashboard_overview(request: Request, *, include_background: bool) -> Dashbo
|
|||||||
if reconciliation.last_completed_at is not None
|
if reconciliation.last_completed_at is not None
|
||||||
else None
|
else None
|
||||||
),
|
),
|
||||||
configured_actuators=len(actuators),
|
configured_actuators=(
|
||||||
|
len(actuators)
|
||||||
|
if include_actuators
|
||||||
|
else reconciliation.configured_actuators
|
||||||
|
),
|
||||||
trained_models=reconciliation.trained_models,
|
trained_models=reconciliation.trained_models,
|
||||||
review_required=reconciliation.review_required,
|
review_required=reconciliation.review_required,
|
||||||
job_p95_duration_ms=job_p95_duration_ms,
|
job_p95_duration_ms=job_p95_duration_ms,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
|||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="SillyHome Next API",
|
title="SillyHome Next API",
|
||||||
description="Lokales Smart-Home-Intelligenzsystem für Home Assistant.",
|
description="Lokales Smart-Home-Intelligenzsystem für Home Assistant.",
|
||||||
version="1.5.0",
|
version="1.5.1",
|
||||||
lifespan=lifespan,
|
lifespan=lifespan,
|
||||||
)
|
)
|
||||||
app.state.settings = load_settings()
|
app.state.settings = load_settings()
|
||||||
|
|||||||
@@ -56,6 +56,8 @@
|
|||||||
.manual-context > summary,
|
.manual-context > summary,
|
||||||
.group-panel > summary { cursor:pointer; font-weight:800; color:#eaf1f8; }
|
.group-panel > summary { cursor:pointer; font-weight:800; color:#eaf1f8; }
|
||||||
details.collapsible > summary { list-style:none; display:flex; justify-content:space-between; gap:10px; }
|
details.collapsible > summary { list-style:none; display:flex; justify-content:space-between; gap:10px; }
|
||||||
|
.manual-context > summary,
|
||||||
|
.group-panel > summary { display:flex; justify-content:space-between; gap:10px; align-items:center; }
|
||||||
details.collapsible > summary::-webkit-details-marker,
|
details.collapsible > summary::-webkit-details-marker,
|
||||||
.manual-context > summary::-webkit-details-marker,
|
.manual-context > summary::-webkit-details-marker,
|
||||||
.group-panel > summary::-webkit-details-marker { display:none; }
|
.group-panel > summary::-webkit-details-marker { display:none; }
|
||||||
@@ -526,6 +528,11 @@ async function apiWithTimeout(path, timeoutMs = STATUS_TIMEOUT_MS) {
|
|||||||
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
||||||
try {
|
try {
|
||||||
return await api(path, {signal: controller.signal});
|
return await api(path, {signal: controller.signal});
|
||||||
|
} catch (error) {
|
||||||
|
if (error?.name === "AbortError") {
|
||||||
|
throw new Error("Zeitlimit erreicht; Daten laden im Hintergrund weiter.");
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
@@ -652,7 +659,7 @@ async function loadOverview() {
|
|||||||
if (budget) budget.textContent = "Startdaten laden ...";
|
if (budget) budget.textContent = "Startdaten laden ...";
|
||||||
document.getElementById("configured-actuators").innerHTML = "<p class='muted'>Beobachtete Geräte werden geladen ...</p>";
|
document.getElementById("configured-actuators").innerHTML = "<p class='muted'>Beobachtete Geräte werden geladen ...</p>";
|
||||||
try {
|
try {
|
||||||
const dashboard = await apiWithTimeout("v1/actuators/dashboard/start", DASHBOARD_TIMEOUT_MS);
|
const dashboard = await api("v1/actuators/dashboard/start");
|
||||||
dashboard._load_elapsed_ms = Math.round(performance.now() - startedAt);
|
dashboard._load_elapsed_ms = Math.round(performance.now() - startedAt);
|
||||||
cachedActuators = dashboard.actuators || [];
|
cachedActuators = dashboard.actuators || [];
|
||||||
cachedEntities = [];
|
cachedEntities = [];
|
||||||
@@ -682,7 +689,7 @@ async function loadSystemOverview() {
|
|||||||
const budget = document.getElementById("load-budget");
|
const budget = document.getElementById("load-budget");
|
||||||
if (budget) budget.textContent = "Systemübersicht lädt ...";
|
if (budget) budget.textContent = "Systemübersicht lädt ...";
|
||||||
try {
|
try {
|
||||||
const dashboard = await apiWithTimeout("v1/actuators/dashboard/start", DASHBOARD_TIMEOUT_MS);
|
const dashboard = await api("v1/actuators/dashboard/system");
|
||||||
dashboard._load_elapsed_ms = Math.round(performance.now() - startedAt);
|
dashboard._load_elapsed_ms = Math.round(performance.now() - startedAt);
|
||||||
cachedActuators = dashboard.actuators || cachedActuators;
|
cachedActuators = dashboard.actuators || cachedActuators;
|
||||||
renderDashboardStatus(dashboard);
|
renderDashboardStatus(dashboard);
|
||||||
@@ -1764,7 +1771,7 @@ async function startDashboard() {
|
|||||||
document.getElementById("section-jump").value = "status-section";
|
document.getElementById("section-jump").value = "status-section";
|
||||||
showView("status-section");
|
showView("status-section");
|
||||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||||
void loadStatus();
|
setTimeout(() => void loadStatus(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startDashboard();
|
void startDashboard();
|
||||||
|
|||||||
32
docs/V1_5_1_OPERATING_GUIDE.md
Normal file
32
docs/V1_5_1_OPERATING_GUIDE.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# SillyHome Next v1.5.1 Operating Guide
|
||||||
|
|
||||||
|
v1.5.1 ist ein Stabilisierungshotfix für die nach v1.2.0 entstandenen
|
||||||
|
Dashboard-Änderungen. Fachlich gehört diese Arbeit zur v1.2.x-Patchlinie; die
|
||||||
|
höhere technische Versionsnummer ist nur nötig, weil Home Assistant bereits
|
||||||
|
v1.5.0 installiert hat und Add-on-Updates monoton nach oben laufen.
|
||||||
|
|
||||||
|
## Korrekturen
|
||||||
|
|
||||||
|
- Die System-Startseite nutzt `GET /v1/actuators/dashboard/system` und lädt
|
||||||
|
keine Aktorenliste.
|
||||||
|
- Sichtbare 3-Sekunden-Abbrüche mit Browsertexten wie `signal is aborted
|
||||||
|
without reason` wurden entfernt.
|
||||||
|
- Startdaten und Detaildaten werden ohne künstlichen Frontend-Abbruch geladen.
|
||||||
|
- Timeout-Meldungen werden deutsch und verständlich angezeigt, wenn sie bei
|
||||||
|
Nebenprüfungen auftreten.
|
||||||
|
- `summary`-Zeilen wie `anzeigenaufklappen` haben jetzt Abstand und Layout.
|
||||||
|
|
||||||
|
## Ladeverhalten
|
||||||
|
|
||||||
|
- Statische Seite wird sofort gerendert.
|
||||||
|
- Systemdaten laden im Hintergrund.
|
||||||
|
- Lernen/Geräte laden nur im Menü `Lernen`.
|
||||||
|
- Discovery lädt nur im Menü `Discovery & Einrichtung`.
|
||||||
|
- Aktorwerte laden erst beim Öffnen der Detailansicht.
|
||||||
|
- Kontextvorschläge laden erst auf Nutzeraktion.
|
||||||
|
|
||||||
|
## Hinweis zur Performance-Anzeige
|
||||||
|
|
||||||
|
Die App zeigt keine echte HA/Ingress-Navigationszeit an. Gemessen werden nur
|
||||||
|
einzelne interne Abrufe nach Start der Seite. Aussagen zur gesamten Ladezeit
|
||||||
|
müssen über Browser/Ingress oder HA-Messung geprüft werden.
|
||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "sillyhome-next"
|
name = "sillyhome-next"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
description = "Lokales Smart-Home-Intelligenzsystem für Home Assistant"
|
description = "Lokales Smart-Home-Intelligenzsystem für Home Assistant"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -446,14 +446,17 @@ def test_dashboard_reports_performance_budget_and_anomalies(tmp_path: Path) -> N
|
|||||||
|
|
||||||
dashboard_response = client.get("/v1/actuators/dashboard")
|
dashboard_response = client.get("/v1/actuators/dashboard")
|
||||||
start_response = client.get("/v1/actuators/dashboard/start")
|
start_response = client.get("/v1/actuators/dashboard/start")
|
||||||
|
system_response = client.get("/v1/actuators/dashboard/system")
|
||||||
anomalies_response = client.get("/v1/actuators/anomalies")
|
anomalies_response = client.get("/v1/actuators/anomalies")
|
||||||
|
|
||||||
assert dashboard_response.status_code == 200
|
assert dashboard_response.status_code == 200
|
||||||
assert start_response.status_code == 200
|
assert start_response.status_code == 200
|
||||||
|
assert system_response.status_code == 200
|
||||||
system = dashboard_response.json()["system"]
|
system = dashboard_response.json()["system"]
|
||||||
start_payload = start_response.json()
|
start_payload = start_response.json()
|
||||||
assert start_payload["jobs"]["jobs"] == []
|
assert start_payload["jobs"]["jobs"] == []
|
||||||
assert start_payload["discovery_groups"] == []
|
assert start_payload["discovery_groups"] == []
|
||||||
|
assert system_response.json()["actuators"] == []
|
||||||
assert system["performance_budget_ms"] == 3000
|
assert system["performance_budget_ms"] == 3000
|
||||||
assert system["slow_job_count"] == 1
|
assert system["slow_job_count"] == 1
|
||||||
assert system["performance_status"] == "slow"
|
assert system["performance_status"] == "slow"
|
||||||
|
|||||||
Reference in New Issue
Block a user