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
|
|
@ -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