chore: replaceChildren + http case in flow.js and logs.js
Same cleanup as the previous pass (tabs.js, app.js): replace innerHTML = '' with replaceChildren() and lowercase the one uppercase 'HTTP' error in logs.js.
This commit is contained in:
parent
9450cd8a7e
commit
146a6b7cd5
2 changed files with 9 additions and 9 deletions
|
|
@ -101,7 +101,7 @@ import {
|
|||
(() => {
|
||||
const flow = $('msgflow');
|
||||
if (!flow) return;
|
||||
flow.innerHTML = '';
|
||||
flow.replaceChildren();
|
||||
const tsFmt = (n) => new Date(n * 1000).toISOString().slice(11, 19);
|
||||
// Pulse the page banner whenever a broker event lands. The
|
||||
// `.banner` element lives in the dashboard's <footer> rather than
|
||||
|
|
@ -286,11 +286,11 @@ import {
|
|||
}
|
||||
function hideSuggest() {
|
||||
suggest.hidden = true;
|
||||
suggest.innerHTML = '';
|
||||
suggest.replaceChildren();
|
||||
suggestActive = -1;
|
||||
}
|
||||
function renderSuggest(matches) {
|
||||
suggest.innerHTML = '';
|
||||
suggest.replaceChildren();
|
||||
if (!matches.length) { hideSuggest(); return; }
|
||||
for (let i = 0; i < matches.length; i += 1) {
|
||||
const item = document.createElement('div');
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@ import {
|
|||
|
||||
async function fetchBuild() {
|
||||
if (!buildList) return;
|
||||
buildList.innerHTML = '';
|
||||
buildList.replaceChildren();
|
||||
buildList.append(el('p', { class: 'meta' }, 'loading…'));
|
||||
try {
|
||||
const resp = await fetch('/api/build-logs?limit=30');
|
||||
if (!resp.ok) throw new Error('HTTP ' + resp.status);
|
||||
if (!resp.ok) throw new Error('http ' + resp.status);
|
||||
const rows = await resp.json();
|
||||
buildList.innerHTML = '';
|
||||
buildList.replaceChildren();
|
||||
if (!rows || rows.length === 0) {
|
||||
buildList.append(el('p', { class: 'meta' }, '(no build logs yet)'));
|
||||
return;
|
||||
|
|
@ -111,7 +111,7 @@ import {
|
|||
}
|
||||
// already loaded?
|
||||
if (detail.dataset.loaded) return;
|
||||
detail.innerHTML = '';
|
||||
detail.replaceChildren();
|
||||
detail.append(
|
||||
el('a', {
|
||||
href: '/api/build-logs/id/' + h.id + '/raw',
|
||||
|
|
@ -176,7 +176,7 @@ import {
|
|||
}
|
||||
buildList.append(ul);
|
||||
} catch (err) {
|
||||
buildList.innerHTML = '';
|
||||
buildList.replaceChildren();
|
||||
buildList.append(el('p', { class: 'meta' }, 'fetch failed: ' + err));
|
||||
}
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ import {
|
|||
if (!resp.ok) return;
|
||||
const state = await resp.json();
|
||||
if (!agentSelect) return;
|
||||
agentSelect.innerHTML = '';
|
||||
agentSelect.replaceChildren();
|
||||
agentSelect.append(el('option', { value: '' }, '— select agent —'));
|
||||
for (const c of (state.containers || [])) {
|
||||
agentSelect.append(el('option', { value: c.name }, c.name));
|
||||
|
|
|
|||
Loading…
Reference in a new issue