feat: 2.1.0 incidents, filter bar and IP analysis redesign; probe egress files fix
CI / Format and vet (pull_request) Successful in 1m1s
CI / Dependency audit (pull_request) Successful in 32s
CI / Tests (Linux, race detector) (pull_request) Successful in 1m55s
Release / Plan (reuse the published image?) (push) Successful in 4s
Release / ci (push) Skipped
Release / Build hub image (amd64) (push) Skipped
Release / Build probe image (amd64) (push) Skipped
Release / Build hub image (arm64) (push) Skipped
Release / Build probe image (arm64) (push) Skipped
Release / Publish tags (hub) (push) Skipped
Release / Publish tags (probe) (push) Skipped
Release / Gitea release (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 23:18:38 -03:00
1 parent 7c92d4b359
commit 00c4ab6d4a
15 files changed
+1063 -238

No files matched your search

+226 -65
View File
@@ -1861,32 +1861,79 @@
route();
}
// ---------------------------------------------------------------- range picker
// ---------------------------------------------------------------- filter bar (period + host)
// One period control (relative presets + absolute window), one host control with probe status,
// a summary of what is applied (with "clear" and "copy link") and a live/fixed indicator.
// Everything is written to the URL hash (setShell), so any state can be shared and restored.
// Popovers on desktop, bottom sheets under 768px. Keys: t (period), Esc, arrows inside a list.
var rp = { open: false, pop: null, btn: null, from: null, to: null, err: null };
var hp = { open: false, pop: null, btn: null };
var DEFAULT_RANGE = '24h';
function localInput(ts) {
var d = new Date(ts * 1000), p = function (n) { return String(n).padStart(2, '0'); };
return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) + 'T' + p(d.getHours()) + ':' + p(d.getMinutes());
}
function presetButtons() { return rp.pop ? Array.prototype.slice.call(rp.pop.querySelectorAll('.chip-btn')) : []; }
// short name of the browser time zone ("GMT-3", "UTC"); dates in the bar and in the inputs use it
function tzName() {
try {
var part = new Intl.DateTimeFormat(lang, { timeZoneName: 'short' }).formatToParts(new Date()).filter(function (x) { return x.type === 'timeZoneName'; })[0];
if (part) return part.value;
} catch (e) { /* old engine */ }
var m = -new Date().getTimezoneOffset();
return 'UTC' + (m >= 0 ? '+' : '-') + Math.floor(Math.abs(m) / 60);
}
function tzFull() { try { return Intl.DateTimeFormat().resolvedOptions().timeZone || tzName(); } catch (e) { return tzName(); } }
function svgIcon(d) { var n = iconNode('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' + d + '</svg>'); n.setAttribute('aria-hidden', 'true'); return n; }
var IC = {
clock: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',
server: '<rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/>',
caret: '<path d="m6 9 6 6 6-6"/>', prev: '<path d="m15 6-6 6 6 6"/>', next: '<path d="m9 6 6 6-6 6"/>',
close: '<path d="M6 6l12 12M18 6 6 18"/>', link: '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>',
check: '<path d="m5 12 5 5 9-10"/>'
};
function presetButtons() { return rp.pop ? Array.prototype.slice.call(rp.pop.querySelectorAll('.fb-chip')) : []; }
function hostOptions() { return hp.pop ? Array.prototype.slice.call(hp.pop.querySelectorAll('.fb-opt')) : []; }
function isDefaultSlice() { return !isCustom() && state.range === DEFAULT_RANGE && state.host === 'all' && state.domain === 'all'; }
function customLabel() { return shortDate(state.from) + ' – ' + shortDate(state.to); }
function renderRangePicker() {
if (!rp.btn) return;
rp.label.textContent = rangeShort();
var custom = isCustom();
document.querySelectorAll('#range-picker [data-range]').forEach(function (b) { b.setAttribute('aria-pressed', !custom && b.getAttribute('data-range') === state.range ? 'true' : 'false'); });
if (rp.from) { var now = Math.floor(Date.now() / 1000); rp.from.value = localInput(custom ? state.from : now - presetSecs(state.range)); rp.to.value = localInput(custom ? state.to : now); }
rp.label.textContent = custom ? customLabel() : rangeShort();
rp.tz.textContent = tzName();
rp.btn.title = t('fb.period.title', { tz: tzFull() });
rp.btn.classList.toggle('is-custom', custom);
rp.prev.hidden = rp.next.hidden = !custom;
if (custom) rp.next.disabled = state.to >= Math.floor(Date.now() / 1000) - 60;
presetButtons().forEach(function (b) { b.setAttribute('aria-pressed', !custom && b.getAttribute('data-range') === state.range ? 'true' : 'false'); });
if (rp.from) {
var now = Math.floor(Date.now() / 1000);
rp.from.min = rp.to.min = localInput(now - MAX_SPAN); rp.from.max = rp.to.max = localInput(now);
if (!rp.open) { rp.from.value = localInput(custom ? state.from : now - presetSecs(state.range)); rp.to.value = localInput(custom ? state.to : now); }
rp.tzNote.textContent = t('fb.tz', { tz: tzFull() === tzName() ? tzName() : tzFull() + ' (' + tzName() + ')' });
}
renderHostPicker();
}
function closeRangePicker(refocus) {
if (!rp.open) return;
rp.open = false; rp.pop.hidden = true; rp.scrim.hidden = true; rp.btn.setAttribute('aria-expanded', 'false');
if (refocus) rp.btn.focus();
function closePop(o, refocus) {
if (!o.open) return;
o.open = false; o.pop.hidden = true; o.scrim.hidden = true; o.btn.setAttribute('aria-expanded', 'false');
document.documentElement.classList.remove('fb-lock');
if (refocus) o.btn.focus();
}
function openPop(o, focusSel) {
if (!o.pop) return;
closePop(o === rp ? hp : rp, false);
o.open = true; o.pop.hidden = false; o.scrim.hidden = false; o.btn.setAttribute('aria-expanded', 'true');
if (matchMedia('(max-width: 767px)').matches) document.documentElement.classList.add('fb-lock');
var cur = o.pop.querySelector(focusSel) || o.pop.querySelector('button');
if (cur) cur.focus();
}
// closes whichever filter popover is open (kept under this name: Esc and other pages call it)
function closeRangePicker(refocus) { closePop(rp, refocus); closePop(hp, refocus); }
function openRangePicker() {
if (!rp.pop) return;
renderRangePicker();
rp.open = false; renderRangePicker();
rp.err.textContent = '';
rp.open = true; rp.pop.hidden = false; rp.scrim.hidden = false; rp.btn.setAttribute('aria-expanded', 'true');
var cur = rp.pop.querySelector('.chip-btn[aria-pressed="true"]') || rp.pop.querySelector('.chip-btn');
if (cur) cur.focus();
openPop(rp, '.fb-chip[aria-pressed="true"]');
}
function stepPreset(dir) {
var i = PRESETS.indexOf(state.range);
@@ -1898,68 +1945,179 @@
if (!isCustom()) return;
var span = state.to - state.from, now = Math.floor(Date.now() / 1000), nf2 = state.from + dir * span, nt = state.to + dir * span;
if (nt > now) { nt = now; nf2 = now - span; }
if (nf2 < now - MAX_SPAN) { nf2 = now - MAX_SPAN; nt = Math.min(now, nf2 + span); }
if (nf2 === state.from && nt === state.to) return;
setShell({ from: nf2, to: nt });
}
function applyCustom() {
var a = Date.parse(rp.from.value), b = Date.parse(rp.to.value);
var a = Date.parse(rp.from.value), b = Date.parse(rp.to.value), now = Date.now();
var msg = '';
if (!isFinite(a) || !isFinite(b)) msg = t('range.err.missing');
else if (b <= a) msg = t('range.err.order');
else if ((b - a) / 1000 > MAX_SPAN) msg = t('range.err.span');
else if (a < now - MAX_SPAN * 1000 - 60000) msg = t('fb.err.old');
else if (a > now) msg = t('fb.err.future');
rp.err.textContent = msg;
rp.from.setAttribute('aria-invalid', msg ? 'true' : 'false'); rp.to.setAttribute('aria-invalid', msg ? 'true' : 'false');
if (msg) return;
closeRangePicker(true);
setShell({ from: Math.floor(a / 1000), to: Math.floor(b / 1000) });
setShell({ from: Math.floor(a / 1000), to: Math.floor(Math.min(b, now) / 1000) });
}
function sheetHead(title, o) {
var x = el('button', { type: 'button', class: 'btn icon fb-x', 'aria-label': t('fb.close') }, svgIcon(IC.close));
x.addEventListener('click', function () { closePop(o, true); });
return h('div', 'fb-head', h('h2', null, title), x);
}
// arrows move between the buttons of one list; Esc closes and returns focus to the trigger
function popKeys(o, list) {
o.pop.addEventListener('keydown', function (e) {
if (e.key === 'Escape') { e.stopPropagation(); closePop(o, true); return; }
var items = list(), i = items.indexOf(e.target);
if (i < 0) return;
var d = { ArrowLeft: -1, ArrowUp: -1, ArrowRight: 1, ArrowDown: 1 }[e.key];
if (e.key === 'Home') { e.preventDefault(); items[0].focus(); }
else if (e.key === 'End') { e.preventDefault(); items[items.length - 1].focus(); }
else if (d) { e.preventDefault(); items[(i + d + items.length) % items.length].focus(); }
});
// keep Tab inside the sheet on phones
o.pop.addEventListener('keydown', function (e) {
if (e.key !== 'Tab' || !matchMedia('(max-width: 767px)').matches) return;
var f = Array.prototype.slice.call(o.pop.querySelectorAll('button:not([disabled]), input')).filter(function (n) { return n.offsetParent; });
if (!f.length) return;
if (e.shiftKey && document.activeElement === f[0]) { e.preventDefault(); f[f.length - 1].focus(); }
else if (!e.shiftKey && document.activeElement === f[f.length - 1]) { e.preventDefault(); f[0].focus(); }
});
}
function mkScrim(o) { var s = h('div', 'fb-scrim'); s.hidden = true; s.addEventListener('click', function () { closePop(o, true); }); return s; }
function buildRangePicker() {
var box = $('#range-picker');
clear(box);
rp.btn = el('button', { type: 'button', class: 'btn rp-btn', 'aria-haspopup': 'dialog', 'aria-expanded': 'false', 'aria-controls': 'rp-pop', 'aria-label': t('range.picker'), title: t('range.keys') });
rp.label = h('span', 'rp-label');
rp.btn.appendChild(rp.label);
rp.btn.appendChild(h('span', 'rp-caret', '\u25BE'));
rp.btn.lastChild.setAttribute('aria-hidden', 'true');
rp.btn.addEventListener('click', function () { rp.open ? closeRangePicker(true) : openRangePicker(); });
var sc = h('div', 'seg rp-shortcuts');
sc.setAttribute('role', 'group'); sc.setAttribute('aria-label', t('range.label'));
SHORTCUTS.forEach(function (p) {
var b = el('button', { type: 'button', 'data-range': p }, parseInt(p, 10) + ' ' + p.slice(-1));
b.addEventListener('click', function () { setShell({ range: p, from: null, to: null }); });
sc.appendChild(b);
});
rp.pop = h('div', 'popover rp-pop');
rp.btn = el('button', { type: 'button', class: 'fb-trigger fb-period', 'aria-haspopup': 'dialog', 'aria-expanded': 'false', 'aria-controls': 'rp-pop' });
rp.label = h('span', 'fb-val');
rp.tz = h('span', 'fb-tz');
rp.btn.appendChild(svgIcon(IC.clock));
rp.btn.appendChild(h('span', 'fb-txt', h('span', 'fb-k', t('range.label')), rp.label));
rp.btn.appendChild(rp.tz);
rp.btn.appendChild(h('span', 'fb-caret', svgIcon(IC.caret)));
rp.btn.addEventListener('click', function () { rp.open ? closePop(rp, true) : openRangePicker(); });
rp.prev = el('button', { type: 'button', class: 'fb-step', 'aria-label': t('fb.prev'), title: t('fb.prev') + ' (←)' }, svgIcon(IC.prev));
rp.next = el('button', { type: 'button', class: 'fb-step', 'aria-label': t('fb.next'), title: t('fb.next') + ' (→)' }, svgIcon(IC.next));
rp.prev.addEventListener('click', function () { shiftWindow(-1); });
rp.next.addEventListener('click', function () { shiftWindow(1); });
rp.pop = h('div', 'fb-pop fb-pop-period');
rp.pop.id = 'rp-pop'; rp.pop.setAttribute('role', 'dialog'); rp.pop.setAttribute('aria-label', t('range.picker')); rp.pop.hidden = true;
rp.pop.appendChild(sheetHead(t('range.picker'), rp));
var rel = h('div', 'fb-col fb-rel');
rel.appendChild(h('div', 'fb-title', t('fb.relative')));
PRESET_GROUPS.forEach(function (g) {
var grp = h('div', 'chip-group');
var grp = h('div', 'fb-chips');
grp.setAttribute('role', 'group'); grp.setAttribute('aria-label', t(g[0]));
g[1].forEach(function (p) {
var b = el('button', { type: 'button', class: 'chip-btn', 'data-range': p, 'aria-pressed': 'false' }, parseInt(p, 10) + ' ' + p.slice(-1));
var n = parseInt(p, 10), lbl = p.slice(-1) === 'h' ? pl('range.nh', n, { n: nf(n) }) : pl('range.nd', n, { n: nf(n) });
var b = el('button', { type: 'button', class: 'fb-chip', 'data-range': p, 'aria-pressed': 'false', 'aria-label': lbl, title: lbl }, nf(n) + ' ' + p.slice(-1));
b.addEventListener('click', function () { closeRangePicker(true); setShell({ range: p, from: null, to: null }); });
grp.appendChild(b);
});
rp.pop.appendChild(h('div', 'rp-group', h('div', 'rp-title', t(g[0])), grp));
rel.appendChild(h('div', 'fb-grp', h('span', 'fb-sub', t(g[0])), grp));
});
rp.from = el('input', { type: 'datetime-local', id: 'rp-from' }); rp.to = el('input', { type: 'datetime-local', id: 'rp-to' });
rp.err = h('p', 'rp-err'); rp.err.setAttribute('role', 'alert');
var apply = el('button', { type: 'button', class: 'btn primary' }, t('range.apply'));
var abs = h('div', 'fb-col fb-abs');
rp.from = el('input', { type: 'datetime-local', id: 'rp-from', 'aria-describedby': 'rp-tz rp-err' });
rp.to = el('input', { type: 'datetime-local', id: 'rp-to', 'aria-describedby': 'rp-tz rp-err' });
rp.err = h('p', 'fb-err'); rp.err.id = 'rp-err'; rp.err.setAttribute('role', 'alert');
rp.tzNote = h('p', 'fb-note'); rp.tzNote.id = 'rp-tz';
var apply = el('button', { type: 'button', class: 'btn primary fb-apply' }, t('range.apply'));
apply.addEventListener('click', applyCustom);
rp.pop.appendChild(h('div', 'rp-group rp-custom', h('div', 'rp-title', t('range.custom')),
h('label', null, h('span', null, t('range.from')), rp.from), h('label', null, h('span', null, t('range.to')), rp.to), rp.err, apply));
rp.pop.appendChild(h('p', 'note rp-keys', t('range.keys')));
rp.pop.addEventListener('keydown', function (e) {
var tg = e.target;
if (e.key === 'Escape') { e.stopPropagation(); closeRangePicker(true); return; }
if (tg.classList && tg.classList.contains('chip-btn') && ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].indexOf(e.key) >= 0) {
var list = presetButtons(), i = list.indexOf(tg), d = (e.key === 'ArrowLeft' || e.key === 'ArrowUp') ? -1 : 1;
e.preventDefault(); list[(i + d + list.length) % list.length].focus();
}
});
rp.scrim = h('div', 'scrim rp-scrim'); rp.scrim.hidden = true;
rp.scrim.addEventListener('click', function () { closeRangePicker(true); });
box.appendChild(rp.btn); box.appendChild(sc); box.appendChild(rp.pop); box.appendChild(rp.scrim);
[rp.from, rp.to].forEach(function (i) { i.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); applyCustom(); } }); });
abs.appendChild(h('div', 'fb-title', t('fb.absolute')));
abs.appendChild(el('label', { class: 'fb-field', for: 'rp-from' }, h('span', null, t('range.from')), rp.from));
abs.appendChild(el('label', { class: 'fb-field', for: 'rp-to' }, h('span', null, t('range.to')), rp.to));
abs.appendChild(rp.tzNote); abs.appendChild(h('p', 'fb-note', t('fb.retention')));
abs.appendChild(rp.err); abs.appendChild(apply);
rp.pop.appendChild(h('div', 'fb-cols', rel, abs));
rp.pop.appendChild(h('p', 'fb-keys', t('range.keys')));
popKeys(rp, presetButtons);
rp.scrim = mkScrim(rp);
box.appendChild(rp.prev); box.appendChild(rp.btn); box.appendChild(rp.next); box.appendChild(rp.pop); box.appendChild(rp.scrim);
rp.open = false;
buildHostPicker();
buildSummary();
renderRangePicker();
}
// ---- host picker: hosts are the probes; shows online/offline and how many are up
function buildHostPicker() {
var box = $('#host-picker');
if (!box) return;
clear(box);
hp.btn = el('button', { type: 'button', class: 'fb-trigger fb-host', 'aria-haspopup': 'dialog', 'aria-expanded': 'false', 'aria-controls': 'hp-pop' });
hp.dot = h('span', 'fb-dot');
hp.label = h('span', 'fb-val');
hp.count = h('span', 'fb-count');
hp.btn.appendChild(svgIcon(IC.server));
hp.btn.appendChild(h('span', 'fb-txt', h('span', 'fb-k', t('host.label')), h('span', 'fb-valrow', hp.dot, hp.label)));
hp.btn.appendChild(hp.count);
hp.btn.appendChild(h('span', 'fb-caret', svgIcon(IC.caret)));
hp.btn.addEventListener('click', function () { hp.open ? closePop(hp, true) : openPop(hp, '.fb-opt[aria-pressed="true"]'); });
hp.pop = h('div', 'fb-pop fb-pop-host');
hp.pop.id = 'hp-pop'; hp.pop.setAttribute('role', 'dialog'); hp.pop.setAttribute('aria-label', t('fb.host.pick')); hp.pop.hidden = true;
hp.list = h('div', 'fb-opts'); hp.list.setAttribute('role', 'group'); hp.list.setAttribute('aria-label', t('host.label'));
hp.pop.appendChild(sheetHead(t('fb.host.pick'), hp));
hp.pop.appendChild(hp.list);
popKeys(hp, hostOptions);
hp.scrim = mkScrim(hp);
box.appendChild(hp.btn); box.appendChild(hp.pop); box.appendChild(hp.scrim);
box.hidden = true;
}
function hostOpt(value, name, meta, tone) {
var on = state.host === value;
var b = el('button', { type: 'button', class: 'fb-opt', 'data-host': value, 'aria-pressed': on ? 'true' : 'false' },
h('span', 'fb-dot ' + tone), h('span', 'fb-opt-t', h('span', 'fb-opt-n', name), h('span', 'fb-opt-m', meta)), h('span', 'fb-tick', svgIcon(IC.check)));
b.addEventListener('click', function () { closePop(hp, true); if (state.host !== value) setShell({ host: value }); });
return b;
}
function renderHostPicker() {
if (!hp.btn) return;
var hosts = state.hostList || [], on = hosts.filter(function (x) { return x.online; }).length;
$('#host-picker').hidden = hosts.length < 2;
var cur = hosts.filter(function (x) { return x.name === state.host; })[0];
hp.label.textContent = state.host === 'all' ? t('host.all') : state.host;
var tone = state.host === 'all' ? (on === hosts.length ? 'on' : on ? 'warn' : 'off') : (cur && cur.online ? 'on' : 'off');
hp.dot.className = 'fb-dot ' + tone;
hp.count.textContent = state.host === 'all' ? on + '/' + hosts.length : (cur && cur.online ? t('host.online') : t('host.offline'));
hp.count.className = 'fb-count ' + tone;
hp.btn.setAttribute('aria-label', t('host.label') + ': ' + hp.label.textContent + ', ' + t('fb.host.status', { n: on, m: hosts.length }));
var want = hosts.map(function (x) { return x.name + (x.online ? '1' : '0') + (x.version || ''); }).join('|') + '|' + state.host + '|' + lang;
if (hp.list.getAttribute('data-k') === want) return;
hp.list.setAttribute('data-k', want);
clear(hp.list);
hp.list.appendChild(hostOpt('all', t('host.all'), t('fb.host.status', { n: on, m: hosts.length }), on === hosts.length ? 'on' : on ? 'warn' : 'off'));
hosts.forEach(function (x) {
var meta = [x.online ? t('host.online') : t('host.offline')];
if (x.self) meta.push(t('host.self'));
if (x.version) meta.push(x.version);
if (!x.online && x.last_seen) meta.push(ago(x.last_seen));
hp.list.appendChild(hostOpt(x.name, x.name, meta.join(' · '), x.online ? 'on' : 'off'));
});
}
// ---- summary line: what is applied, live/fixed, clear, copy link
function buildSummary() {
var tools = $('#slice-tools');
if (!tools) return;
clear(tools);
rp.clear = el('button', { type: 'button', class: 'fb-link' }, t('fb.clear'));
rp.clear.title = t('fb.clear.title');
rp.clear.addEventListener('click', function () { state.domain = 'all'; setShell({ range: DEFAULT_RANGE, from: null, to: null, host: 'all' }); });
var copy = el('button', { type: 'button', class: 'fb-link fb-copy', title: t('fb.copy.title') }, svgIcon(IC.link), h('span', null, t('fb.copy')));
copy.addEventListener('click', function () {
var done = function () { toast(t('fb.copied')); }, url = location.href;
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(url).then(done, function () { toast(url); });
else toast(url);
});
tools.appendChild(rp.clear); tools.appendChild(copy);
}
// ---------------------------------------------------------------- shell
function setSliceNote(text) { state.note = text || ''; renderSlice(); }
function renderSlice() {
@@ -1969,13 +2127,23 @@
var parts = [state.host === 'all' ? t('slice.allHosts') : t('slice.host', { name: state.host })];
if (current && pages[current.id] && pages[current.id].domain) parts.push(state.domain === 'all' ? t('slice.allDomains') : t('slice.domain', { name: state.domain }));
if (state.note) parts.push(state.note);
p.appendChild(document.createTextNode(t('slice.showing') + ' '));
var live = !isCustom();
var mode = h('span', 'fb-mode ' + (live ? 'is-live' : 'is-fixed'), h('span', 'fb-pulse'), live ? t('fb.live') : t('fb.fixed'));
mode.title = live ? t('fb.live.title') : t('fb.fixed.title');
p.appendChild(mode);
p.appendChild(document.createTextNode(' ' + t('slice.showing') + ' '));
p.appendChild(h('strong', null, rangeArticle()));
p.appendChild(document.createTextNode(' · ' + parts.join(' · ')));
p.appendChild(document.createTextNode(' (' + tzName() + ') · ' + parts.join(' · ')));
$('#domain').hidden = !(current && pages[current.id] && pages[current.id].domain);
if (rp.clear) rp.clear.hidden = isDefaultSlice();
renderRangePicker();
}
// the bar sticks under the top bar; once it is stuck the summary line folds away
function watchStick() {
var bar = $('#slice'), s = $('#slice-sentinel');
if (!bar || !s || !window.IntersectionObserver) return;
new IntersectionObserver(function (es) { bar.classList.toggle('is-stuck', !es[0].isIntersecting); }, { rootMargin: '-' + (parseInt(cssVar('--topbar-h'), 10) || 64) + 'px 0px 0px 0px' }).observe(s);
}
function navId() { return current ? (current.id === 'ip' ? 'ips' : current.id) : null; }
// small counter on a rail/tab item (e.g. open incidents); n <= 0 removes it. Set by page scripts.
var navBadges = {};
@@ -2134,17 +2302,10 @@
}
function updateHostSelect(s) {
var sel = $('#host'), hosts = s.hosts || [];
var want = hosts.map(function (x) { return x.name; }).join('|') + '|' + lang;
if (sel.getAttribute('data-hosts') !== want) {
clear(sel);
sel.appendChild(el('option', { value: 'all' }, t('host.all')));
hosts.forEach(function (x) { sel.appendChild(el('option', { value: x.name }, x.name)); });
sel.setAttribute('data-hosts', want);
}
var hosts = s.hosts || [];
state.hostList = hosts;
if (state.host !== 'all' && !hosts.some(function (x) { return x.name === state.host; })) { state.host = 'all'; lsSet('urutau.host', 'all'); }
sel.value = state.host;
sel.hidden = hosts.length < 2;
renderHostPicker();
}
function shellSummary() {
return getSummary(ctx()).then(function (s) {
@@ -2167,7 +2328,7 @@
buildRangePicker();
readSlice(parseHash().query);
renderRangePicker();
$('#host').addEventListener('change', function (e) { setShell({ host: e.target.value }); });
watchStick();
$('#domain').addEventListener('change', function (e) { state.domain = e.target.value; renderSlice(); notifyPage(); });
$('#lang').addEventListener('click', function () {
lang = lang === 'en' ? 'pt-BR' : 'en'; lsSet('urutau.lang', lang);
@@ -2198,7 +2359,7 @@
return;
}
if (e.ctrlKey || e.metaKey || e.altKey || typing(e) || !box.hidden) return;
if (e.key === 't') { e.preventDefault(); rp.open ? closeRangePicker(true) : openRangePicker(); }
if (e.key === 't') { e.preventDefault(); rp.open ? closePop(rp, true) : openRangePicker(); }
else if (e.key === '[') stepPreset(-1);
else if (e.key === ']') stepPreset(1);
else if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight') && e.target === document.body && isCustom()) { e.preventDefault(); shiftWindow(e.key === 'ArrowLeft' ? -1 : 1); }
@@ -2206,7 +2367,7 @@
document.addEventListener('click', function (e) {
var more = $('#more');
if (!more.hidden && !more.contains(e.target) && !$('#tabbar').contains(e.target)) setMore(false);
if (rp.open && !$('#range-picker').contains(e.target)) closeRangePicker(false);
if ((rp.open || hp.open) && !$('#slice').contains(e.target)) closeRangePicker(false);
if (helpPinned) hideHelp();
});
window.addEventListener('hashchange', route);