build-logs viewer: add --crust var + aria-expanded on row buttons (argus nits)
This commit is contained in:
parent
cc6227ccb5
commit
c4ce91b61f
3 changed files with 11 additions and 4 deletions
|
|
@ -1126,7 +1126,7 @@ window.marked = marked;
|
|||
const age = h.started_at
|
||||
? fmtAgeSecs(nowUnix - h.started_at) + ' ago' : '?';
|
||||
const rowBtn = el('button',
|
||||
{ type: 'button', class: 'build-logs-row-btn' },
|
||||
{ type: 'button', class: 'build-logs-row-btn', 'aria-expanded': 'false' },
|
||||
el('span', { class: `badge ${statusCls}` }, statusLabel),
|
||||
el('span', { class: 'build-logs-kind' }, h.kind),
|
||||
el('span', { class: 'build-logs-age meta' }, age),
|
||||
|
|
@ -1136,10 +1136,15 @@ window.marked = marked;
|
|||
detail.hidden = true;
|
||||
let loaded = false;
|
||||
rowBtn.addEventListener('click', async () => {
|
||||
if (!detail.hidden) { detail.hidden = true; return; }
|
||||
if (!detail.hidden) {
|
||||
detail.hidden = true;
|
||||
rowBtn.setAttribute('aria-expanded', 'false');
|
||||
return;
|
||||
}
|
||||
if (!loaded) {
|
||||
detail.textContent = 'fetching…';
|
||||
detail.hidden = false;
|
||||
rowBtn.setAttribute('aria-expanded', 'true');
|
||||
try {
|
||||
const r2 = await fetch('/api/build-logs/id/' + h.id);
|
||||
if (!r2.ok) {
|
||||
|
|
@ -1156,6 +1161,7 @@ window.marked = marked;
|
|||
}
|
||||
} else {
|
||||
detail.hidden = false;
|
||||
rowBtn.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
});
|
||||
li.append(rowBtn, detail);
|
||||
|
|
|
|||
Loading…
Reference in a new issue