diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 947a1ba..8f32213 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -2028,7 +2028,7 @@ Ports Missing/Down: ${missing.length}\n\n` `
★ AI${escapeHtml(issue)}
` ) .join('') - : `
★ AIPotential intermittent power instability. PSU #1 POST logs show 3 retries before handshake.Investigate
` + : `` // License boxes (real licenses if available, else file's hardcoded boxes) const licenseBoxesHtml = @@ -2096,6 +2096,32 @@ Ports Missing/Down: ${missing.length}\n\n` const photoCellHtml = (label: string) => `
${label}
` + // Helper function to highlight SNs from listInventory in outputTestLog + const highlightSnInConsoleOutput = (text: string, listInventory: any[] | undefined) => { + if (!text || !listInventory || listInventory.length === 0) { + return escapeHtml(text || 'No test log available') + } + + let result = escapeHtml(text) + const snList = listInventory.map((item) => item.sn).filter((sn) => sn) + + // Sort by length descending to match longest SNs first (avoid partial matches) + snList.sort((a, b) => b.length - a.length) + + snList.forEach((sn) => { + if (sn) { + // Create a regex that matches the SN as a whole word/token + const regex = new RegExp(`\\b${sn.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\$&')}\\b`, 'g') + result = result.replace( + regex, + `${escapeHtml(sn)}` + ) + } + }) + + return result + } + // ---- Body: full template mirroring index.html, table-based + inline styles ---- const body = ` @@ -2150,7 +2176,7 @@ Ports Missing/Down: ${missing.length}\n\n`
- +
Product Info
@@ -2158,12 +2184,14 @@ Ports Missing/Down: ${missing.length}\n\n` + +
P/N${productPN}
S/N${productSN}
MAC${macAddress || '-'}
Cond.${'-'}
Supplier${'-'}
- +
Technical Specs
@@ -2373,7 +2401,7 @@ Ports Missing/Down: ${missing.length}\n\n` this.config?.inventory?.listInventory ?.map( (item: any) => ` - ` + ` ) .join('') || '' } @@ -2403,7 +2431,7 @@ Ports Missing/Down: ${missing.length}\n\n`
${item.pid}${item.sn}
${item.pid}${item.sn}
- +
CONSOLE RAW OUTPUT (Boot Log snippet)
${this?.outputTestLog || 'No test log available'}
${highlightSnInConsoleOutput(this?.outputTestLog, this.config?.inventory?.listInventory)}