clean up deprecated buttons

This commit is contained in:
Pierre committed 2026-10-04 13:43:50 +02:00
1 parent 99422d8cfc
commit 5614ad049d
12 files changed
+36 -161

No files matched your search

+2 -5
View File
@@ -61,20 +61,17 @@ test('groups plain app.log lines between explicit initialization markers',()=>{
assert.equal(grouped[2].group_inferred,undefined);
});
test('clears configured live files, keeps imported archives, and updates the log error count',()=>{
test('clears configured log files and updates the log error count',()=>{
const counts=[];const e=new LogExplorer({},count=>counts.push(count));
messages=[];const webview={postMessage:m=>messages.push(m)};e.panel={webview};e.activeWebview=webview;
const errorFile=path.join(root,'logs/error.log');
const archive=path.join(root,'logs/history.log.1');
fs.writeFileSync(file,'27-09-26 10:12:13 ERROR app: failed\n');
fs.writeFileSync(errorFile,'27-09-26 10:12:13 ERROR app: failed\n');
fs.writeFileSync(archive,'27-09-26 10:12:14 INFO app: archived\n');
e.imported.add(archive);e.poll();
e.poll();
assert.equal(counts.at(-1),1);
e.clearLogs();
assert.equal(fs.statSync(file).size,0);
assert.equal(fs.statSync(errorFile).size,0);
assert.match(fs.readFileSync(archive,'utf8'),/archived/);
assert.equal(counts.at(-1),0);
assert.deepEqual(messages.filter(message=>message.type==='entries').at(-1).entries,[]);
fs.appendFileSync(file,'27-09-26 10:12:15 CRITICAL app: new failure\n');e.poll();
+16 -16
View File
@@ -20,7 +20,9 @@ function setup() {
test('English interface, latest timestamps, sorting and separate initialization groups',()=>{
const {dom,d,errors}=setup();
assert.equal(d.documentElement.lang,'en');
assert.equal(d.getElementById('copy').textContent,'Copy selected log');
assert.equal(d.getElementById('copy'),null);
assert.equal(d.getElementById('import'),null);
assert.equal(d.getElementById('pause'),null);
assert.deepEqual([...d.querySelectorAll('[data-app]')].map(e=>e.dataset.app),['beta','alpha']);
assert.match(d.querySelector('[data-app="alpha"] .last-age').title,/10:00:10/);
assert.match(d.querySelector('[data-app="alpha"] summary .last-log').textContent,/ : Température déjà disponible$/);
@@ -38,25 +40,25 @@ test('English interface, latest timestamps, sorting and separate initialization
assert.equal(d.getElementById('group-init'),null);
assert.deepEqual(errors,[]);dom.window.close();
});
test('copies selected logs and entire initialization groups through VS Code transport',()=>{
const {dom,d,sent,errors}=setup();const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
[...alpha.querySelectorAll('.row')].find(e=>e.textContent.includes('Température déjà disponible')).click();d.getElementById('copy').click();
assert.equal(sent.at(-1).type,'copy');assert.match(sent.at(-1).text,/Température déjà disponible/);
test('selects individual logs and entire initialization groups',()=>{
const {dom,d,errors}=setup();const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
[...alpha.querySelectorAll('.row')].find(e=>e.textContent.includes('Température déjà disponible')).click();
assert.match(d.getElementById('detail').textContent,/Température déjà disponible/);
const group=alpha.querySelector('.event-log-group');
group.click();d.getElementById('copy').click();
group.click();
assert.match(d.getElementById('detail').textContent,/Preparing sensors\s+Ready/);
assert.match(sent.at(-1).text,/Preparing sensors/);assert.match(sent.at(-1).text,/Ready/);assert.doesNotMatch(sent.at(-1).text,/Restarting/);
assert.doesNotMatch(d.getElementById('detail').textContent,/Restarting/);
const input=d.getElementById('search'),paste=new dom.window.KeyboardEvent('keydown',{key:'v',ctrlKey:true,bubbles:true,cancelable:true});input.dispatchEvent(paste);assert.equal(paste.defaultPrevented,false);
assert.deepEqual(errors,[]);dom.window.close();
});
test('retains selected text during live updates and copies it with Ctrl+C',async()=>{
const {dom,d,entries,sent,errors,send}=setup();const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
test('retains selected text during live updates and leaves Ctrl+C to the browser',async()=>{
const {dom,d,entries,errors,send}=setup();const alpha=d.querySelector('[data-app="alpha"]');alpha.open=true;alpha.dispatchEvent(new dom.window.Event('toggle'));
const text=alpha.querySelector('.row-message'),range=d.createRange();range.selectNodeContents(text);dom.window.getSelection().addRange(range);
const original=text.textContent;
send([...entries,{...entries[3],event_id:'new',time:30,message:'New log'}]);
assert.equal(dom.window.getSelection().toString(),original);assert.match(d.getElementById('status').textContent,/buffered/);
text.dispatchEvent(new dom.window.KeyboardEvent('keydown',{key:'c',ctrlKey:true,bubbles:true,cancelable:true}));
assert.equal(sent.at(-1).text,original);
const copy=new dom.window.KeyboardEvent('keydown',{key:'c',ctrlKey:true,bubbles:true,cancelable:true});
text.dispatchEvent(copy);assert.equal(copy.defaultPrevented,false);
dom.window.getSelection().removeAllRanges();d.dispatchEvent(new dom.window.Event('selectionchange'));await new Promise(resolve=>setTimeout(resolve,15));
assert.match(d.querySelector('[data-app="alpha"]').textContent,/New log/);
assert.deepEqual(errors,[]);dom.window.close();
@@ -67,7 +69,7 @@ test('log content is never interpreted as HTML',()=>{
assert.equal(d.querySelectorAll('#apps img,#apps script').length,0);assert.match(app.textContent,/<img/);assert.deepEqual(errors,[]);dom.window.close();
});
test('shows same-event log lines together with one causes link and keeps newer events below',()=>{
const {dom,d,entries,send,sent}=setup();
const {dom,d,entries,send}=setup();
const trigger={...entries[3],event_id:'motion-callback',time:entries[3].time+1000,message:'Callback trigger by sensor.kitchen_last_motion(7 => 0)',trace_id:'motion-event'};
const evaluation={...entries[3],event_id:'motion-evaluation',time:entries[3].time+1000,message:'[kitchen_occupancy][Evaluating] Triggered by (sensor.kitchen_last_motion[0] <= 5)[True]',trace_id:'motion-event',cause_ids:['state-event']};
const newer={...entries[3],event_id:'later-log',time:entries[3].time+2000,message:'Later event'};
@@ -79,9 +81,7 @@ test('shows same-event log lines together with one causes link and keeps newer e
assert.match(combined.querySelector('.row-message').textContent,/Triggered by \(sensor.kitchen_last_motion/);
assert.equal(combined.querySelectorAll('.link-hint').length,1);
assert.equal(rows.children[1].querySelector('.row-message').textContent,'Later event');
combined.click();d.getElementById('copy').click();
assert.match(sent.at(-1).text,/Callback trigger by sensor.kitchen_last_motion/);
assert.match(sent.at(-1).text,/Triggered by \(sensor.kitchen_last_motion/);
combined.click();
assert.match(d.getElementById('detail').textContent,/Callback trigger by sensor.kitchen_last_motion/);
dom.window.close();
});
@@ -157,7 +157,7 @@ test('distinguishes log lines from supplemental records when configured',()=>{
const trace={...entries[3],event_id:'trace-evaluation',kind:'evaluation',message:'Condition was evaluated'};
send([...entries,trace]);
assert.match(d.getElementById('status').textContent,/5 log lines \+ 1 trace event/);
assert.match(d.getElementById('status').title,/configured history files/);
assert.match(d.getElementById('status').title,/configured log files/);
dom.window.close();
});