no message

This commit is contained in:
belevo\mh
2026-01-20 11:09:04 +01:00
parent b241cc3f77
commit a25f440097

View File

@@ -13,36 +13,15 @@
background: transparent;
}
.wrap {
padding: 0;
margin: 0;
}
/* Deutlich sichtbare Kopfzeile */
/* Kopfzeile */
.header {
display: flex;
align-items: center;
gap: 14px;
padding: 10px 14px;
background: #1f2937;
border-bottom: 1px solid #374151;
}
#reload {
background: #2563eb;
color: #fff;
border: none;
border-radius: 8px;
padding: 8px 14px;
font-size: 14px;
font-weight: 700;
cursor: pointer;
box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
#reload:hover { background: #1d4ed8; }
#reload:active { transform: translateY(1px); }
.meta {
color: #e5e7eb;
font-size: 13px;
@@ -52,33 +31,23 @@
text-overflow: ellipsis;
}
/* Chart Area */
/* Chart */
#chart {
height: 520px;
width: 100%;
padding: 10px 10px 0 10px;
padding: 10px;
box-sizing: border-box;
background: #ffffff;
}
/* Kleine Hilfe, falls Symcon dunklen Hintergrund setzt */
.chartWrap {
background: #ffffff;
}
</style>
</head>
<body>
<div class="wrap">
<div class="header">
<button id="reload">🔄 Neu laden</button>
<div class="meta" id="meta">Lade…</div>
</div>
<div class="chartWrap">
<div id="chart"></div>
</div>
</div>
<script>
const metaEl = document.getElementById("meta");
@@ -89,7 +58,7 @@
const instanceId = Number("{{INSTANCE_ID}}");
if (!Number.isFinite(instanceId) || instanceId <= 0) {
metaEl.textContent = "Fehler: INSTANCE_ID nicht korrekt eingesetzt.";
metaEl.textContent = "Fehler: INSTANCE_ID nicht korrekt.";
throw new Error("Invalid INSTANCE_ID");
}
@@ -100,7 +69,7 @@
let chart;
async function loadData() {
metaEl.textContent = "⏳ Lade Daten…";
metaEl.textContent = "⏳ Daten werden geladen…";
const r = await fetch(endpoint, { cache: "no-store" });
if (!r.ok) {
const text = await r.text().catch(() => "");
@@ -109,13 +78,9 @@
return await r.json();
}
function fmtDT(ms) {
return new Date(ms).toLocaleString();
}
function render(data) {
if (typeof Highcharts === "undefined") {
metaEl.textContent = "Fehler: Highcharts nicht geladen (CSP/CDN).";
metaEl.textContent = "Fehler: Highcharts nicht geladen.";
return;
}
@@ -128,7 +93,8 @@
const nowMs = data?.meta?.now ?? Date.now();
metaEl.textContent = `✅ OK | Cache: ${cachedAt} | Forecast: ${forecast.length} | Ist: ${actual.length}`;
metaEl.textContent =
`OK | Cache: ${cachedAt} | Forecast: ${forecast.length} | Ist: ${actual.length}`;
const options = {
title: {
@@ -211,7 +177,6 @@
if (!chart) {
chart = Highcharts.chart("chart", options);
} else {
// PlotLine "JETZT" aktualisieren + Daten neu setzen
chart.update({
xAxis: { plotLines: options.xAxis.plotLines }
}, false);
@@ -222,17 +187,14 @@
}
}
async function refresh() {
(async () => {
try {
const data = await loadData();
render(data);
} catch (e) {
metaEl.textContent = "Fehler beim Laden: " + (e?.message ?? e);
metaEl.textContent = "Fehler beim Laden: " + (e?.message ?? e);
}
}
document.getElementById("reload").addEventListener("click", refresh);
refresh();
})();
</script>
</body>
</html>