update regex filter

This commit is contained in:
2026-04-29 12:10:50 +07:00
parent d28906d74f
commit 0577c53aef

View File

@@ -794,7 +794,7 @@
<button id="clear-filters">Clear filters</button>
</div>
</div>
<!-- Main -->
<div id="main">
<!-- Chart -->
@@ -804,18 +804,19 @@
<span id="chart-hint">drag to zoom · right-click to reset</span>
</div>
</div>
<!-- Empty state / Table area -->
<div id="empty-state">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
<rect x="6" y="6" width="36" height="36" rx="6" stroke="currentColor" stroke-width="1.5" stroke-dasharray="5 3" />
<rect x="6" y="6" width="36" height="36" rx="6" stroke="currentColor" stroke-width="1.5"
stroke-dasharray="5 3" />
<path d="M16 20h16M16 24h10M16 28h12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
</svg>
<div class="es-title">No log file loaded</div>
<div class="es-sub">Drag & drop a log file anywhere on the page or click below to browse</div>
<button class="es-btn" onclick="document.getElementById('file-input').click()">Select log file</button>
</div>
<div id="table-area" style="display:none">
<div id="dt-wrap">
<table id="log-table">
@@ -830,7 +831,7 @@
</table>
</div>
</div>
<!-- Status bar -->
<div id="status-bar" style="display:none">
<span class="status-count" id="status-showing">0 entries</span>
@@ -926,7 +927,7 @@
let matched = false;
for (const pat of patterns) {
const m = line.match(pat);
if (m) {
if (m) {
let timeStr = m.groups.time || null
let levelStr = translateLogLevel(m.groups.lvl || '')
let msg = m.groups.msg || null
@@ -1185,12 +1186,13 @@
filteredLogs = allLogs.filter(log => {
if (levelFilter && log.level !== levelFilter) return false;
if (timeFilter && (log.time.getTime() < timeFilter.start || log.time.getTime() > timeFilter.end)) return false;
if (regex && !regex.test(log.message)) return false;
if (regex && !regex.test(log.message) && !regex.test(log.props) && !regex.test(log.exception)) return false;
return true;
});
renderTable();
updateStatus();
updateFilteredLevelCounts();
}
// ---- Table rendering ----
@@ -1497,18 +1499,18 @@
});
window.copySection = function (btn, text) {
navigator.clipboard.writeText(text).then(() => {
const orig = btn.textContent;
btn.textContent = 'copied ✓';
btn.style.color = 'var(--info)';
btn.style.borderColor = 'var(--info)';
setTimeout(() => {
btn.textContent = orig;
btn.style.color = 'var(--text3)';
btn.style.borderColor = 'var(--border2)';
}, 1500);
});
};
navigator.clipboard.writeText(text).then(() => {
const orig = btn.textContent;
btn.textContent = 'copied ✓';
btn.style.color = 'var(--info)';
btn.style.borderColor = 'var(--info)';
setTimeout(() => {
btn.textContent = orig;
btn.style.color = 'var(--text3)';
btn.style.borderColor = 'var(--border2)';
}, 1500);
});
};
// Load demo on start
//loadDemo();