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