diff --git a/src/components/Dashboard.tsx b/src/components/Dashboard.tsx index c684af9..0e97329 100644 --- a/src/components/Dashboard.tsx +++ b/src/components/Dashboard.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PieChart as ChartPie, ShieldAlert, Clock, FileText } from 'lucide-react'; +import { PieChart as ChartPie, ShieldAlert, Clock, FileText, Laptop } from 'lucide-react'; import { mockCVEs } from '../data/mockData'; const severityColors = { @@ -23,6 +23,15 @@ const severityCounts = { LOW: mockCVEs.filter(cve => cve.severity === 'LOW').length, }; +// Mock data for device alerts +const deviceAlerts = [ + { id: 1, name: 'Windows Server 2019', alerts: 12, criticalAlerts: 3, highAlerts: 6 }, + { id: 2, name: 'Ubuntu 20.04 LTS', alerts: 8, criticalAlerts: 2, highAlerts: 3 }, + { id: 3, name: 'macOS Monterey', alerts: 5, criticalAlerts: 0, highAlerts: 2 }, + { id: 4, name: 'Cisco IOS Router', alerts: 7, criticalAlerts: 4, highAlerts: 2 }, + { id: 5, name: 'Oracle Database Server', alerts: 9, criticalAlerts: 1, highAlerts: 5 } +]; + const Dashboard = () => { return (
@@ -93,7 +102,7 @@ const Dashboard = () => {
-
+

Recent Vulnerabilities

@@ -169,6 +178,72 @@ const Dashboard = () => {
+ + {/* Device Vulnerability Alerts Section */} +
+
+

+ + Alerts by Device +

+
+
+
+ + + + + + + + + + + + {deviceAlerts.map((device) => ( + + + + + + + + ))} + +
DeviceTotal AlertsCriticalHigh
+ {device.name} + + {device.alerts} + + {device.criticalAlerts > 0 && ( + + {device.criticalAlerts} + + )} + {device.criticalAlerts === 0 && ( + 0 + )} + + {device.highAlerts > 0 && ( + + {device.highAlerts} + + )} + {device.highAlerts === 0 && ( + 0 + )} + + View +
+
+ +
+ + View all devices → + +
+
+
); }; diff --git a/src/data/mockData.ts b/src/data/mockData.ts index efa8d1b..1c9c7b5 100644 --- a/src/data/mockData.ts +++ b/src/data/mockData.ts @@ -1,4 +1,4 @@ -import { CVE, CVESource, CVERule } from '../types/cve'; +import { CVE, CVESource, CVERule, DeviceAlert } from '../types/cve'; export const mockCVEs: CVE[] = [ { @@ -178,4 +178,16 @@ export const mockRules: CVERule[] = [ priority: 3, is_active: true } +]; + +// Mock data for device alerts +export const mockDeviceAlerts: DeviceAlert[] = [ + { id: 1, name: 'Windows Server 2019', alerts: 12, criticalAlerts: 3, highAlerts: 6 }, + { id: 2, name: 'Ubuntu 20.04 LTS', alerts: 8, criticalAlerts: 2, highAlerts: 3 }, + { id: 3, name: 'macOS Monterey', alerts: 5, criticalAlerts: 0, highAlerts: 2 }, + { id: 4, name: 'Cisco IOS Router', alerts: 7, criticalAlerts: 4, highAlerts: 2 }, + { id: 5, name: 'Oracle Database Server', alerts: 9, criticalAlerts: 1, highAlerts: 5 }, + { id: 6, name: 'Windows 10 Workstations', alerts: 15, criticalAlerts: 2, highAlerts: 7 }, + { id: 7, name: 'Red Hat Enterprise Linux 8', alerts: 6, criticalAlerts: 1, highAlerts: 2 }, + { id: 8, name: 'VMware ESXi Hosts', alerts: 10, criticalAlerts: 2, highAlerts: 4 } ]; \ No newline at end of file diff --git a/src/types/cve.ts b/src/types/cve.ts index 1e2b251..f01cca4 100644 --- a/src/types/cve.ts +++ b/src/types/cve.ts @@ -42,4 +42,12 @@ export interface CVETicket { tickets_id: number; creation_type: 'AUTO' | 'MANUAL'; date_creation: string; +} + +export interface DeviceAlert { + id: number; + name: string; + alerts: number; + criticalAlerts: number; + highAlerts: number; } \ No newline at end of file