fix(logs): add ?id= deep-link to logs viewer, fix queue entry link target
This commit is contained in:
parent
5f05caee31
commit
b5503cde2c
2 changed files with 16 additions and 2 deletions
|
|
@ -73,7 +73,7 @@ import {
|
|||
}
|
||||
const ul = el('ul', { class: 'build-logs-list' });
|
||||
for (const h of rows) {
|
||||
const li = el('li', { class: 'build-logs-item' });
|
||||
const li = el('li', { class: 'build-logs-item', 'data-log-id': String(h.id) });
|
||||
// status is null while running, 'ok'/'fail' when finished.
|
||||
const live = !h.status;
|
||||
const ok = h.status === 'ok';
|
||||
|
|
@ -175,6 +175,20 @@ import {
|
|||
ul.append(li);
|
||||
}
|
||||
buildList.append(ul);
|
||||
// Deep-link: if the URL contains ?id=N, auto-expand that log entry
|
||||
// so a `logs →` link from the rebuild-queue panel drops the operator
|
||||
// straight into the live output without extra clicks.
|
||||
const deepId = new URLSearchParams(location.search).get('id');
|
||||
if (deepId) {
|
||||
const target = ul.querySelector('[data-log-id="' + deepId + '"]');
|
||||
if (target) {
|
||||
const btn = target.querySelector('.build-logs-row-btn');
|
||||
if (btn) {
|
||||
btn.click();
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
buildList.replaceChildren();
|
||||
buildList.append(el('p', { class: 'meta' }, 'fetch failed: ' + err));
|
||||
|
|
|
|||
|
|
@ -2274,7 +2274,7 @@ window.marked = marked;
|
|||
' ',
|
||||
el('a', {
|
||||
class: 'rqe-log-link',
|
||||
href: '/api/build-logs/id/' + entry.build_log_id,
|
||||
href: '/logs.html?id=' + entry.build_log_id + '#build',
|
||||
target: '_blank',
|
||||
title: 'view build log #' + entry.build_log_id,
|
||||
}, 'logs →'),
|
||||
|
|
|
|||
Loading…
Reference in a new issue