diff --git a/management/src/pages/SecurityLogs.jsx b/management/src/pages/SecurityLogs.jsx index 26fc600..627f1ad 100644 --- a/management/src/pages/SecurityLogs.jsx +++ b/management/src/pages/SecurityLogs.jsx @@ -1,7 +1,4 @@ import React, { useState, useEffect } from 'react'; -import { Card, CardHeader, CardTitle, CardContent } from '../components/ui/card'; -import { Alert, AlertDescription } from '../components/ui/alert'; -import { Badge } from '../components/ui/badge'; import { formatDistanceToNow } from 'date-fns'; const SecurityLogs = () => { @@ -59,11 +56,11 @@ const SecurityLogs = () => { const getLogLevelBadge = (level) => { const styles = { - 'critical': 'bg-red-500 text-white', - 'high': 'bg-orange-500 text-white', - 'medium': 'bg-yellow-500 text-black', - 'low': 'bg-blue-500 text-white', - 'info': 'bg-gray-500 text-white' + 'critical': 'bg-red-500 text-white px-2 py-1 rounded text-xs font-semibold', + 'high': 'bg-orange-500 text-white px-2 py-1 rounded text-xs font-semibold', + 'medium': 'bg-yellow-500 text-black px-2 py-1 rounded text-xs font-semibold', + 'low': 'bg-blue-500 text-white px-2 py-1 rounded text-xs font-semibold', + 'info': 'bg-gray-500 text-white px-2 py-1 rounded text-xs font-semibold' }; return styles[level] || styles.info; }; @@ -97,31 +94,29 @@ const SecurityLogs = () => { return (
-

Security Logs

+

Security Logs

Monitor security events across all tenants

{error && ( - - - {error} - - +
+
{error}
+
)} {/* Filters */} - - - Filters - - +
+
+

Filters

+
+
- +
- +
- +
- + setFilters(prev => ({ ...prev, search: e.target.value }))} - className="w-full p-2 border rounded-md" + className="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" />
- - +
+
{/* Security Logs Table */} - - - - Security Events - +
+
+
+

Security Events

+ {pagination.total} total events - - - +
+
+
{loading ? (
Loading security logs...
@@ -198,40 +193,40 @@ const SecurityLogs = () => {
- - - - - - + + + + + + {logs.map((log) => ( - - + - - - -
TimeLevelEventMessageDetails
TimeLevelEventMessageDetails
+
{new Date(log.timestamp).toLocaleString()}
{formatDistanceToNow(new Date(log.timestamp), { addSuffix: true })}
- + + {log.level.toUpperCase()} - + +
{getEventTypeIcon(log.event_type)} {log.event_type.replace('_', ' ').toUpperCase()}
+
{log.message}
+
{formatMetadata(log.metadata)}
@@ -253,22 +248,22 @@ const SecurityLogs = () => { )} - - + + ); };