Update show Key issue when RESULT !== Pass

This commit is contained in:
andrew.ng 2026-06-03 13:45:13 +07:00
parent a4873e64bf
commit 850b744435
1 changed files with 20 additions and 1 deletions

View File

@ -2100,7 +2100,7 @@ Ports Missing/Down: ${missing.length}\n\n`
const configRam = await detectConfigRamByModel(config?.inventory?.pid) const configRam = await detectConfigRamByModel(config?.inventory?.pid)
// AI issue rows (one per real AI issue, fall back to file's hardcoded row when none) // AI issue rows (one per real AI issue, fall back to file's hardcoded row when none)
const aiIssueRowsHtml = let aiIssueRowsHtml =
issues.length > 0 issues.length > 0
? issues.length > 1 ? issues.length > 1
? issues ? issues
@ -2112,6 +2112,25 @@ Ports Missing/Down: ${missing.length}\n\n`
.join('') .join('')
: `<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f5f3ff;border:1px solid #c4b5fd;border-radius:6px;margin-bottom:5px;border-collapse:separate;"><tr><td style="padding:7px 12px;font-size:12px;color:#5f6978;font-weight:500;"><span style="display:inline-block;background:#7c3aed;color:#fff;font-size:9px;font-weight:700;letter-spacing:.5px;padding:2px 6px;border-radius:4px;vertical-align:middle;">&#9733; AI</span><span style="margin-left:8px;vertical-align:middle;">${escapeHtml(issues[0].split('\n')[0] || '')}</span></td><td align="right" style="padding:7px 12px;width:90px;"></td></tr></table>` : `<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f5f3ff;border:1px solid #c4b5fd;border-radius:6px;margin-bottom:5px;border-collapse:separate;"><tr><td style="padding:7px 12px;font-size:12px;color:#5f6978;font-weight:500;"><span style="display:inline-block;background:#7c3aed;color:#fff;font-size:9px;font-weight:700;letter-spacing:.5px;padding:2px 6px;border-radius:4px;vertical-align:middle;">&#9733; AI</span><span style="margin-left:8px;vertical-align:middle;">${escapeHtml(issues[0].split('\n')[0] || '')}</span></td><td align="right" style="padding:7px 12px;width:90px;"></td></tr></table>`
: `` : ``
const AIIssue = issues.join('\n') || 'No issues detected.'
// Extract "Key issue" lines from AIIssue and append to aiIssueRowsHtml when summaryStatus !== 'PASS'
let keyIssueHtml = ''
if (summaryStatus !== 'PASS') {
const keyIssueRegex = /.*Key issue.*/gi
const keyIssueMatches = AIIssue.match(keyIssueRegex)
if (keyIssueMatches && keyIssueMatches.length > 0) {
keyIssueHtml = keyIssueMatches
.map(
(issue) =>
`<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background:#f5f3ff;border:1px solid #c4b5fd;border-radius:6px;margin-bottom:5px;border-collapse:separate;"><tr><td style="padding:7px 12px;font-size:12px;color:#5f6978;font-weight:500;"><span style="margin-left:8px;vertical-align:middle;">${escapeHtml(issue)}</span></td><td align="right" style="padding:7px 12px;width:90px;"></td></tr></table>`
)
.join('')
}
}
// Append key issue HTML to aiIssueRowsHtml
if (summaryStatus !== 'PASS') aiIssueRowsHtml = aiIssueRowsHtml + keyIssueHtml
// License boxes (real licenses if available, else file's hardcoded boxes) // License boxes (real licenses if available, else file's hardcoded boxes)
const licenseBoxesHtml = const licenseBoxesHtml =