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');
|
const flow = $('msgflow');
|
||||||
if (!flow) return;
|
if (!flow) return;
|
||||||
flow.innerHTML = '';
|
flow.replaceChildren();
|
||||||
const tsFmt = (n) => new Date(n * 1000).toISOString().slice(11, 19);
|
const tsFmt = (n) => new Date(n * 1000).toISOString().slice(11, 19);
|
||||||
// Pulse the page banner whenever a broker event lands. The
|
// Pulse the page banner whenever a broker event lands. The
|
||||||
// `.banner` element lives in the dashboard's <footer> rather than
|
// `.banner` element lives in the dashboard's <footer> rather than
|
||||||
|
|
@ -286,11 +286,11 @@ import {
|
||||||
}
|
}
|
||||||
function hideSuggest() {
|
function hideSuggest() {
|
||||||
suggest.hidden = true;
|
suggest.hidden = true;
|
||||||
suggest.innerHTML = '';
|
suggest.replaceChildren();
|
||||||
suggestActive = -1;
|
suggestActive = -1;
|
||||||
}
|
}
|
||||||
function renderSuggest(matches) {
|
function renderSuggest(matches) {
|
||||||
suggest.innerHTML = '';
|
suggest.replaceChildren();
|
||||||
if (!matches.length) { hideSuggest(); return; }
|
if (!matches.length) { hideSuggest(); return; }
|
||||||
for (let i = 0; i < matches.length; i += 1) {
|
for (let i = 0; i < matches.length; i += 1) {
|
||||||
const item = document.createElement('div');
|
const item = document.createElement('div');
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ import {
|
||||||
|
|
||||||
async function fetchBuild() {
|
async function fetchBuild() {
|
||||||
if (!buildList) return;
|
if (!buildList) return;
|
||||||
buildList.innerHTML = '';
|
buildList.replaceChildren();
|
||||||
buildList.append(el('p', { class: 'meta' }, 'loading…'));
|
buildList.append(el('p', { class: 'meta' }, 'loading…'));
|
||||||
try {
|
try {
|
||||||
const resp = await fetch('/api/build-logs?limit=30');
|
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();
|
const rows = await resp.json();
|
||||||
buildList.innerHTML = '';
|
buildList.replaceChildren();
|
||||||
if (!rows || rows.length === 0) {
|
if (!rows || rows.length === 0) {
|
||||||
buildList.append(el('p', { class: 'meta' }, '(no build logs yet)'));
|
buildList.append(el('p', { class: 'meta' }, '(no build logs yet)'));
|
||||||
return;
|
return;
|
||||||
|
|
@ -111,7 +111,7 @@ import {
|
||||||
}
|
}
|
||||||
// already loaded?
|
// already loaded?
|
||||||
if (detail.dataset.loaded) return;
|
if (detail.dataset.loaded) return;
|
||||||
detail.innerHTML = '';
|
detail.replaceChildren();
|
||||||
detail.append(
|
detail.append(
|
||||||
el('a', {
|
el('a', {
|
||||||
href: '/api/build-logs/id/' + h.id + '/raw',
|
href: '/api/build-logs/id/' + h.id + '/raw',
|
||||||
|
|
@ -176,7 +176,7 @@ import {
|
||||||
}
|
}
|
||||||
buildList.append(ul);
|
buildList.append(ul);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
buildList.innerHTML = '';
|
buildList.replaceChildren();
|
||||||
buildList.append(el('p', { class: 'meta' }, 'fetch failed: ' + err));
|
buildList.append(el('p', { class: 'meta' }, 'fetch failed: ' + err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ import {
|
||||||
if (!resp.ok) return;
|
if (!resp.ok) return;
|
||||||
const state = await resp.json();
|
const state = await resp.json();
|
||||||
if (!agentSelect) return;
|
if (!agentSelect) return;
|
||||||
agentSelect.innerHTML = '';
|
agentSelect.replaceChildren();
|
||||||
agentSelect.append(el('option', { value: '' }, '— select agent —'));
|
agentSelect.append(el('option', { value: '' }, '— select agent —'));
|
||||||
for (const c of (state.containers || [])) {
|
for (const c of (state.containers || [])) {
|
||||||
agentSelect.append(el('option', { value: c.name }, c.name));
|
agentSelect.append(el('option', { value: c.name }, c.name));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue