feat: surface BMC collection errors in parse-errors panel and event log
When Inspur component.log sections return {"error":"...","code":N} instead
of hardware data, the parser now:
- stores them in AnalysisResult.CollectionErrors (new model field)
- mirrors each one into result.Events with Source="BMC/<section>"
so the chart viewer event table shows the specific BMC module
- feeds them into /api/parse-errors as bmc_collection_error entries
UI adds a collapsible "Collection diagnostics" panel below the chart
iframe (outside /chart) that appears when /api/parse-errors returns
any items; resets on data clear.
Affected sections in this dump: HDD (1458), PCIe Devices (1458),
Network Adapters (1458), Disk Backplane.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1413,6 +1413,62 @@ async function loadData(vendor, filename) {
|
||||
document.getElementById('header-log-meta').classList.remove('hidden');
|
||||
|
||||
loadAuditViewer();
|
||||
loadParseErrors();
|
||||
}
|
||||
|
||||
async function loadParseErrors() {
|
||||
const section = document.getElementById('parse-errors-section');
|
||||
const rows = document.getElementById('parse-errors-rows');
|
||||
const title = document.getElementById('parse-errors-title');
|
||||
if (!section || !rows) return;
|
||||
|
||||
let data;
|
||||
try {
|
||||
const resp = await fetch('/api/parse-errors');
|
||||
if (!resp.ok) return;
|
||||
data = await resp.json();
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
const items = (data && data.items) ? data.items : [];
|
||||
if (items.length === 0) {
|
||||
section.classList.add('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
const errorCount = items.filter(i => i.severity === 'error').length;
|
||||
const warnCount = items.filter(i => i.severity === 'warning').length;
|
||||
const parts = [];
|
||||
if (errorCount > 0) parts.push(`${errorCount} error${errorCount > 1 ? 's' : ''}`);
|
||||
if (warnCount > 0) parts.push(`${warnCount} warning${warnCount > 1 ? 's' : ''}`);
|
||||
const otherCount = items.length - errorCount - warnCount;
|
||||
if (otherCount > 0) parts.push(`${otherCount} notice${otherCount > 1 ? 's' : ''}`);
|
||||
title.textContent = `Collection diagnostics — ${parts.join(', ')}`;
|
||||
|
||||
rows.innerHTML = '';
|
||||
for (const item of items) {
|
||||
const tr = document.createElement('tr');
|
||||
tr.className = `parse-error-row parse-error-${item.severity || 'info'}`;
|
||||
tr.innerHTML =
|
||||
`<td>${escapeHtml(item.source || '')}</td>` +
|
||||
`<td>${escapeHtml(item.path || item.category || '')}</td>` +
|
||||
`<td>${escapeHtml(item.message || '')}</td>` +
|
||||
`<td>${escapeHtml(item.detail || '')}</td>`;
|
||||
rows.appendChild(tr);
|
||||
}
|
||||
|
||||
section.classList.remove('hidden');
|
||||
}
|
||||
|
||||
let parseErrorsCollapsed = false;
|
||||
function toggleParseErrors() {
|
||||
const body = document.getElementById('parse-errors-body');
|
||||
const toggle = document.getElementById('parse-errors-toggle');
|
||||
if (!body) return;
|
||||
parseErrorsCollapsed = !parseErrorsCollapsed;
|
||||
body.style.display = parseErrorsCollapsed ? 'none' : '';
|
||||
toggle.textContent = parseErrorsCollapsed ? '▼' : '▲';
|
||||
}
|
||||
|
||||
function loadAuditViewer() {
|
||||
@@ -1468,6 +1524,15 @@ async function clearData() {
|
||||
if (frame) {
|
||||
frame.src = 'about:blank';
|
||||
}
|
||||
const parseErrSection = document.getElementById('parse-errors-section');
|
||||
if (parseErrSection) parseErrSection.classList.add('hidden');
|
||||
const parseErrRows = document.getElementById('parse-errors-rows');
|
||||
if (parseErrRows) parseErrRows.innerHTML = '';
|
||||
parseErrorsCollapsed = false;
|
||||
const parseErrBody = document.getElementById('parse-errors-body');
|
||||
if (parseErrBody) parseErrBody.style.display = '';
|
||||
const parseErrToggle = document.getElementById('parse-errors-toggle');
|
||||
if (parseErrToggle) parseErrToggle.textContent = '▲';
|
||||
} catch (err) {
|
||||
console.error('Failed to clear data:', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user