minor improvement: filtering service logs

This commit is contained in:
Martino Ferrari
2026-05-20 17:39:53 +02:00
parent 74816028a8
commit 58abf98eea
3 changed files with 241 additions and 245 deletions
Binary file not shown.
+2
View File
@@ -1189,6 +1189,7 @@ function flushLogs() {
function renderLogs() { function renderLogs() {
logDirty = false; logDirty = false;
const body = document.getElementById('log-body'); const body = document.getElementById('log-body');
const showService = document.getElementById('lf-service').checked;
const showDebug = document.getElementById('lf-debug').checked; const showDebug = document.getElementById('lf-debug').checked;
const showInfo = document.getElementById('lf-info').checked; const showInfo = document.getElementById('lf-info').checked;
const showWarn = document.getElementById('lf-warn').checked; const showWarn = document.getElementById('lf-warn').checked;
@@ -1197,6 +1198,7 @@ function renderLogs() {
const visible = logs.filter(l => { const visible = logs.filter(l => {
const lv = l.level; const lv = l.level;
if ((lv==='CMD' || lv==='RESP') && !showService) return false;
if (lv==='DEBUG' && !showDebug) return false; if (lv==='DEBUG' && !showDebug) return false;
if ((lv==='INFO'||lv==='Information') && !showInfo) return false; if ((lv==='INFO'||lv==='Information') && !showInfo) return false;
if ((lv==='WARNING'||lv==='Warning') && !showWarn) return false; if ((lv==='WARNING'||lv==='Warning') && !showWarn) return false;
+75 -81
View File
@@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>MARTe2 Debug Client</title> <title>MARTe2 Debug Client</title>
<link rel="icon" type="image/svg+xml" href="favicon.svg"> <link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="stylesheet" href="uplot.min.css"> <link rel="stylesheet" href="uplot.min.css">
<style> <style>
*{box-sizing:border-box;margin:0;padding:0} *{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden;font-family:'Segoe UI',system-ui,sans-serif;font-size:12px;background:#1e1e2e;color:#cdd6f4} html,body{height:100%;overflow:hidden;font-family:'Segoe UI',system-ui,sans-serif;font-size:12px;background:#1e1e2e;color:#cdd6f4}
/* ── layout ── */ /* ── layout ── */
@@ -163,18 +163,17 @@ details>.children{padding-left:14px}
.msg-item{padding:3px 6px;border-bottom:1px solid #181825;font-size:11px} .msg-item{padding:3px 6px;border-bottom:1px solid #181825;font-size:11px}
.msg-status{width:14px;text-align:center;flex-shrink:0} .msg-status{width:14px;text-align:center;flex-shrink:0}
select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px;border-radius:4px} select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px;border-radius:4px}
</style> </style>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<!-- ═══ TOOLBAR ═══ -->
<!-- ═══ TOOLBAR ═══ --> <div id="toolbar">
<div id="toolbar">
<!-- Connection menu --> <!-- Connection menu -->
<div class="menu-wrap tb-group"> <div class="menu-wrap tb-group">
<button id="conn-menu-btn" onclick="toggleMenu('conn-dropdown')"> <button id="conn-menu-btn" onclick="toggleMenu('conn-dropdown')">
<span id="conn-status"></span> Connection ▾ <span id="conn-status"></span>
Connection ▾
</button> </button>
<div class="dropdown" id="conn-dropdown"> <div class="dropdown" id="conn-dropdown">
<div class="menu-row"> <div class="menu-row">
@@ -202,7 +201,6 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
</div> </div>
</div> </div>
</div> </div>
<div class="tb-group"> <div class="tb-group">
<button id="btn-pause" onclick="togglePause()">⏸ Pause</button> <button id="btn-pause" onclick="togglePause()">⏸ Pause</button>
<button onclick="openStepDialog()">⚙ Step</button> <button onclick="openStepDialog()">⚙ Step</button>
@@ -218,22 +216,20 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<div class="tb-group" style="border:none;margin-left:auto"> <div class="tb-group" style="border:none;margin-left:auto">
<span id="udp-stats" style="color:#585b70;font-size:11px">0 pkts</span> <span id="udp-stats" style="color:#585b70;font-size:11px">0 pkts</span>
</div> </div>
</div> </div>
<!-- ═══ STEP STATUS BAR ═══ -->
<!-- ═══ STEP STATUS BAR ═══ --> <div id="step-bar">
<div id="step-bar"> <span>⏹ PAUSED at
<span>⏹ PAUSED at <b id="paused-gam"></b></span> <b id="paused-gam"></b></span>
<span id="step-remaining"></span> <span id="step-remaining"></span>
<select id="step-thread" style="width:120px"></select> <select id="step-thread" style="width:120px"></select>
<button onclick="step(1)">Step 1</button> <button onclick="step(1)">Step 1</button>
<button onclick="step(5)">Step 5</button> <button onclick="step(5)">Step 5</button>
<button onclick="step(20)">Step 20</button> <button onclick="step(20)">Step 20</button>
<button class="ok" onclick="togglePause()">▶ Resume</button> <button class="ok" onclick="togglePause()">▶ Resume</button>
</div> </div>
<!-- ═══ MAIN ═══ -->
<!-- ═══ MAIN ═══ --> <div id="main">
<div id="main">
<!-- LEFT: object tree --> <!-- LEFT: object tree -->
<div id="left-panel"> <div id="left-panel">
<div class="panel-header"> <div class="panel-header">
@@ -245,18 +241,14 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<div class="empty-hint">Connect to MARTe2 then click Tree</div> <div class="empty-hint">Connect to MARTe2 then click Tree</div>
</div> </div>
</div> </div>
<!-- Left resize/collapse strip --> <!-- Left resize/collapse strip -->
<div id="left-strip" class="panel-strip" title="Drag to resize · Click to collapse"></div> <div id="left-strip" class="panel-strip" title="Drag to resize · Click to collapse"></div>
<!-- CENTER: plots --> <!-- CENTER: plots -->
<div id="center-panel"> <div id="center-panel">
<div class="empty-hint" id="no-plots-hint">Add a plot panel to begin — drag signals from the tree or traced list</div> <div class="empty-hint" id="no-plots-hint">Add a plot panel to begin — drag signals from the tree or traced list</div>
</div> </div>
<!-- Right resize/collapse strip --> <!-- Right resize/collapse strip -->
<div id="right-strip" class="panel-strip" title="Drag to resize · Click to collapse"></div> <div id="right-strip" class="panel-strip" title="Drag to resize · Click to collapse"></div>
<!-- RIGHT: tabs --> <!-- RIGHT: tabs -->
<div id="right-panel"> <div id="right-panel">
<div class="tabs"> <div class="tabs">
@@ -278,32 +270,34 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<div class="empty-hint" id="no-msgs-hint">No messages sent</div> <div class="empty-hint" id="no-msgs-hint">No messages sent</div>
</div> </div>
</div> </div>
</div>
</div> <!-- ═══ LOGS ═══ -->
<div id="log-panel">
<!-- ═══ LOGS ═══ -->
<div id="log-panel">
<div id="log-toolbar"> <div id="log-toolbar">
<button class="panel-toggle" title="Collapse logs" onclick="togglePanel('log-panel','▼','▲',this)" id="log-toggle-btn"></button> <button class="panel-toggle" title="Collapse logs" onclick="togglePanel('log-panel','▼','▲',this)" id="log-toggle-btn"></button>
<span style="font-weight:600;color:#89b4fa">Logs</span> <span style="font-weight:600;color:#89b4fa">Logs</span>
<label><input type="checkbox" id="lf-debug" checked onchange="renderLogs()"> Debug</label> <label><input type="checkbox" id="lf-service" checked onchange="renderLogs()">
<label><input type="checkbox" id="lf-info" checked onchange="renderLogs()"> Info</label> Service</label>
<label><input type="checkbox" id="lf-warn" checked onchange="renderLogs()"> Warn</label> <label><input type="checkbox" id="lf-debug" checked onchange="renderLogs()">
<label><input type="checkbox" id="lf-error" checked onchange="renderLogs()"> Error</label> Debug</label>
<label><input type="checkbox" id="lf-info" checked onchange="renderLogs()">
Info</label>
<label><input type="checkbox" id="lf-warn" checked onchange="renderLogs()">
Warn</label>
<label><input type="checkbox" id="lf-error" checked onchange="renderLogs()">
Error</label>
<input type="text" id="log-filter" placeholder="Filter…" oninput="renderLogs()" style="width:150px"> <input type="text" id="log-filter" placeholder="Filter…" oninput="renderLogs()" style="width:150px">
<button onclick="logs=[];renderLogs()" style="margin-left:auto">Clear</button> <button onclick="logs=[];renderLogs()" style="margin-left:auto">Clear</button>
<label><input type="checkbox" id="log-autoscroll" checked> Auto-scroll</label> <label><input type="checkbox" id="log-autoscroll" checked>
Auto-scroll</label>
</div> </div>
<div id="log-body"></div> <div id="log-body"></div>
</div> </div>
</div><!-- #app -->
</div><!-- #app --> <!-- ═══ DIALOGS ═══ -->
<!-- Force dialog -->
<!-- ═══ DIALOGS ═══ --> <div class="dialog-overlay" id="dlg-force" style="display:none" onclick="if(event.target===this)closeDlg('dlg-force')">
<div class="dialog">
<!-- Force dialog -->
<div class="dialog-overlay" id="dlg-force" style="display:none" onclick="if(event.target===this)closeDlg('dlg-force')">
<div class="dialog">
<h3>⚡ Force Signal</h3> <h3>⚡ Force Signal</h3>
<label>Signal</label> <label>Signal</label>
<input id="force-sig" list="force-sig-list" placeholder="Signal path…"> <input id="force-sig" list="force-sig-list" placeholder="Signal path…">
@@ -314,22 +308,22 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<button onclick="closeDlg('dlg-force')">Cancel</button> <button onclick="closeDlg('dlg-force')">Cancel</button>
<button class="active" onclick="doForce()">Force</button> <button class="active" onclick="doForce()">Force</button>
</div> </div>
</div></div> </div>
</div>
<!-- Unforce confirm --> <!-- Unforce confirm -->
<div class="dialog-overlay" id="dlg-unforce" style="display:none" onclick="if(event.target===this)closeDlg('dlg-unforce')"> <div class="dialog-overlay" id="dlg-unforce" style="display:none" onclick="if(event.target===this)closeDlg('dlg-unforce')">
<div class="dialog"> <div class="dialog">
<h3>Remove Force</h3> <h3>Remove Force</h3>
<p id="unforce-msg" style="margin-bottom:12px;color:#cdd6f4"></p> <p id="unforce-msg" style="margin-bottom:12px;color:#cdd6f4"></p>
<div class="btns"> <div class="btns">
<button onclick="closeDlg('dlg-unforce')">Cancel</button> <button onclick="closeDlg('dlg-unforce')">Cancel</button>
<button class="danger" onclick="doUnforce()">Unforce</button> <button class="danger" onclick="doUnforce()">Unforce</button>
</div> </div>
</div></div> </div>
</div>
<!-- Break dialog --> <!-- Break dialog -->
<div class="dialog-overlay" id="dlg-break" style="display:none" onclick="if(event.target===this)closeDlg('dlg-break')"> <div class="dialog-overlay" id="dlg-break" style="display:none" onclick="if(event.target===this)closeDlg('dlg-break')">
<div class="dialog"> <div class="dialog">
<h3>🔴 Set Breakpoint</h3> <h3>🔴 Set Breakpoint</h3>
<label>Signal</label> <label>Signal</label>
<input id="break-sig" list="break-sig-list" placeholder="Signal path…"> <input id="break-sig" list="break-sig-list" placeholder="Signal path…">
@@ -352,11 +346,11 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<button onclick="closeDlg('dlg-break')">Cancel</button> <button onclick="closeDlg('dlg-break')">Cancel</button>
<button class="active" onclick="doBreak()">Set Break</button> <button class="active" onclick="doBreak()">Set Break</button>
</div> </div>
</div></div> </div>
</div>
<!-- Message dialog --> <!-- Message dialog -->
<div class="dialog-overlay" id="dlg-msg" style="display:none" onclick="if(event.target===this)closeDlg('dlg-msg')"> <div class="dialog-overlay" id="dlg-msg" style="display:none" onclick="if(event.target===this)closeDlg('dlg-msg')">
<div class="dialog"> <div class="dialog">
<h3>✉ Send Message</h3> <h3>✉ Send Message</h3>
<label>Destination</label> <label>Destination</label>
<input id="msg-dest" list="msg-dest-list" placeholder="e.g. App.Functions.GAM1"> <input id="msg-dest" list="msg-dest-list" placeholder="e.g. App.Functions.GAM1">
@@ -373,21 +367,21 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<button onclick="closeDlg('dlg-msg')">Cancel</button> <button onclick="closeDlg('dlg-msg')">Cancel</button>
<button class="active" onclick="doSendMsg()">Send</button> <button class="active" onclick="doSendMsg()">Send</button>
</div> </div>
</div></div> </div>
</div>
<!-- Info dialog --> <!-- Info dialog -->
<div class="dialog-overlay" id="dlg-info" style="display:none" onclick="if(event.target===this)closeDlg('dlg-info')"> <div class="dialog-overlay" id="dlg-info" style="display:none" onclick="if(event.target===this)closeDlg('dlg-info')">
<div class="dialog" style="max-width:600px;width:90vw"> <div class="dialog" style="max-width:600px;width:90vw">
<h3 id="info-title">Info</h3> <h3 id="info-title">Info</h3>
<pre id="info-body" style="background:#11111b;padding:8px;border-radius:4px;overflow:auto;max-height:400px;font-size:11px;color:#cdd6f4;white-space:pre-wrap"></pre> <pre id="info-body" style="background:#11111b;padding:8px;border-radius:4px;overflow:auto;max-height:400px;font-size:11px;color:#cdd6f4;white-space:pre-wrap"></pre>
<div class="btns" style="margin-top:12px"> <div class="btns" style="margin-top:12px">
<button onclick="closeDlg('dlg-info')">Close</button> <button onclick="closeDlg('dlg-info')">Close</button>
</div> </div>
</div></div> </div>
</div>
<!-- Step dialog --> <!-- Step dialog -->
<div class="dialog-overlay" id="dlg-step" style="display:none" onclick="if(event.target===this)closeDlg('dlg-step')"> <div class="dialog-overlay" id="dlg-step" style="display:none" onclick="if(event.target===this)closeDlg('dlg-step')">
<div class="dialog"> <div class="dialog">
<h3>⚙ Step Execution</h3> <h3>⚙ Step Execution</h3>
<div class="form-row"> <div class="form-row">
<div> <div>
@@ -404,9 +398,9 @@ select{background:#313244;border:1px solid #45475a;color:#cdd6f4;padding:2px 4px
<button onclick="closeDlg('dlg-step')">Cancel</button> <button onclick="closeDlg('dlg-step')">Cancel</button>
<button class="active" onclick="doStep()">Step</button> <button class="active" onclick="doStep()">Step</button>
</div> </div>
</div></div> </div>
</div>
<script src="uplot.min.js"></script> <script src="uplot.min.js"></script>
<script src="app.js"></script> <script src="app.js"></script>
</body> </body>
</html> </html>