[split-required] Split 58 monoliths across Python, Go, TypeScript (Phases 1-3)
Phase 1 — Python (klausur-service): 5 monoliths → 36 files - dsfa_corpus_ingestion.py (1,828 LOC → 5 files) - cv_ocr_engines.py (2,102 LOC → 7 files) - cv_layout.py (3,653 LOC → 10 files) - vocab_worksheet_api.py (2,783 LOC → 8 files) - grid_build_core.py (1,958 LOC → 6 files) Phase 2 — Go (edu-search-service, school-service): 8 monoliths → 19 files - staff_crawler.go (1,402 → 4), policy/store.go (1,168 → 3) - policy_handlers.go (700 → 2), repository.go (684 → 2) - search.go (592 → 2), ai_extraction_handlers.go (554 → 2) - seed_data.go (591 → 2), grade_service.go (646 → 2) Phase 3 — TypeScript (admin-lehrer): 45 monoliths → 220+ files - sdk/types.ts (2,108 → 16 domain files) - ai/rag/page.tsx (2,686 → 14 files) - 22 page.tsx files split into _components/ + _hooks/ - 11 component files split into sub-components - 10 SDK data catalogs added to loc-exceptions - Deleted dead backup index_original.ts (4,899 LOC) All original public APIs preserved via re-export facades. Zero new errors: Python imports verified, Go builds clean, TypeScript tsc --noEmit shows only pre-existing errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
302
admin-lehrer/app/(admin)/rbac/_components/CreateModal.tsx
Normal file
302
admin-lehrer/app/(admin)/rbac/_components/CreateModal.tsx
Normal file
@@ -0,0 +1,302 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import type { TabId } from '../types'
|
||||
|
||||
interface CreateModalProps {
|
||||
type: TabId
|
||||
tenantId: string
|
||||
onClose: () => void
|
||||
onSave: (data: any) => void
|
||||
}
|
||||
|
||||
function getTitle(type: TabId): string {
|
||||
switch (type) {
|
||||
case 'tenants': return 'Neuer Mandant'
|
||||
case 'namespaces': return 'Neuer Namespace'
|
||||
case 'roles': return 'Neue Rolle'
|
||||
case 'users': return 'Rolle zuweisen'
|
||||
case 'policies': return 'Neue LLM-Policy'
|
||||
}
|
||||
}
|
||||
|
||||
function TenantForm({ formData, setFormData }: { formData: any; setFormData: (d: any) => void }) {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Slug</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.slug || ''}
|
||||
onChange={(e) => setFormData({ ...formData, slug: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Max Users</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.max_users || 100}
|
||||
onChange={(e) => setFormData({ ...formData, max_users: parseInt(e.target.value) })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">LLM Quota/Monat</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.llm_quota_monthly || 10000}
|
||||
onChange={(e) => setFormData({ ...formData, llm_quota_monthly: parseInt(e.target.value) })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function NamespaceForm({ formData, setFormData }: { formData: any; setFormData: (d: any) => void }) {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Slug</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.slug || ''}
|
||||
onChange={(e) => setFormData({ ...formData, slug: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Isolation Level</label>
|
||||
<select
|
||||
value={formData.isolation_level || 'strict'}
|
||||
onChange={(e) => setFormData({ ...formData, isolation_level: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
>
|
||||
<option value="strict">Strict</option>
|
||||
<option value="standard">Standard</option>
|
||||
<option value="relaxed">Relaxed</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Daten-Klassifizierung</label>
|
||||
<select
|
||||
value={formData.data_classification || 'internal'}
|
||||
onChange={(e) => setFormData({ ...formData, data_classification: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
>
|
||||
<option value="public">Public</option>
|
||||
<option value="internal">Internal</option>
|
||||
<option value="confidential">Confidential</option>
|
||||
<option value="restricted">Restricted</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function RoleForm({ formData, setFormData }: { formData: any; setFormData: (d: any) => void }) {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Beschreibung</label>
|
||||
<textarea
|
||||
value={formData.description || ''}
|
||||
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
||||
rows={2}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Permissions (komma-separiert)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.permissions?.join(', ') || ''}
|
||||
onChange={(e) => setFormData({ ...formData, permissions: e.target.value.split(',').map((s: string) => s.trim()) })}
|
||||
placeholder="compliance:read, llm:query"
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Hierarchie-Level (niedriger = hoeher)</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.hierarchy_level || 100}
|
||||
onChange={(e) => setFormData({ ...formData, hierarchy_level: parseInt(e.target.value) })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
function PolicyForm({ formData, setFormData }: { formData: any; setFormData: (d: any) => void }) {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Name</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
value={formData.name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Erlaubte Daten-Kategorien</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.allowed_data_categories?.join(', ') || ''}
|
||||
onChange={(e) => setFormData({ ...formData, allowed_data_categories: e.target.value.split(',').map((s: string) => s.trim()) })}
|
||||
placeholder="salary, compensation, finance"
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Blockierte Daten-Kategorien</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.blocked_data_categories?.join(', ') || ''}
|
||||
onChange={(e) => setFormData({ ...formData, blocked_data_categories: e.target.value.split(',').map((s: string) => s.trim()) })}
|
||||
placeholder="health, personal, salary"
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<label className="flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={formData.require_pii_redaction ?? true}
|
||||
onChange={(e) => setFormData({ ...formData, require_pii_redaction: e.target.checked })}
|
||||
className="rounded border-slate-300"
|
||||
/>
|
||||
<span className="text-sm text-slate-700">PII-Redaktion erforderlich</span>
|
||||
</label>
|
||||
{formData.require_pii_redaction && (
|
||||
<select
|
||||
value={formData.pii_redaction_level || 'strict'}
|
||||
onChange={(e) => setFormData({ ...formData, pii_redaction_level: e.target.value })}
|
||||
className="px-3 py-1 border rounded-lg text-sm"
|
||||
>
|
||||
<option value="strict">Strict</option>
|
||||
<option value="moderate">Moderate</option>
|
||||
<option value="minimal">Minimal</option>
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Max Tokens/Request</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.max_tokens_per_request || 4000}
|
||||
onChange={(e) => setFormData({ ...formData, max_tokens_per_request: parseInt(e.target.value) })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-slate-700 mb-1">Max Requests/Tag</label>
|
||||
<input
|
||||
type="number"
|
||||
value={formData.max_requests_per_day || 1000}
|
||||
onChange={(e) => setFormData({ ...formData, max_requests_per_day: parseInt(e.target.value) })}
|
||||
className="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-primary-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function CreateModal({ type, tenantId, onClose, onSave }: CreateModalProps) {
|
||||
const [formData, setFormData] = useState<any>({})
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
onSave(formData)
|
||||
}
|
||||
|
||||
const renderForm = () => {
|
||||
switch (type) {
|
||||
case 'tenants':
|
||||
return <TenantForm formData={formData} setFormData={setFormData} />
|
||||
case 'namespaces':
|
||||
return <NamespaceForm formData={formData} setFormData={setFormData} />
|
||||
case 'roles':
|
||||
return <RoleForm formData={formData} setFormData={setFormData} />
|
||||
case 'policies':
|
||||
return <PolicyForm formData={formData} setFormData={setFormData} />
|
||||
default:
|
||||
return <p>Nicht unterstuetzt</p>
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
|
||||
<div className="bg-white rounded-xl shadow-xl w-full max-w-lg">
|
||||
<div className="p-6 border-b">
|
||||
<h3 className="text-lg font-semibold text-slate-900">{getTitle(type)}</h3>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="p-6 space-y-4">
|
||||
{renderForm()}
|
||||
</div>
|
||||
|
||||
<div className="p-6 border-t bg-slate-50 flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="px-4 py-2 text-slate-600 hover:text-slate-800"
|
||||
>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700"
|
||||
>
|
||||
Erstellen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
'use client'
|
||||
|
||||
import type { Namespace } from '../types'
|
||||
import { ISOLATION_COLORS, DATA_CLASSIFICATION_COLORS } from '../types'
|
||||
|
||||
interface NamespacesTableProps {
|
||||
namespaces: Namespace[]
|
||||
onEdit: (n: Namespace) => void
|
||||
}
|
||||
|
||||
export function NamespacesTable({ namespaces, onEdit }: NamespacesTableProps) {
|
||||
if (namespaces.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12 text-slate-500">
|
||||
<svg className="w-16 h-16 mx-auto text-slate-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4" />
|
||||
</svg>
|
||||
<p>Keine Namespaces vorhanden. Waehlen Sie zuerst einen Mandanten.</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50 border-b">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Name</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Slug</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Isolation</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Klassifizierung</th>
|
||||
<th className="px-4 py-3 text-right text-xs font-medium text-slate-500 uppercase">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{namespaces.map(ns => (
|
||||
<tr key={ns.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3 font-medium text-slate-900">{ns.name}</td>
|
||||
<td className="px-4 py-3 font-mono text-slate-600">{ns.slug}</td>
|
||||
<td className="px-4 py-3 text-center">
|
||||
<span className={`px-2 py-1 text-xs rounded-full ${ISOLATION_COLORS[ns.isolation_level] || 'bg-slate-100'}`}>
|
||||
{ns.isolation_level}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-center">
|
||||
<span className={`px-2 py-1 text-xs rounded-full ${DATA_CLASSIFICATION_COLORS[ns.data_classification] || 'bg-slate-100'}`}>
|
||||
{ns.data_classification}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-right">
|
||||
<button
|
||||
onClick={() => onEdit(ns)}
|
||||
className="text-sm text-primary-600 hover:text-primary-700"
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
||||
79
admin-lehrer/app/(admin)/rbac/_components/PoliciesTable.tsx
Normal file
79
admin-lehrer/app/(admin)/rbac/_components/PoliciesTable.tsx
Normal file
@@ -0,0 +1,79 @@
|
||||
'use client'
|
||||
|
||||
import type { LLMPolicy } from '../types'
|
||||
|
||||
interface PoliciesTableProps {
|
||||
policies: LLMPolicy[]
|
||||
onEdit: (p: LLMPolicy) => void
|
||||
}
|
||||
|
||||
export function PoliciesTable({ policies, onEdit }: PoliciesTableProps) {
|
||||
if (policies.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12 text-slate-500">
|
||||
<svg className="w-16 h-16 mx-auto text-slate-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
|
||||
</svg>
|
||||
<p>Keine LLM-Policies vorhanden</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50 border-b">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Name</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Erlaubte Kategorien</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Blockierte Kategorien</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">PII Redaction</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Max Tokens</th>
|
||||
<th className="px-4 py-3 text-right text-xs font-medium text-slate-500 uppercase">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{policies.map(policy => (
|
||||
<tr key={policy.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3 font-medium text-slate-900">{policy.name}</td>
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{(policy.allowed_data_categories || []).map((c, i) => (
|
||||
<span key={i} className="px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded">
|
||||
{c}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{(policy.blocked_data_categories || []).map((c, i) => (
|
||||
<span key={i} className="px-2 py-0.5 text-xs bg-red-100 text-red-700 rounded">
|
||||
{c}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-center">
|
||||
<span className={`px-2 py-1 text-xs rounded-full ${
|
||||
policy.require_pii_redaction ? 'bg-yellow-100 text-yellow-700' : 'bg-slate-100 text-slate-500'
|
||||
}`}>
|
||||
{policy.require_pii_redaction ? policy.pii_redaction_level : 'aus'}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-center text-slate-600">
|
||||
{policy.max_tokens_per_request?.toLocaleString()}
|
||||
</td>
|
||||
<td className="px-4 py-3 text-right">
|
||||
<button
|
||||
onClick={() => onEdit(policy)}
|
||||
className="text-sm text-primary-600 hover:text-primary-700"
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
||||
75
admin-lehrer/app/(admin)/rbac/_components/RolesTable.tsx
Normal file
75
admin-lehrer/app/(admin)/rbac/_components/RolesTable.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
'use client'
|
||||
|
||||
import type { Role } from '../types'
|
||||
|
||||
interface RolesTableProps {
|
||||
roles: Role[]
|
||||
onEdit: (r: Role) => void
|
||||
}
|
||||
|
||||
export function RolesTable({ roles, onEdit }: RolesTableProps) {
|
||||
if (roles.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12 text-slate-500">
|
||||
<svg className="w-16 h-16 mx-auto text-slate-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
|
||||
</svg>
|
||||
<p>Keine Rollen vorhanden</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50 border-b">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Name</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Beschreibung</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Typ</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Hierarchie</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Permissions</th>
|
||||
<th className="px-4 py-3 text-right text-xs font-medium text-slate-500 uppercase">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{roles.map(role => (
|
||||
<tr key={role.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3 font-medium text-slate-900">{role.name}</td>
|
||||
<td className="px-4 py-3 text-slate-600 truncate max-w-xs">{role.description || '-'}</td>
|
||||
<td className="px-4 py-3 text-center">
|
||||
<span className={`px-2 py-1 text-xs rounded-full ${
|
||||
role.is_system_role ? 'bg-indigo-100 text-indigo-700' : 'bg-slate-100 text-slate-600'
|
||||
}`}>
|
||||
{role.is_system_role ? 'System' : 'Custom'}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-center text-slate-600">{role.hierarchy_level}</td>
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex flex-wrap gap-1 max-w-md">
|
||||
{(role.permissions || []).slice(0, 3).map((p, i) => (
|
||||
<span key={i} className="px-2 py-0.5 text-xs bg-slate-100 text-slate-600 rounded">
|
||||
{p}
|
||||
</span>
|
||||
))}
|
||||
{(role.permissions || []).length > 3 && (
|
||||
<span className="px-2 py-0.5 text-xs bg-slate-200 text-slate-600 rounded">
|
||||
+{role.permissions.length - 3}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-right">
|
||||
<button
|
||||
onClick={() => onEdit(role)}
|
||||
className="text-sm text-primary-600 hover:text-primary-700"
|
||||
disabled={role.is_system_role}
|
||||
>
|
||||
{role.is_system_role ? 'Ansehen' : 'Bearbeiten'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
||||
60
admin-lehrer/app/(admin)/rbac/_components/TenantsTable.tsx
Normal file
60
admin-lehrer/app/(admin)/rbac/_components/TenantsTable.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
'use client'
|
||||
|
||||
import type { Tenant } from '../types'
|
||||
import { STATUS_COLORS } from '../types'
|
||||
|
||||
interface TenantsTableProps {
|
||||
tenants: Tenant[]
|
||||
onEdit: (t: Tenant) => void
|
||||
}
|
||||
|
||||
export function TenantsTable({ tenants, onEdit }: TenantsTableProps) {
|
||||
if (tenants.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12 text-slate-500">
|
||||
<svg className="w-16 h-16 mx-auto text-slate-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
||||
</svg>
|
||||
<p>Keine Mandanten vorhanden</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-50 border-b">
|
||||
<tr>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Name</th>
|
||||
<th className="px-4 py-3 text-left text-xs font-medium text-slate-500 uppercase">Slug</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Status</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">Max Users</th>
|
||||
<th className="px-4 py-3 text-center text-xs font-medium text-slate-500 uppercase">LLM Quota</th>
|
||||
<th className="px-4 py-3 text-right text-xs font-medium text-slate-500 uppercase">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y">
|
||||
{tenants.map(tenant => (
|
||||
<tr key={tenant.id} className="hover:bg-slate-50">
|
||||
<td className="px-4 py-3 font-medium text-slate-900">{tenant.name}</td>
|
||||
<td className="px-4 py-3 font-mono text-slate-600">{tenant.slug}</td>
|
||||
<td className="px-4 py-3 text-center">
|
||||
<span className={`px-2 py-1 text-xs rounded-full ${STATUS_COLORS[tenant.status] || 'bg-slate-100'}`}>
|
||||
{tenant.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-center text-slate-600">{tenant.max_users}</td>
|
||||
<td className="px-4 py-3 text-center text-slate-600">{tenant.llm_quota_monthly?.toLocaleString()}</td>
|
||||
<td className="px-4 py-3 text-right">
|
||||
<button
|
||||
onClick={() => onEdit(tenant)}
|
||||
className="text-sm text-primary-600 hover:text-primary-700"
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
||||
22
admin-lehrer/app/(admin)/rbac/_components/UserRolesTable.tsx
Normal file
22
admin-lehrer/app/(admin)/rbac/_components/UserRolesTable.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
'use client'
|
||||
|
||||
import type { UserRole } from '../types'
|
||||
|
||||
interface UserRolesTableProps {
|
||||
userRoles: UserRole[]
|
||||
onEdit: (ur: UserRole) => void
|
||||
}
|
||||
|
||||
export function UserRolesTable({ userRoles, onEdit }: UserRolesTableProps) {
|
||||
return (
|
||||
<div className="text-center py-12 text-slate-500">
|
||||
<svg className="w-16 h-16 mx-auto text-slate-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
<p className="mb-2">Benutzer-Rollen Zuweisung</p>
|
||||
<p className="text-sm text-slate-400">
|
||||
Waehlen Sie einen Benutzer aus, um dessen Rollen zu verwalten.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user