Reduce dashboard load overhead
Some checks failed
quality / test (3.11) (push) Has been cancelled
quality / test (3.13) (push) Has been cancelled
quality / test (3.11) (pull_request) Has been cancelled
quality / test (3.13) (pull_request) Has been cancelled

This commit is contained in:
2026-06-16 21:51:48 +02:00
parent 9ddb065f62
commit 058c5dd015

View File

@@ -285,14 +285,15 @@ function optionGroups(entities, selectedIds = new Set()) {
async function loadOverview() {
const status = document.getElementById("status");
const chips = document.getElementById("status-chips");
let reconciliation = null;
try {
const [health, websocket, ml, reconciliation, actuators] = await Promise.all([
const [health, websocket, ml] = await Promise.all([
api("health"),
api("health/websocket"),
api("ml/health"),
api("v1/actuators/reconciliation/state"),
api("v1/actuators"),
]);
reconciliation = await api("v1/actuators/reconciliation/state");
const actuators = await api("v1/actuators");
status.innerHTML = `<p class="ok">System bereit</p><p>Letzte automatische Prüfung: ${escapeHtml(reconciliation.last_completed_at || "noch nie")}</p>`;
chips.innerHTML = [
`<span class="chip">API: ${escapeHtml(health.status)}</span>`,
@@ -313,12 +314,8 @@ async function loadActuatorDiscovery() {
const options = document.getElementById("actuator-options");
const select = document.getElementById("actuator-select");
try {
const [available, configured] = await Promise.all([
api("v1/actuators/discovery"),
api("v1/actuators"),
]);
const configuredIds = new Set(configured.map(record => record.actuator_entity_id));
actuatorChoices = available.filter(entity => !configuredIds.has(entity.entity_id));
const available = await api("v1/actuators/discovery");
actuatorChoices = available;
options.innerHTML = actuatorChoices.slice(0, 120).map(entity =>
`<option value="${escapeHtml(entity.entity_id)}">${escapeHtml(entity.friendly_name || entity.entity_id)}${entity.area_name ? ` (${escapeHtml(entity.area_name)})` : ""}</option>`
).join("");