fix: Monitor page now uses real API data
- Changed fetch URL from /api/monitor.php to /api/monitor - Updated MonitorData interface to match API response structure - Fixed stats calculation (MySQL returning strings instead of numbers) - Updated mock data with realistic values from production DB Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,10 +162,13 @@ export async function getMonitoringData() {
|
||||
let overall: 'ok' | 'warning' | 'critical' = 'ok'
|
||||
let total_critical = 0
|
||||
let total_warning = 0
|
||||
let total_ok = 0
|
||||
|
||||
for (const s of summary as CategorySummary[]) {
|
||||
total_critical += s.critical
|
||||
total_warning += s.warning
|
||||
// MySQL pode retornar strings, converter para número
|
||||
total_critical += Number(s.critical) || 0
|
||||
total_warning += Number(s.warning) || 0
|
||||
total_ok += Number(s.ok) || 0
|
||||
}
|
||||
|
||||
if (total_critical > 0) overall = 'critical'
|
||||
@@ -178,7 +181,7 @@ export async function getMonitoringData() {
|
||||
stats: {
|
||||
total_critical,
|
||||
total_warning,
|
||||
total_ok: items.length - total_critical - total_warning
|
||||
total_ok
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user