mirror of
				https://github.com/csehviktor/status-monitor.git
				synced 2025-08-08 18:06:14 +02:00 
			
		
		
		
	fix undefined values
This commit is contained in:
		| @@ -92,7 +92,7 @@ export function AgentPage() { | ||||
|                                 title: "CPU USAGE", | ||||
|                                 value: formatPercentage(cpuUsage), | ||||
|                                 status: getMetricStatus(cpuUsage), | ||||
|                                 subtitle: `${metrics?.cpu.threads} threads`, | ||||
|                                 subtitle: `${metrics?.cpu.threads ?? 0} threads`, | ||||
|                             }} | ||||
|                         > | ||||
|                             <DonutChart | ||||
|   | ||||
| @@ -63,7 +63,7 @@ export function calcPercentage( | ||||
|     value: number | undefined, | ||||
|     total: number | undefined, | ||||
| ): number { | ||||
|     if (value === undefined || total === undefined) return 0; | ||||
|     if (!value || !total) return 0; | ||||
|     return (value / total) * 100; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user