'use client'; import { useState, useEffect } from 'react'; import { PageLayout, DataTable, StatCard } from '@/components/ui'; import { healthApi, auditLogApi } from '@/lib/api/api-client'; export default function MonitoringPage() { const [health, setHealth] = useState(null); const [logs, setLogs] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const load = async () => { setLoading(true); const [h, l] = await Promise.all([healthApi.check().catch(() => ({ status: 'unreachable' })), auditLogApi.list({ per_page: 20 }).catch(() => ({ items: [] }))]); setHealth(h); setLogs(l?.items || []); setLoading(false); }; load(); const iv = setInterval(load, 30000); return () => clearInterval(iv); }, []); return ( {!loading && <>

Последние события

{l.created_at ? new Date(l.created_at).toLocaleString('ru-RU') : '—'} }, { key: 'action', header: 'Действие', render: (l: any) => {l.action} }, { key: 'entity_type', header: 'Объект', className: 'text-xs' }, { key: 'user_email', header: 'Пользователь', className: 'text-xs' }, { key: 'description', header: 'Описание', className: 'text-xs text-gray-500' }, ]} /> }
); }