`
- + ``
+ + ``
+ + ``
+ `${esc(sev || '—')}`
+ `${esc(r.host)}`
+ `${esc(r.app)}`
@@ -382,13 +483,13 @@ function updateCount(tookMs) {
}
function detailsHTML(r) {
- const order = ['_time', 'host', 'app', 'procid', 'severity', 'facility', 'source', 'proto', 'sd', '_msg'];
+ const order = ['received', '_time', 'host', 'app', 'procid', 'severity', 'facility', 'source', 'proto', 'sd', '_msg'];
const hidden = new Set(['_stream_id', '_stream', 'sevnum']);
const keys = order.filter((k) => r[k] != null && r[k] !== '')
.concat(Object.keys(r).filter((k) => !order.includes(k) && !hidden.has(k)).sort());
- const label = { _time: t('fTime'), _msg: t('fMsg'), procid: t('fPid'), sd: t('fSd') };
- const val = (k) => (k === '_time'
- ? `${esc(parseTime(r[k]).toLocaleString(t('locale')))} (${esc(r[k])})`
+ const label = { received: t('fReceived'), _time: t('fTime'), _msg: t('fMsg'), procid: t('fPid'), sd: t('fSd') };
+ const val = (k) => (k === '_time' || k === 'received'
+ ? `${esc(fmtFull(r[k]))} (${esc(r[k])})`
: esc(r[k]));
return ''
+ keys.map((k) => `- ${esc(label[k] || k)}
- ${val(k)}
`).join('')
@@ -462,7 +563,10 @@ function renderHisto(h) {
const loc = t('locale');
const label = (k) => {
const d = new Date(k * stepMs);
- return stepMs >= 864e5 ? d.toLocaleDateString(loc) : d.toLocaleString(loc, { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' });
+ const timeZone = timePrefs.tz || undefined;
+ return stepMs >= 864e5
+ ? d.toLocaleDateString(loc, { timeZone })
+ : d.toLocaleString(loc, { timeZone, day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' });
};
let bars = '';
for (let k = start; k <= end; k++) {
@@ -627,6 +731,50 @@ async function loadStats() {
renderStats();
}
+/* ================= Date & time settings ================= */
+
+function renderTimeSettings() {
+ const now = new Date();
+ const browserZone = Intl.DateTimeFormat().resolvedOptions().timeZone || 'local';
+ const offsetOf = (z) => 'UTC' + zoneParts(now, z).off;
+ const groups = t('tzGroups');
+
+ let html = ``;
+ for (const [group, zones] of Object.entries(TIME_ZONES)) {
+ html += `';
+ }
+ const tzSel = $('#tzSelect');
+ tzSel.innerHTML = html;
+ tzSel.value = timePrefs.tz;
+
+ const fmtSel = $('#fmtSelect');
+ fmtSel.innerHTML = TIME_FORMATS.map((f) => ``).join('');
+ fmtSel.value = timePrefs.fmt;
+ updateTimePreview();
+}
+
+function updateTimePreview() {
+ $('#timePreview').textContent = t('timePreview') + fmtWith(timePrefs.fmt, new Date());
+}
+
+function onTimePrefsChange() {
+ timePrefs.tz = $('#tzSelect').value;
+ timePrefs.fmt = $('#fmtSelect').value;
+ store.set('tz', timePrefs.tz);
+ store.set('timefmt', timePrefs.fmt);
+ updateTimePreview();
+ renderList();
+ renderHisto(state.histo);
+}
+$('#tzSelect').addEventListener('change', onTimePrefsChange);
+$('#fmtSelect').addEventListener('change', onTimePrefsChange);
+setInterval(() => { if ($('#settingsDlg').open) updateTimePreview(); }, 1000);
+
/* ================= Tag management ================= */
const PALETTE = ['#6366f1', '#0ea5e9', '#14b8a6', '#a855f7', '#ec4899', '#eab308', '#64748b', '#f97316'];
@@ -727,12 +875,18 @@ $('#resetTags').addEventListener('click', async () => {
} catch (e) { toast(e.message); }
});
-$('#settingsBtn').addEventListener('click', () => { renderTagList(); $('#settingsDlg').showModal(); });
+$('#settingsBtn').addEventListener('click', () => { renderTimeSettings(); renderTagList(); $('#settingsDlg').showModal(); });
$('#closeSettings').addEventListener('click', () => $('#settingsDlg').close());
$('#settingsDlg').addEventListener('click', (ev) => { if (ev.target === ev.currentTarget) ev.currentTarget.close(); });
/* ================= Startup ================= */
+{
+ const tz = store.get('tz', '');
+ timePrefs.tz = validTimeZone(tz) ? tz : '';
+ const fmt = store.get('timefmt', 'ymd-dash');
+ timePrefs.fmt = TIME_FORMATS.some((f) => f.id === fmt) ? fmt : 'ymd-dash';
+}
applyLang();
$('#range').value = store.get('range', '1h');
if (!$('#range').value) $('#range').value = '1h';
diff --git a/web/index.html b/web/index.html
index 3a49bbf..0362f4c 100644
--- a/web/index.html
+++ b/web/index.html
@@ -104,6 +104,18 @@
+
+ Date & time
+
+
+
+
+
+
+
+
+
+
Color tags
diff --git a/web/style.css b/web/style.css
index ab3ed49..34d3d05 100644
--- a/web/style.css
+++ b/web/style.css
@@ -210,7 +210,7 @@ body.busy .progress::after {
.row {
display: grid;
- grid-template-columns: 8.4rem 4.6rem minmax(5rem, 9rem) minmax(4rem, 8rem) 1fr;
+ grid-template-columns: max-content max-content 4.6rem minmax(5rem, 9rem) minmax(4rem, 8rem) 1fr;
gap: 0 12px; align-items: baseline;
padding: 5px 14px 5px 11px;
border-left: 3px solid transparent;
@@ -225,6 +225,7 @@ body.busy .progress::after {
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.row time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
+.row time.rcv { color: var(--text); }
.row time .ms { opacity: .6; }
.row .host, .row .app { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .host { font-weight: 600; }
@@ -292,6 +293,7 @@ mark.hit { background: var(--hit); color: inherit; border-radius: 3px; padding:
background: var(--panel); border-top: 1px solid var(--border);
font-variant-numeric: tabular-nums;
}
+.conn { white-space: nowrap; }
.conn::before { content: "●"; margin-right: 6px; color: var(--muted); }
.conn.ok::before { color: var(--sev-info); }
.conn.ko::before { color: var(--sev-err); }
@@ -317,6 +319,19 @@ dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(2px)
.set-section + .set-section { padding-top: 16px; border-top: 1px solid var(--border); }
.set-section h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.set-section p { margin: 0; }
+.field-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; align-items: center; }
+.field-grid label { font-size: 13px; font-weight: 550; }
+select.field {
+ height: 34px; padding: 0 30px 0 10px; min-width: 0; width: 100%;
+ border: 1px solid var(--border); border-radius: 8px;
+ background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a1' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
+ appearance: none; -webkit-appearance: none; font-size: 13px;
+}
+select.field:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
+.time-preview {
+ margin: 10px 0 6px !important; padding: 8px 12px; border-radius: 8px;
+ background: var(--panel-2); font-family: var(--mono); font-size: 12.5px;
+}
.set-section footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
@@ -373,10 +388,11 @@ dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(2px)
.list, .error-banner { margin-left: 16px; margin-right: 16px; }
.row {
grid-template-columns: auto auto 1fr;
- grid-template-areas: "time sev host" "msg msg msg";
+ grid-template-areas: "rcv sev host" "msg msg msg";
gap: 3px 8px; padding: 8px 12px 8px 10px;
}
- .row time { grid-area: time; }
+ .row time.rcv { grid-area: rcv; }
+ .row time.mt { display: none; } /* still shown in the details panel */
.row .sev { grid-area: sev; }
.row .host { grid-area: host; justify-self: end; max-width: 100%; }
.row .app { display: none; }
@@ -384,6 +400,8 @@ dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(2px)
.details { grid-column: 1 / -1; }
.details dl { grid-template-columns: 1fr; }
.details dt { margin-top: 4px; }
+ .field-grid { grid-template-columns: 1fr; gap: 4px; }
+ .field-grid select { margin-bottom: 6px; }
.status { padding: 6px 16px; }
.tag-row { grid-template-columns: 38px 1fr 36px; }
.tag-row .preview { display: none; }