display proper time stamp on log message
This commit is contained in:
1 parent
bf72dbb223
commit
3b0c24e795
3 files changed
+5
-3
No files matched your search
@@ -84,7 +84,7 @@
|
||||
const relative = node('span', timeSince(e.time), 'relative-time');
|
||||
relative.dataset.time = String(e.time);
|
||||
relative.title = `${formatTime(e, true)} · Exact: ${e.timestamp}`;
|
||||
meta.append(relative, node('span', e.level, `badge ${normalLevel(e)}`));
|
||||
meta.append(node('span', e.timestamp, 'exact-time'), relative, node('span', e.level, `badge ${normalLevel(e)}`));
|
||||
if (e.cause_ids.length) meta.append(node('span', 'View causes ↗', 'link-hint'));
|
||||
item.append(blockTitle([e]), meta, logMessages([e], 'row-message'));
|
||||
item.onclick = () => { if (!window.getSelection()?.toString()) choose(e.event_id); };
|
||||
@@ -115,7 +115,7 @@
|
||||
const relative = node('span', timeSince(unit.entries[0].time), 'relative-time');
|
||||
relative.dataset.time = String(unit.entries[0].time);
|
||||
relative.title = `${formatTime(unit.entries[0], true)} · Exact: ${unit.entries[0].timestamp}`;
|
||||
meta.append(relative);
|
||||
meta.append(node('span', unit.entries[0].timestamp, 'exact-time'), relative);
|
||||
for (const level of ['INFO', 'WARNING', 'ERROR']) {
|
||||
const count = unit.entries.filter(e => normalLevel(e) === level).length;
|
||||
if (count) meta.append(node('span', count === 1 ? level : `${level} ${count}`, `badge ${level}`));
|
||||
|
||||
@@ -88,6 +88,7 @@ test('shows same-event log lines together with one causes link and keeps newer e
|
||||
const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
|
||||
const rows=alpha.querySelector('.rows'),combined=rows.children[0];
|
||||
assert.ok(combined.classList.contains('event-log-group'));
|
||||
assert.equal(combined.querySelector('.exact-time').textContent,trigger.timestamp);
|
||||
assert.match(combined.querySelector('.row-message').textContent,/Callback trigger by sensor.kitchen_last_motion/);
|
||||
assert.match(combined.querySelector('.row-message').textContent,/Triggered by \(sensor.kitchen_last_motion/);
|
||||
assert.equal(combined.querySelectorAll('.link-hint').length,1);
|
||||
@@ -172,7 +173,7 @@ test('distinguishes log lines from supplemental records when configured',()=>{
|
||||
dom.window.close();
|
||||
});
|
||||
|
||||
test('shows and refreshes relative time on each log entry while retaining exact time on hover',async()=>{
|
||||
test('shows and refreshes relative time on each log entry while displaying exact time alongside it',async()=>{
|
||||
const {dom,d,entries}=setup();
|
||||
const entry=entries.find(e=>e.event_id==='a');
|
||||
dom.window.Date.now=()=>entry.time+120000;
|
||||
@@ -182,6 +183,7 @@ test('shows and refreshes relative time on each log entry while retaining exact
|
||||
const row=[...d.querySelectorAll('[data-app="alpha"] .row')].find(item=>item.textContent.includes('Température déjà disponible'));
|
||||
const relativeTime=()=>[...app.querySelectorAll('.row')].find(item=>item.textContent.includes('Température déjà disponible')).querySelector('.relative-time');
|
||||
assert.equal(relativeTime().textContent,'2 minutes ago');
|
||||
assert.equal(relativeTime().previousElementSibling.textContent,entries[3].timestamp);
|
||||
assert.match(relativeTime().title,/10:00:10/);
|
||||
dom.window.Date.now=()=>entry.time+3600000;
|
||||
await new Promise(resolve=>setTimeout(resolve,1600));
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user