This commit is contained in:
2026-03-02 01:45:57 +01:00
parent c92f6d7673
commit 3102790842
8 changed files with 317 additions and 85 deletions

View File

@@ -1,3 +1,22 @@
<?php
use App\Database;
use App\Repository\KeaHostRepository;
echo "test";
global $appConfig;
$pdo = Database::createPdo($appConfig);
$hosts = [];
$error = null;
if ($pdo) {
try {
$repo = new KeaHostRepository($pdo);
$hosts = $repo->findAll(50);
} catch (\Exception $e) {
$error = "Datenbankfehler: " . $e->getMessage();
}
} else {
$error = "Datenbankverbindung ist nicht konfiguriert oder deaktiviert.";
}
tpl('kea_dashboard', 'landing', compact('hosts', 'error'));

View File

@@ -0,0 +1,74 @@
<?php
/**
* @var array $hosts Die Liste der KEA-Hosts.
* @var string|null $error Eine Fehlermeldung, falls vorhanden.
*/
?>
<div class="px-4 py-6 sm:px-0">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-semibold text-white">KEA DHCP Hosts</h1>
<button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded shadow transition-colors">
+ Neuer Host
</button>
</div>
<?php if ($error): ?>
<div class="bg-red-900 border-l-4 border-red-500 text-red-100 p-4 mb-6" role="alert">
<p class="font-bold">Fehler</p>
<p><?= e($error) ?></p>
</div>
<?php endif; ?>
<div class="bg-gray-800 shadow overflow-hidden sm:rounded-lg border border-gray-700">
<div class="px-4 py-5 sm:px-6 border-b border-gray-700">
<h3 class="text-lg leading-6 font-medium text-gray-200">
Registrierte Geräte
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-400">
Übersicht der statischen Reservierungen und bekannten Clients.
</p>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-700">
<thead class="bg-gray-900">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Hostname</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">IP Adresse</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">MAC Adresse</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Kontext</th>
<th scope="col" class="relative px-6 py-3">
<span class="sr-only">Edit</span>
</th>
</tr>
</thead>
<tbody class="bg-gray-800 divide-y divide-gray-700">
<?php if (empty($hosts)): ?>
<tr>
<td colspan="5" class="px-6 py-4 text-center text-sm text-gray-500">Keine Hosts gefunden.</td>
</tr>
<?php else: ?>
<?php foreach ($hosts as $host): ?>
<tr class="hover:bg-gray-750 transition-colors">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-white">
<?= e($host['hostname'] ?: 'Unbekannt') ?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300 font-mono">
<?= e($host['ipv4_address']) ?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400 font-mono">
<?= e($host['dhcp_identifier']) ?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-400">
<?= e($host['user_context'] ?? '-') ?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<a href="#" class="text-indigo-400 hover:text-indigo-300">Bearbeiten</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,11 @@
</div>
</main>
<footer class="bg-gray-800 border-t border-gray-700 mt-auto">
<div class="max-w-7xl mx-auto py-4 px-4 sm:px-6 lg:px-8">
<p class="text-center text-gray-500 text-xs">&copy; <?= date('Y') ?> Nexus Control Panel. System Status: Nominal.</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="de" class="h-full bg-gray-900">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nexus Control Panel</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
/* Custom Scrollbar für Nexus-Look */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #111827; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }
</style>
</head>
<body class="h-full text-gray-300 font-sans antialiased flex flex-col">
<nav class="bg-gray-800 border-b border-gray-700">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0 text-indigo-500 font-bold text-xl tracking-wider">
NEXUS
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<a href="/" class="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium">Dashboard</a>
<a href="#" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">DHCP Leases</a>
<a href="#" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Logs</a>
</div>
</div>
</div>
</div>
</div>
</nav>
<main class="flex-grow">
<div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">