import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { Shield, ArrowLeft, CheckCircle2, XCircle, AlertTriangle, Clock, FileText } from 'lucide-react'; export function PolicyEngine() { const navigate = useNavigate(); const [status] = useState<'active' | 'inactive'>('active'); const [loading, setLoading] = useState(true); useEffect(() => { const t = setTimeout(() => setLoading(false), 500); return () => clearTimeout(t); }, []); const rules = [ { title: 'Security over convenience', description: 'Безопасность важнее удобства', icon: Shield, color: 'blue' }, { title: 'Policy Engine supremacy', description: 'Движок политик имеет приоритет над всеми модулями', icon: Shield, color: 'purple' }, { title: 'Desktop Core authority', description: 'Desktop Core имеет финальную власть над Web слоем', icon: Shield, color: 'emerald' }, { title: 'Mandatory audit logging', description: 'Все действия должны логироваться', icon: FileText, color: 'orange' }, ]; const denials = [ { timestamp: new Date().toISOString(), reason: "Запрос отклонён: инструмент 'shell.exec' не в allowlist", tool: 'shell.exec' }, { timestamp: new Date(Date.now() - 3600000).toISOString(), reason: "Запрос отклонён: путь '/etc/passwd' не разрешён", tool: 'fs.read' }, ]; const colorClasses: Record = { blue: 'from-blue-500/10 to-blue-600/5 border-blue-200/50 text-blue-700 dark:text-blue-400', purple: 'from-purple-500/10 to-purple-600/5 border-purple-200/50 text-purple-700 dark:text-purple-400', emerald: 'from-emerald-500/10 to-emerald-600/5 border-emerald-200/50 text-emerald-700 dark:text-emerald-400', orange: 'from-orange-500/10 to-orange-600/5 border-orange-200/50 text-orange-700 dark:text-orange-400', }; if (loading) { return (
); } return (

Движок политик

Управление правилами безопасности

{status === 'active' ? : }

Статус системы

{status === 'active' ? 'Движок политик активен' : 'Движок политик неактивен'}

{status === 'active' ? <>Активен : <>Неактивен}

Правила безопасности

{rules.map((rule, index) => { const Icon = rule.icon; const cls = colorClasses[rule.color] || colorClasses.blue; return (
{rule.title}
{rule.description}
); })}

Журнал блокировок

{denials.map((d, i) => (
{new Date(d.timestamp).toLocaleString('ru-RU')}
{d.reason}
{d.tool &&
{d.tool}
}
))}
); }