Files
breakpilot-lehrer/website/app/admin/middleware/_components/EventsTab.tsx
Benjamin Admin b4613e26f3 [split-required] Split 500-850 LOC files (batch 2)
backend-lehrer (10 files):
- game/database.py (785 → 5), correction_api.py (683 → 4)
- classroom_engine/antizipation.py (676 → 5)
- llm_gateway schools/edu_search already done in prior batch

klausur-service (12 files):
- orientation_crop_api.py (694 → 5), pdf_export.py (677 → 4)
- zeugnis_crawler.py (676 → 5), grid_editor_api.py (671 → 5)
- eh_templates.py (658 → 5), mail/api.py (651 → 5)
- qdrant_service.py (638 → 5), training_api.py (625 → 4)

website (6 pages):
- middleware (696 → 8), mail (733 → 6), consent (628 → 8)
- compliance/risks (622 → 5), export (502 → 5), brandbook (629 → 7)

studio-v2 (3 components):
- B2BMigrationWizard (848 → 3), CleanupPanel (765 → 2)
- dashboard-experimental (739 → 2)

admin-lehrer (4 files):
- uebersetzungen (769 → 4), manager (670 → 2)
- ChunkBrowserQA (675 → 6), dsfa/page (674 → 5)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-25 08:24:01 +02:00

79 lines
3.1 KiB
TypeScript

'use client'
import { MIDDLEWARE_INFO } from './types'
import type { MiddlewareHookReturn } from './types'
interface EventsTabProps {
hook: MiddlewareHookReturn
}
export default function EventsTab({ hook }: EventsTabProps) {
const { events } = hook
return (
<div className="space-y-6">
<div className="bg-white rounded-lg shadow overflow-hidden">
<div className="px-4 py-3 border-b border-gray-200 flex justify-between items-center">
<h3 className="text-lg font-medium">Recent Middleware Events</h3>
<button
onClick={hook.loadData}
className="text-sm text-blue-600 hover:text-blue-800"
>
Refresh
</button>
</div>
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-gray-50">
<tr>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Time</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Middleware</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Event</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">IP</th>
<th className="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Path</th>
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{events.length === 0 ? (
<tr>
<td colSpan={5} className="px-4 py-4 text-center text-gray-500">
No events recorded yet
</td>
</tr>
) : (
events.map((event) => (
<tr key={event.id}>
<td className="px-4 py-2 text-sm text-gray-500">
{new Date(event.created_at).toLocaleString()}
</td>
<td className="px-4 py-2">
<span className="text-sm font-medium">
{MIDDLEWARE_INFO[event.middleware_name]?.name || event.middleware_name}
</span>
</td>
<td className="px-4 py-2">
<span className={`px-2 py-1 text-xs rounded-full ${
event.event_type.includes('blocked') || event.event_type.includes('exceeded')
? 'bg-red-100 text-red-800'
: event.event_type.includes('add') || event.event_type.includes('changed')
? 'bg-blue-100 text-blue-800'
: 'bg-gray-100 text-gray-800'
}`}>
{event.event_type}
</span>
</td>
<td className="px-4 py-2 font-mono text-sm text-gray-500">
{event.ip_address || '-'}
</td>
<td className="px-4 py-2 text-sm text-gray-500 truncate max-w-xs">
{event.request_path || '-'}
</td>
</tr>
))
)}
</tbody>
</table>
</div>
</div>
)
}