diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index a442953..9a25183 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -1958,14 +1958,48 @@ Ports Missing/Down: ${missing.length}\n\n` const skipReason = this.config.reasonSkipPhysical || snapshot?.reason || '' const isSkipped = typeof skipReason === 'string' && skipReason.trim().length > 0 - const verdictPass = missing.length === 0 && !isSkipped - const verdictLabel = verdictPass ? 'PASSED' : 'NEEDS REVIEW' - const verdictMsg = verdictPass - ? 'All tests passed — Ready for deployment' - : 'Issues detected — review required before deployment' - const verdictBg = verdictPass ? '#ecfdf5' : '#fef2f2' - const verdictBd = verdictPass ? '#a7f3d0' : '#fecaca' - const verdictTx = verdictPass ? '#065f46' : '#991b1b' + const aiIssue = issues.length > 0 ? issues.join('\n') : '' + let summaryStatus = 'PASS' + const match = aiIssue.match(/^RESULT:\s*(PASS WITH WARNING|PASS|FAIL|INSUFFICIENT DATA)/im) + if (match) { + const status = match[1] + summaryStatus = status + } + + // Verdict based on both physical tests & AI analysis + const physicalPass = missing.length === 0 && !isSkipped + const aiPass = summaryStatus === 'PASS' || summaryStatus === 'PASS WITH WARNING' + const verdictPass = physicalPass && aiPass + + // Determine verdict status & messaging based on failures + let verdictLabel = 'PASSED' + let verdictMsg = 'All tests passed' + let verdictBg = '#ecfdf5' + let verdictBd = '#a7f3d0' + let verdictTx = '#065f46' + + if (!physicalPass && !aiPass) { + verdictLabel = 'CRITICAL ISSUES' + verdictMsg = 'Physical failures + AI detected problems' + verdictBg = '#fef2f2' + verdictBd = '#fecaca' + verdictTx = '#991b1b' + } else if (!physicalPass) { + verdictLabel = 'PHYSICAL INCOMPLETE' + verdictMsg = `${missing.length} port(s) untested${isSkipped ? ' — testing skipped' : ''}` + verdictBg = '#fef2f2' + verdictBd = '#fecaca' + verdictTx = '#991b1b' + } else if (!aiPass) { + verdictLabel = `AI: ${summaryStatus}` + verdictMsg = + summaryStatus === 'FAIL' + ? 'AI analysis failed — review required' + : 'AI detected warnings — verify results' + verdictBg = summaryStatus === 'FAIL' ? '#fef2f2' : '#fffbeb' + verdictBd = summaryStatus === 'FAIL' ? '#fecaca' : '#fde68a' + verdictTx = summaryStatus === 'FAIL' ? '#991b1b' : '#92400e' + } const reportId = `RPT-${momentTZ().tz(timeZone).format('YYYY-MMDD')}` const reportDate = momentTZ().tz(timeZone).format('DD MMM YYYY') @@ -1995,7 +2029,7 @@ Ports Missing/Down: ${missing.length}\n\n` .slice(0, 1) .map( (issue) => - `
★ AI${escapeHtml(issue)}Investigate
` + `
★ AI${escapeHtml(issue)}
` ) .join('') : `
★ AIPotential intermittent power instability. PSU #1 POST logs show 3 retries before handshake.Investigate
` @@ -2096,7 +2130,6 @@ Ports Missing/Down: ${missing.length}\n\n` - #${escapeHtml(reportId)} ${escapeHtml(reportDate)} @@ -2121,24 +2154,20 @@ Ports Missing/Down: ${missing.length}\n\n` -
- +
Product Info
- - - - - +
Name${productName}
P/N${productPN}
S/N${productSN}
MAC${macAddress}
Type--
Cond.--
Supplier-
Warranty-
MAC${macAddress || '-'}
- +
@@ -2191,25 +2205,12 @@ Ports Missing/Down: ${missing.length}\n\n` +
Technical Specs
@@ -2150,32 +2179,17 @@ Ports Missing/Down: ${missing.length}\n\n` - + - + - - - - - - - - - - - - - - - - +
IOS-XE Version ${iosVersion}-${'N/A'}
System RAM ${memDisplay}${configRam?.ram || '-'}${configRam?.ram || 'N/A'}
Flash Storage ${flashDisplay}${configRam?.flash || '-'}
Uplink Module--
PSU Model--
PoE Budget--${configRam?.flash || 'N/A'}
Issues Found
${aiIssueRowsHtml} - - - - - -
COSMETICMinor scratch on top chassis (2cm) — non-functionalAccepted
- - - - - -
MINORFan #2 at 48dB under stress (spec 45dB) — within rack toleranceMonitor
-
0 Critical · 0 Major · 1 Minor · 1 Cosmetic
-
+
-
Receiving & Inspection Notes
@@ -2254,7 +2255,7 @@ Ports Missing/Down: ${missing.length}\n\n`
-
+
Received
@@ -2269,7 +2270,7 @@ Ports Missing/Down: ${missing.length}\n\n`
-
+
Software Test
@@ -2285,7 +2286,7 @@ Ports Missing/Down: ${missing.length}\n\n` ✓
-
+
Physical Check
@@ -2313,7 +2314,7 @@ Ports Missing/Down: ${missing.length}\n\n`
+
@@ -2370,7 +2371,7 @@ Ports Missing/Down: ${missing.length}\n\n` this.config?.inventory?.listInventory ?.map( (item: any) => ` - ` + ` ) .join('') || '' } diff --git a/FRONTEND/src/components/Modal/ModalConfig.tsx b/FRONTEND/src/components/Modal/ModalConfig.tsx index 01785c7..bea3465 100644 --- a/FRONTEND/src/components/Modal/ModalConfig.tsx +++ b/FRONTEND/src/components/Modal/ModalConfig.tsx @@ -96,7 +96,7 @@ export default function ModalConfig({ opened, onClose, onSave }: Props) { } setIsDisabled(true); try { - const url = editingId ? "/api/prompt-ai/update" : "/api/prompt-ai/create"; + const url = editingId ? "api/prompt-ai/update" : "api/prompt-ai/create"; const payload = editingId ? { id: editingId, ...formData } : formData; const response = await axios.post(apiUrl + url, payload); @@ -114,6 +114,7 @@ export default function ModalConfig({ opened, onClose, onSave }: Props) { setEditingId(null); fetchPrompts(); setIsDisabled(false); + setModalEditing(false); } else { notifications.show({ title: "Error",
${item.pid}${item.sn}
${item.pid}${item.sn}