fix: improved error display - show step, HTTP code, Hebrew messages; sync errors shown to user; deployment log shows error details

This commit is contained in:
2026-03-30 21:00:43 +00:00
parent 9380364376
commit f8026afed4
+25 -6
View File
@@ -259,11 +259,18 @@ function CustomerDetail({ customerId, onDelete }) {
setSyncing(true) setSyncing(true)
setDeployResult(null) setDeployResult(null)
try { try {
await fetch('/sync', { const r = await fetch('/sync', {
method: 'POST', headers: { 'Content-Type': 'application/json' }, method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ customer_id: customerId }) body: JSON.stringify({ customer_id: customerId })
}) })
} catch (_) {} const result = await r.json()
const custResult = result.results?.find(r => r.customer_id === customerId || r.status === 'error')
if (custResult?.status === 'error') {
setDeployResult({ module: 'סנכרון', status: 'error', message: custResult.message })
}
} catch (e) {
setDeployResult({ module: 'סנכרון', status: 'error', message: `שגיאת רשת: ${e.message}` })
}
reload() reload()
setSyncing(false) setSyncing(false)
} }
@@ -393,9 +400,18 @@ function CustomerDetail({ customerId, onDelete }) {
)} )}
{deployResult && ( {deployResult && (
<div className={`p-4 rounded-xl mb-6 text-sm font-medium flex items-center gap-3 ${deployResult.status === 'ok' ? 'bg-emerald-50 text-emerald-800' : 'bg-red-50 text-red-800'}`}> <div className={`p-4 rounded-xl mb-6 text-sm font-medium ${deployResult.status === 'ok' ? 'bg-emerald-50 text-emerald-800' : 'bg-red-50 text-red-800'}`}>
<Icon name={deployResult.status === 'ok' ? 'check_circle' : 'error'} /> <div className="flex items-center gap-3">
{deployResult.module}: {deployResult.status === 'ok' ? 'הותקן בהצלחה!' : `שגיאה: ${deployResult.message}`} <Icon name={deployResult.status === 'ok' ? 'check_circle' : 'error'} />
<span className="font-bold">{deployResult.module}: {deployResult.status === 'ok' ? 'הותקן בהצלחה!' : 'נכשל'}</span>
</div>
{deployResult.status !== 'ok' && deployResult.message && (
<div className="mt-2 mr-8 text-xs space-y-1">
<div>{deployResult.message}</div>
{deployResult.step && <div className="text-red-400">שלב: {({find_release:'חיפוש גרסה',find_zip:'חיפוש קובץ ZIP',download_zip:'הורדת ZIP',upload:'העלאה ל-EspoCRM',install:'התקנה',rebuild:'בנייה מחדש'})[deployResult.step] || deployResult.step}</div>}
{deployResult.code && <div className="text-red-400">קוד שגיאה: {deployResult.code}{deployResult.code === 401 ? ' (שם משתמש/סיסמה שגויים)' : deployResult.code === 403 ? ' (אין הרשאה)' : deployResult.code === 404 ? ' (לא נמצא)' : deployResult.code === 500 ? ' (שגיאת שרת)' : ''}</div>}
</div>
)}
</div> </div>
)} )}
@@ -553,10 +569,13 @@ function DeploymentsTab() {
</td> </td>
<td className="px-8 py-5"><VersionBadge>{d.version}</VersionBadge></td> <td className="px-8 py-5"><VersionBadge>{d.version}</VersionBadge></td>
<td className="px-8 py-5"> <td className="px-8 py-5">
<span className={`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-bold ${d.status === 'ok' ? 'bg-emerald-100 text-emerald-700' : 'bg-red-100 text-red-700'}`}> <span className={`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-bold ${d.status === 'ok' ? 'bg-emerald-100 text-emerald-700' : 'bg-red-100 text-red-700'}`} title={d.error_message || ''}>
<Icon name={d.status === 'ok' ? 'check' : 'close'} className="text-xs" /> <Icon name={d.status === 'ok' ? 'check' : 'close'} className="text-xs" />
{d.status === 'ok' ? 'הצלחה' : 'שגיאה'} {d.status === 'ok' ? 'הצלחה' : 'שגיאה'}
</span> </span>
{d.status !== 'ok' && d.error_message && (
<div className="text-xs text-red-400 mt-1 max-w-xs truncate" title={d.error_message}>{d.error_message}</div>
)}
</td> </td>
<td className="px-8 py-5"> <td className="px-8 py-5">
<span className={`text-xs font-medium px-2 py-0.5 rounded ${d.trigger_type === 'auto' ? 'bg-blue-50 text-blue-600' : 'bg-slate-100 text-slate-600'}`}> <span className={`text-xs font-medium px-2 py-0.5 rounded ${d.trigger_type === 'auto' ? 'bg-blue-50 text-blue-600' : 'bg-slate-100 text-slate-600'}`}>