diff --git a/modules/boersenchecker/module.json b/modules/boersenchecker/module.json
new file mode 100644
index 0000000..c4eb0f8
--- /dev/null
+++ b/modules/boersenchecker/module.json
@@ -0,0 +1,25 @@
+{
+ "title": "Börsenchecker",
+ "version": "0.1.0",
+ "description": "Grundgeruest fuer ein Nexus-Modul zur Beobachtung und Auswertung von Boersenwerten.",
+ "enabled_by_default": false,
+ "menu": [
+ { "label": "Übersicht", "href": "/module/boersenchecker" }
+ ],
+ "sidebar": {
+ "enabled": true,
+ "collapsible": true,
+ "default": "collapsed",
+ "items": [
+ { "label": "Übersicht", "href": "/module/boersenchecker" }
+ ]
+ },
+ "setup": {
+ "fields": []
+ },
+ "auth": {
+ "required": true,
+ "users": [],
+ "groups": []
+ }
+}
diff --git a/modules/boersenchecker/pages/index.php b/modules/boersenchecker/pages/index.php
new file mode 100644
index 0000000..f2c6bce
--- /dev/null
+++ b/modules/boersenchecker/pages/index.php
@@ -0,0 +1,28 @@
+
+
+
Börsenchecker
+
Börsenchecker
+
+ Das Modul ist im Nexus registriert und kann jetzt schrittweise um Datenquellen,
+ Watchlists, Kennzahlen und Benachrichtigungen erweitert werden.
+
+
+
+
Status
+
+ Aktuell ist dies das initiale Grundgeruest des Moduls.
+
+
+
+
+
Nächste sinnvolle Ausbaustufen
+
+ - Watchlist fuer Ticker und ISINs
+ - Kursdaten per API einlesen
+ - Performance, Tagesdelta und historische Trends anzeigen
+ - Alerts fuer Schwellwerte definieren
+
+
+
diff --git a/modules/kea/pages/data.php b/modules/kea/pages/data.php
new file mode 100644
index 0000000..f710646
--- /dev/null
+++ b/modules/kea/pages/data.php
@@ -0,0 +1,91 @@
+get('kea');
+$fallback = $module['db_defaults'] ?? [];
+$settings = modules()->settings('kea');
+$metadataFallback = is_array($module['metadata_db_defaults'] ?? null) ? $module['metadata_db_defaults'] : [];
+$metadataConfig = is_array($settings['metadata_db'] ?? null)
+ ? array_replace($metadataFallback, $settings['metadata_db'])
+ : $metadataFallback;
+
+try {
+ $metadataRepo = null;
+ $pdo = modules()->modulePdo('kea', $fallback);
+ if (!empty($metadataConfig['driver']) && !empty($metadataConfig['dbname'])) {
+ try {
+ $metadataRepo = new KeaHostMetadataRepository(Database::createFromArray($metadataConfig));
+ $metadataRepo->ensureSchema();
+ } catch (\Throwable) {
+ $metadataRepo = null;
+ }
+ }
+
+ $repo = new KeaHostRepository($pdo, $metadataRepo);
+ $hosts = $repo->findAll(200);
+ $stats = [
+ 'total' => $repo->countReservations() + $repo->countLeases(),
+ 'reservations' => $repo->countReservations(),
+ 'leases' => $repo->countLeases(),
+ 'groups' => [],
+ 'free_ips' => [],
+ ];
+
+ foreach ($hosts as $host) {
+ $group = trim((string)($host['metadata']['group_name'] ?? ''));
+ if ($group !== '') {
+ $stats['groups'][$group] = ($stats['groups'][$group] ?? 0) + 1;
+ }
+ }
+
+ if ($metadataRepo !== null) {
+ $stats['free_ips'] = array_map(
+ static fn(array $ips): int => count($ips),
+ $metadataRepo->availableIpsByGroup(
+ array_merge($repo->usedIpAddresses(), $metadataRepo->desiredIps()),
+ 4096
+ )
+ );
+ }
+
+ $rows = array_map(static function (array $host): array {
+ return [
+ 'source' => (string)($host['source'] ?? 'reservation'),
+ 'host_id' => (string)($host['host_id'] ?? '0'),
+ 'display_name' => (string)($host['metadata']['device_name'] ?? $host['metadata']['real_name'] ?? $host['display_name'] ?? $host['hostname'] ?? 'Unbekannt'),
+ 'ipv4_address' => (string)($host['ipv4_address'] ?? ''),
+ 'dhcp_identifier' => (string)($host['dhcp_identifier'] ?? ''),
+ 'last_seen_at' => (string)($host['last_seen_at'] ?? '-'),
+ 'lease_expires_at' => (string)($host['lease_expires_at'] ?? '-'),
+ 'real_name' => (string)($host['metadata']['real_name'] ?? '-'),
+ 'location' => (string)($host['metadata']['location'] ?? '-'),
+ 'group_name' => (string)($host['metadata']['group_name'] ?? '-'),
+ ];
+ }, $hosts);
+
+ echo json_encode([
+ 'ok' => true,
+ 'stats' => [
+ 'total' => (int)$stats['total'],
+ 'reservations' => (int)$stats['reservations'],
+ 'leases' => (int)$stats['leases'],
+ 'groups' => count($stats['groups']),
+ 'free_ips' => array_sum($stats['free_ips']),
+ ],
+ 'rows' => $rows,
+ 'updated_at' => date('H:i:s'),
+ ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
+} catch (\Throwable $e) {
+ http_response_code(500);
+ echo json_encode([
+ 'ok' => false,
+ 'error' => $e->getMessage(),
+ ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
+}
+
+exit;
diff --git a/modules/kea/partials/dashboard.php b/modules/kea/partials/dashboard.php
index 442c169..6ced4ab 100644
--- a/modules/kea/partials/dashboard.php
+++ b/modules/kea/partials/dashboard.php
@@ -11,6 +11,9 @@
KEA DHCP Hosts
Reservierungen und aktuelle Leases aus der KEA-Datenbank.
+
+ Automatische Aktualisierung alle 5 Sekunden.
+
Gruppen verwalten
@@ -34,23 +37,23 @@
Einträge
- = e((string)($stats['total'] ?? 0)) ?>
+ = e((string)($stats['total'] ?? 0)) ?>
Reservierungen
- = e((string)($stats['reservations'] ?? 0)) ?>
+ = e((string)($stats['reservations'] ?? 0)) ?>
Leases
- = e((string)($stats['leases'] ?? 0)) ?>
+ = e((string)($stats['leases'] ?? 0)) ?>
Gruppen
- = e((string)count($stats['groups'] ?? [])) ?>
+ = e((string)count($stats['groups'] ?? [])) ?>
Freie Gruppen-IPs
- = e((string)array_sum($stats['free_ips'] ?? [])) ?>
+ = e((string)array_sum($stats['free_ips'] ?? [])) ?>
@@ -78,7 +81,7 @@
Aktion |
-
+
|
@@ -128,3 +131,98 @@
+
|