Spaces:
Sleeping
Sleeping
Update Deployment_UI.py
Browse files- Deployment_UI.py +227 -221
Deployment_UI.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Deployment_UI.py —
|
| 2 |
from fastapi import APIRouter
|
| 3 |
from fastapi.responses import HTMLResponse
|
| 4 |
|
|
@@ -6,239 +6,245 @@ router = APIRouter()
|
|
| 6 |
|
| 7 |
@router.get("/Deployment_UI", response_class=HTMLResponse)
|
| 8 |
def deployment_ui_page():
|
| 9 |
-
|
| 10 |
<!doctype html>
|
| 11 |
-
<html
|
| 12 |
-
<
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
align-items:center;justify-content:center;flex-direction:column;z-index:9999}
|
| 37 |
-
#boot-msg{margin-top:12px;color:#000;font-weight:600}
|
| 38 |
-
.spinner{width:36px;height:36px;border:3px solid #ddd;border-top-color:#0078d7;border-radius:50%;
|
| 39 |
-
animation:spin 1s linear infinite}
|
| 40 |
-
@keyframes spin{to{transform:rotate(360deg)}}
|
| 41 |
-
</style>
|
| 42 |
</head>
|
| 43 |
<body>
|
| 44 |
-
<
|
| 45 |
-
<div
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
</div>
|
| 55 |
-
|
| 56 |
-
<div
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
</div>
|
|
|
|
| 62 |
<script>
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
const
|
| 74 |
-
const
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
(
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
const
|
| 108 |
-
|
| 109 |
-
log(text, r.ok ? 'log-ok' : 'log-err');
|
| 110 |
-
try { return { ok: r.ok, json: JSON.parse(text) }; } catch { return { ok: r.ok, json: { _raw: text } }; }
|
| 111 |
-
}
|
| 112 |
-
async function del(path) {
|
| 113 |
-
const r = await fetch(path, { method: 'DELETE' });
|
| 114 |
-
const text = await r.text();
|
| 115 |
-
log(text, r.ok ? 'log-ok' : 'log-err');
|
| 116 |
-
try { return { ok: r.ok, json: JSON.parse(text) }; } catch { return { ok: r.ok, json: { _raw: text } }; }
|
| 117 |
-
}
|
| 118 |
-
// create + wait for true readiness (isReady)
|
| 119 |
-
async function begin() {
|
| 120 |
-
if (running) return;
|
| 121 |
-
running = true; ready = false;
|
| 122 |
-
showBoot('Creating instance…');
|
| 123 |
-
const create = await post('/api/compute/create_instance');
|
| 124 |
-
if (!create.ok) { running = false; hideBoot(); return; }
|
| 125 |
-
const ok = await ensureReady(true);
|
| 126 |
-
hideBoot();
|
| 127 |
-
}
|
| 128 |
-
async function stopOnce() {
|
| 129 |
-
await del('/api/compute/delete_instance');
|
| 130 |
-
hideBoot(); setBoot(''); ready = false; running = false;
|
| 131 |
-
}
|
| 132 |
-
async function endAll() {
|
| 133 |
-
await stopOnce();
|
| 134 |
-
MODEL_BASE = null; PREDICT_ROUTE = null;
|
| 135 |
}
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
ready = true;
|
| 185 |
-
return true;
|
| 186 |
-
}
|
| 187 |
-
log(`READY_POLL base=${cs.base ? 'yes' : 'no'} route=${cs.predictRoute || ''} isReady=${cs.isReady === true} status=${status}`, 'log-raw');
|
| 188 |
-
await new Promise(res => setTimeout(res, 1000));
|
| 189 |
-
}
|
| 190 |
-
ready = false;
|
| 191 |
-
return false;
|
| 192 |
}
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
const
|
| 201 |
-
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
}
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
loader.remove();
|
| 214 |
-
if (!ok && json?.error) { addModel(`Error: ${json.error}`); return; }
|
| 215 |
-
if (json?.image_b64) {
|
| 216 |
-
addModelImg(json.image_b64);
|
| 217 |
-
if (json.timings) appendResult(String(Date.now()), json.image_b64, json.timings);
|
| 218 |
-
} else if (typeof json?.output === 'string' && looksBase64(json.output)) {
|
| 219 |
-
addModelImg(json.output);
|
| 220 |
-
} else if (typeof json?.output === 'string') {
|
| 221 |
-
addModel(json.output);
|
| 222 |
-
} else if (json?._raw) {
|
| 223 |
-
addModel(json._raw);
|
| 224 |
-
} else {
|
| 225 |
-
addModel(JSON.stringify(json || {}, null, 2));
|
| 226 |
-
}
|
| 227 |
-
} catch (e) {
|
| 228 |
-
loader.remove();
|
| 229 |
-
addModel(`Error: ${String(e)}`);
|
| 230 |
-
} finally {
|
| 231 |
-
userInput.disabled = false; userInput.value = '';
|
| 232 |
-
userInput.focus();
|
| 233 |
-
}
|
| 234 |
}
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
document.getElementById('endall-btn').addEventListener('click', endAll);
|
| 240 |
-
(function init(){})();
|
| 241 |
</script>
|
| 242 |
-
</body
|
|
|
|
| 243 |
"""
|
| 244 |
-
return HTMLResponse(
|
|
|
|
| 1 |
+
# Deployment_UI.py — FE page with explicit Blob load/preview + ingest
|
| 2 |
from fastapi import APIRouter
|
| 3 |
from fastapi.responses import HTMLResponse
|
| 4 |
|
|
|
|
| 6 |
|
| 7 |
@router.get("/Deployment_UI", response_class=HTMLResponse)
|
| 8 |
def deployment_ui_page():
|
| 9 |
+
html = """
|
| 10 |
<!doctype html>
|
| 11 |
+
<html lang="en">
|
| 12 |
+
<head>
|
| 13 |
+
<meta charset="utf-8"/>
|
| 14 |
+
<title>Deployment UI</title>
|
| 15 |
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
| 16 |
+
<style>
|
| 17 |
+
:root { --gap: 12px; --pad: 12px; --border: 1px solid #ddd; --radius: 10px; }
|
| 18 |
+
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 20px; color: #111; }
|
| 19 |
+
h1 { margin: 0 0 6px; font-size: 20px; }
|
| 20 |
+
.row { display: flex; gap: var(--gap); flex-wrap: wrap; }
|
| 21 |
+
.col { flex: 1 1 360px; min-width: 320px; }
|
| 22 |
+
.card { border: var(--border); border-radius: var(--radius); padding: var(--pad); background: #fff; }
|
| 23 |
+
.btn { border: 1px solid #ccc; background: #f7f7f7; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
|
| 24 |
+
.btn:hover { background: #eee; }
|
| 25 |
+
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
|
| 26 |
+
input[type="text"] { width: 100%; padding: 8px; border: var(--border); border-radius: 8px; }
|
| 27 |
+
pre { white-space: pre-wrap; word-break: break-word; background: #fafafa; border: var(--border); border-radius: 8px; padding: 8px; max-height: 360px; overflow: auto; }
|
| 28 |
+
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
|
| 29 |
+
.muted { color: #666; }
|
| 30 |
+
.ok { color: #0a7f2e; }
|
| 31 |
+
.err { color: #9b1c1c; }
|
| 32 |
+
.kvs { font-size: 13px; }
|
| 33 |
+
.line { display:flex; gap:8px; align-items:center; margin: 6px 0; }
|
| 34 |
+
.small { font-size: 12px; }
|
| 35 |
+
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
</head>
|
| 37 |
<body>
|
| 38 |
+
<h1>Deployment UI</h1>
|
| 39 |
+
<div class="row">
|
| 40 |
+
<div class="col">
|
| 41 |
+
<div class="card">
|
| 42 |
+
<div class="line">
|
| 43 |
+
<label for="blobUrl"><strong>Blob URL</strong></label>
|
| 44 |
+
<span class="muted small">(defaults to <code class="mono">/modelblob.json</code>)</span>
|
| 45 |
+
</div>
|
| 46 |
+
<input id="blobUrl" type="text" placeholder="/modelblob.json"/>
|
| 47 |
+
<div class="line">
|
| 48 |
+
<button id="btnLoadBlob" class="btn">Load Blob</button>
|
| 49 |
+
<button id="btnIngest" class="btn" disabled>Ingest → BE</button>
|
| 50 |
+
<span id="blobStatus" class="small muted"></span>
|
| 51 |
+
</div>
|
| 52 |
+
<pre id="blobPreview" class="mono muted">Blob not loaded.</pre>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<div class="col">
|
| 57 |
+
<div class="card">
|
| 58 |
+
<div class="line"><strong>Actions</strong></div>
|
| 59 |
+
<div class="line">
|
| 60 |
+
<button id="btnCreate" class="btn" disabled>Create Instance</button>
|
| 61 |
+
<button id="btnStart" class="btn" disabled>Start</button>
|
| 62 |
+
<button id="btnWait" class="btn" disabled>Wait</button>
|
| 63 |
+
</div>
|
| 64 |
+
<div class="line">
|
| 65 |
+
<button id="btnStop" class="btn" disabled>Stop</button>
|
| 66 |
+
<button id="btnEndAll" class="btn" disabled>End All</button>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="kvs mono" id="stateKvs"></div>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
</div>
|
| 72 |
+
|
| 73 |
+
<div class="row" style="margin-top:12px;">
|
| 74 |
+
<div class="col">
|
| 75 |
+
<div class="card">
|
| 76 |
+
<div class="line"><strong>Logs</strong> <span class="muted small">(key responses)</span></div>
|
| 77 |
+
<pre id="logs" class="mono"></pre>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
</div>
|
| 81 |
+
|
| 82 |
<script>
|
| 83 |
+
const $ = (id) => document.getElementById(id);
|
| 84 |
+
const logsEl = $("logs");
|
| 85 |
+
const blobPreviewEl = $("blobPreview");
|
| 86 |
+
const blobStatusEl = $("blobStatus");
|
| 87 |
+
const stateKvsEl = $("stateKvs");
|
| 88 |
+
|
| 89 |
+
let cachedBlob = null;
|
| 90 |
+
let cachedPodId = null;
|
| 91 |
+
|
| 92 |
+
function logLine(s, cls="") {
|
| 93 |
+
const at = new Date().toLocaleTimeString();
|
| 94 |
+
const line = `[${at}] ${s}\\n`;
|
| 95 |
+
logsEl.textContent += line;
|
| 96 |
+
logsEl.scrollTop = logsEl.scrollHeight;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
function setActionsEnabled(enabled) {
|
| 100 |
+
$("btnCreate").disabled = !enabled;
|
| 101 |
+
$("btnStart").disabled = !enabled || !cachedPodId;
|
| 102 |
+
$("btnWait").disabled = !enabled || !cachedPodId;
|
| 103 |
+
$("btnStop").disabled = !enabled || !cachedPodId;
|
| 104 |
+
$("btnEndAll").disabled = !enabled || !cachedPodId;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
function updateStateKvs(obj) {
|
| 108 |
+
const st = obj || {};
|
| 109 |
+
const cs = (st.cachedState || {});
|
| 110 |
+
const kvs = [
|
| 111 |
+
["podId", cs.podId || ""],
|
| 112 |
+
["status", cs.status || ""],
|
| 113 |
+
["ip", cs.ip || ""],
|
| 114 |
+
["port", cs.port || ""],
|
| 115 |
+
["predictRoute", cs.predictRoute || ""],
|
| 116 |
+
["base", cs.base || ""],
|
| 117 |
+
];
|
| 118 |
+
stateKvsEl.innerHTML = kvs.map(([k,v]) => `<div><strong>${k}</strong>: <span class="mono">${String(v)}</span></div>`).join("");
|
| 119 |
+
if (cs.podId) cachedPodId = cs.podId;
|
| 120 |
+
setActionsEnabled(true);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
async function fetchJSON(url, opts={}) {
|
| 124 |
+
const r = await fetch(url, opts);
|
| 125 |
+
const ct = r.headers.get("content-type") || "";
|
| 126 |
+
if (!ct.includes("application/json")) {
|
| 127 |
+
const t = await r.text();
|
| 128 |
+
throw new Error(`Non-JSON response ${r.status}: ${t.slice(0,200)}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
}
|
| 130 |
+
const j = await r.json();
|
| 131 |
+
if (!r.ok) throw new Error(JSON.stringify(j).slice(0,200));
|
| 132 |
+
return j;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
function pretty(obj) {
|
| 136 |
+
try { return JSON.stringify(obj, null, 2); } catch { return String(obj); }
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
$("btnLoadBlob").addEventListener("click", async () => {
|
| 140 |
+
const url = ($("blobUrl").value || "/modelblob.json").trim();
|
| 141 |
+
blobStatusEl.textContent = "Loading…";
|
| 142 |
+
try {
|
| 143 |
+
const j = await fetchJSON(url, { method: "GET" });
|
| 144 |
+
cachedBlob = j;
|
| 145 |
+
blobPreviewEl.textContent = pretty(j);
|
| 146 |
+
blobPreviewEl.classList.remove("muted");
|
| 147 |
+
blobStatusEl.textContent = "Blob loaded";
|
| 148 |
+
$("btnIngest").disabled = false;
|
| 149 |
+
logLine(`BLOB_LOADED from ${url}`);
|
| 150 |
+
} catch (e) {
|
| 151 |
+
blobStatusEl.textContent = "Load failed";
|
| 152 |
+
blobPreviewEl.textContent = String(e.message || e);
|
| 153 |
+
blobPreviewEl.classList.remove("muted");
|
| 154 |
+
$("btnIngest").disabled = true;
|
| 155 |
+
logLine(`BLOB_LOAD_ERROR ${e.message || e}`, "err");
|
| 156 |
}
|
| 157 |
+
});
|
| 158 |
+
|
| 159 |
+
$("btnIngest").addEventListener("click", async () => {
|
| 160 |
+
const url = ($("blobUrl").value || "/modelblob.json").trim();
|
| 161 |
+
blobStatusEl.textContent = "Ingesting…";
|
| 162 |
+
try {
|
| 163 |
+
const j = await fetchJSON(`/api/ingest/from_landing?blob_url=${encodeURIComponent(url)}`, { method: "POST" });
|
| 164 |
+
blobStatusEl.textContent = `Ingested (${j.source || url})`;
|
| 165 |
+
$("btnCreate").disabled = false;
|
| 166 |
+
logLine(`BLOB_INGEST_OK source=${j.source || url}`);
|
| 167 |
+
} catch (e) {
|
| 168 |
+
blobStatusEl.textContent = "Ingest failed";
|
| 169 |
+
logLine(`BLOB_INGEST_ERROR ${e.message || e}`, "err");
|
| 170 |
}
|
| 171 |
+
});
|
| 172 |
+
|
| 173 |
+
$("btnCreate").addEventListener("click", async () => {
|
| 174 |
+
setActionsEnabled(false);
|
| 175 |
+
logLine("CREATE → /api/compute/create_instance");
|
| 176 |
+
try {
|
| 177 |
+
const j = await fetchJSON("/api/compute/create_instance", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
|
| 178 |
+
logLine("CREATE_OK " + (j.id || j.podId || JSON.stringify(j).slice(0,120)));
|
| 179 |
+
await refreshStatus();
|
| 180 |
+
} catch (e) {
|
| 181 |
+
logLine("CREATE_ERROR " + (e.message || e), "err");
|
| 182 |
+
} finally {
|
| 183 |
+
setActionsEnabled(true);
|
| 184 |
}
|
| 185 |
+
});
|
| 186 |
+
|
| 187 |
+
$("btnStart").addEventListener("click", async () => {
|
| 188 |
+
if (!cachedPodId) return;
|
| 189 |
+
setActionsEnabled(false);
|
| 190 |
+
logLine(`START → /api/compute/pods/${cachedPodId}/start`);
|
| 191 |
+
try {
|
| 192 |
+
const j = await fetchJSON(`/api/compute/pods/${cachedPodId}/start`, { method: "POST" });
|
| 193 |
+
logLine("START_OK " + JSON.stringify(j).slice(0,120));
|
| 194 |
+
} catch (e) {
|
| 195 |
+
logLine("START_ERROR " + (e.message || e), "err");
|
| 196 |
+
} finally {
|
| 197 |
+
setActionsEnabled(true);
|
| 198 |
}
|
| 199 |
+
});
|
| 200 |
+
|
| 201 |
+
$("btnWait").addEventListener("click", async () => {
|
| 202 |
+
await refreshStatus(true);
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
$("btnStop").addEventListener("click", async () => {
|
| 206 |
+
setActionsEnabled(false);
|
| 207 |
+
logLine("STOP → /api/compute/delete_instance");
|
| 208 |
+
try {
|
| 209 |
+
const j = await fetchJSON("/api/compute/delete_instance", { method: "DELETE" });
|
| 210 |
+
logLine("STOP_OK " + JSON.stringify(j).slice(0,120));
|
| 211 |
+
} catch (e) {
|
| 212 |
+
logLine("STOP_ERROR " + (e.message || e), "err");
|
| 213 |
+
} finally {
|
| 214 |
+
await refreshStatus();
|
| 215 |
+
setActionsEnabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
}
|
| 217 |
+
});
|
| 218 |
+
|
| 219 |
+
$("btnEndAll").addEventListener("click", async () => {
|
| 220 |
+
if (!cachedPodId) return;
|
| 221 |
+
setActionsEnabled(false);
|
| 222 |
+
logLine(`END_ALL → /api/compute/end_all`);
|
| 223 |
+
try {
|
| 224 |
+
const j = await fetchJSON("/api/compute/end_all", { method: "DELETE" });
|
| 225 |
+
logLine("END_ALL_OK " + JSON.stringify(j).slice(0,120));
|
| 226 |
+
} catch (e) {
|
| 227 |
+
logLine("END_ALL_ERROR " + (e.message || e), "err");
|
| 228 |
+
} finally {
|
| 229 |
+
await refreshStatus();
|
| 230 |
+
setActionsEnabled(true);
|
| 231 |
}
|
| 232 |
+
});
|
| 233 |
+
|
| 234 |
+
async function refreshStatus(verbose=false) {
|
| 235 |
+
try {
|
| 236 |
+
const j = await fetchJSON("/api/compute/pods/placeholder?pod_id=", { method: "GET" });
|
| 237 |
+
if (verbose) logLine("STATUS " + JSON.stringify(j).slice(0,180));
|
| 238 |
+
updateStateKvs(j);
|
| 239 |
+
} catch (e) {
|
| 240 |
+
logLine("STATUS_ERROR " + (e.message || e), "err");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
}
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
// On load: try to show current state (if any); do NOT auto-ingest.
|
| 245 |
+
refreshStatus();
|
|
|
|
|
|
|
| 246 |
</script>
|
| 247 |
+
</body>
|
| 248 |
+
</html>
|
| 249 |
"""
|
| 250 |
+
return HTMLResponse(html)
|