Skip to content

Commit 95a251a

Browse files
committed
3.2.5
## [3.2.5] - 2024-12-19 ### Proxmox-Modul - Erweiterte VM/Container-Verwaltung #### Hinzugefügt - **LXC-Container-Unterstützung**: Vollständige Unterstützung für LXC-Container neben QEMU VMs - **Node-Management**: Detaillierte Node-Übersicht mit Status-Informationen und VM/Container-Zählung - **Storage-Details**: Umfassende Storage-Informationen mit Inhalt und Verfügbarkeit - **Bestätigungs-Modals**: Sichere Bestätigung für kritische Aktionen (Start/Stop/Delete) - **Erweiterte VM-Aktionen**: Reset, Resume und intelligente Button-Zustände - **RAM-Formatierung**: Anzeige von RAM-Größen in GB mit Dezimalstellen - **Uptime-Berechnung**: Automatische Berechnung und Anzeige der Laufzeit - **Framework-Erweiterungen**: ServiceManager-Unterstützung für QEMU und LXC #### Geändert - **Tab-basierte Navigation**: Ersetzt Modal-Overlays durch intuitive Tab-Navigation - **VM/Container-Liste**: Verbesserte Darstellung mit Typ-Unterscheidung - **Button-Logik**: Intelligente Aktivierung/Deaktivierung basierend auf Status und Typ - **API-Integration**: Optimierte Nutzung der Proxmox VE REST API - **Fehlerbehandlung**: Verbesserte Fehlermeldungen und Benutzer-Feedback #### Technische Verbesserungen - **Framework-Integration**: Erweiterte ServiceManager-Klasse für LXC-Unterstützung - **API-Endpunkte**: Vollständige Abdeckung aller Proxmox-API-Funktionen - **Code-Struktur**: Modularisierte JavaScript-Architektur - **Performance**: Optimierte Datenladung und Caching #### Bekannte Einschränkungen - **VM/Container-Erstellung**: Noch nicht implementiert (geplant für v1.2.0) - **VM/Container-Bearbeitung**: Konfigurationsänderungen noch nicht verfügbar - **Bulk-Operationen**: Mehrere VMs/Container gleichzeitig verwalten noch nicht möglich
1 parent 9002fdc commit 95a251a

31 files changed

+3552
-314
lines changed

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,71 @@
22

33
Alle wichtigen Änderungen am Server Management Framework werden in dieser Datei dokumentiert.
44

5+
## [3.2.5] - 2024-12-19
6+
7+
### Proxmox-Modul - Erweiterte VM/Container-Verwaltung
8+
9+
#### Hinzugefügt
10+
- **LXC-Container-Unterstützung**: Vollständige Unterstützung für LXC-Container neben QEMU VMs
11+
- **Node-Management**: Detaillierte Node-Übersicht mit Status-Informationen und VM/Container-Zählung
12+
- **Storage-Details**: Umfassende Storage-Informationen mit Inhalt und Verfügbarkeit
13+
- **Bestätigungs-Modals**: Sichere Bestätigung für kritische Aktionen (Start/Stop/Delete)
14+
- **Erweiterte VM-Aktionen**: Reset, Resume und intelligente Button-Zustände
15+
- **RAM-Formatierung**: Anzeige von RAM-Größen in GB mit Dezimalstellen
16+
- **Uptime-Berechnung**: Automatische Berechnung und Anzeige der Laufzeit
17+
- **Framework-Erweiterungen**: ServiceManager-Unterstützung für QEMU und LXC
18+
19+
#### Geändert
20+
- **Tab-basierte Navigation**: Ersetzt Modal-Overlays durch intuitive Tab-Navigation
21+
- **VM/Container-Liste**: Verbesserte Darstellung mit Typ-Unterscheidung
22+
- **Button-Logik**: Intelligente Aktivierung/Deaktivierung basierend auf Status und Typ
23+
- **API-Integration**: Optimierte Nutzung der Proxmox VE REST API
24+
- **Fehlerbehandlung**: Verbesserte Fehlermeldungen und Benutzer-Feedback
25+
26+
#### Technische Verbesserungen
27+
- **Framework-Integration**: Erweiterte ServiceManager-Klasse für LXC-Unterstützung
28+
- **API-Endpunkte**: Vollständige Abdeckung aller Proxmox-API-Funktionen
29+
- **Code-Struktur**: Modularisierte JavaScript-Architektur
30+
- **Performance**: Optimierte Datenladung und Caching
31+
32+
#### Bekannte Einschränkungen
33+
- **VM/Container-Erstellung**: Noch nicht implementiert (geplant für v1.2.0)
34+
- **VM/Container-Bearbeitung**: Konfigurationsänderungen noch nicht verfügbar
35+
- **Bulk-Operationen**: Mehrere VMs/Container gleichzeitig verwalten noch nicht möglich
36+
37+
## [3.2.4]
38+
39+
### Proxmox-Modul - Vollständige Überarbeitung
40+
41+
#### Hinzugefügt
42+
- **Server-Management-Hauptseite**: Übersichtliche Liste aller Proxmox-Server mit Status-Anzeige
43+
- **Server-Management-Modal**: Detaillierte Server-Verwaltung mit Start/Stop/Restart/Edit/Delete-Funktionen
44+
- **Server-Bearbeitungs-Interface**: Umfassende Konfigurationsmöglichkeiten für Server-Einstellungen
45+
- **Lösch-Bestätigung mit Status-Prüfung**: Server müssen gestoppt sein, bevor sie gelöscht werden können
46+
- **VM-Erstellen-Modal**: Benutzerfreundliche Oberfläche zum Erstellen neuer virtueller Maschinen
47+
- **Echtzeit-Status-Updates**: Automatische Aktualisierung der Server-Liste nach Aktionen
48+
- **Responsive Design**: Optimiert für verschiedene Bildschirmgrößen
49+
50+
#### Geändert
51+
- **Proxmox-Modul Übersetzungen**: Vollständige Umstellung auf die neue globale `t()`-Funktion
52+
- **Proxmox-Modul Template**: Komplett überarbeitete Benutzeroberfläche mit modernem Design
53+
- **Proxmox-Modul JavaScript**: Vereinfachte Übersetzungslogik und verbesserte Funktionalität
54+
- **Modul-System**: Konsistente Verwendung der globalen `t()`-Funktion in allen Modulen
55+
56+
#### Technische Details
57+
- **Entfernte Funktionen**: Manuelle Übersetzungs-Arrays und get_translations-Ajax-Aktion
58+
- **Vereinfachte Templates**: Keine manuellen Übersetzungs-Arrays mehr erforderlich
59+
- **Automatische Modul-Erkennung**: Proxmox-Modul nutzt jetzt die automatische Modul-Erkennung der globalen `t()`-Funktion
60+
- **Konsistente Übersetzungen**: Alle Template-Strings verwenden jetzt die globale `t()`-Funktion
61+
- **Neue Ajax-Aktionen**: get_vms, start_vm, stop_vm, restart_vm, delete_vm, update_vm
62+
63+
#### Verbesserungen
64+
- **Wartbarkeit**: Einfachere Wartung durch zentrale Übersetzungslogik
65+
- **Performance**: Reduzierte Server-Last durch Entfernung redundanter Übersetzungsabfragen
66+
- **Konsistenz**: Einheitliche Übersetzungsbehandlung in allen Modulen
67+
- **Benutzerfreundlichkeit**: Intuitive Bedienung mit klaren visuellen Hinweisen
68+
- **Sicherheit**: Status-Prüfung vor kritischen Aktionen wie dem Löschen von Servern
69+
570
## [3.2.3]
671

772
### File-Editor Modul - Verbesserungen

framework.php

Lines changed: 169 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,32 @@ public function toArray() {
123123
}
124124
}
125125

126+
class LXC {
127+
public $vmid;
128+
public $name;
129+
public $node;
130+
public $status;
131+
public $cores;
132+
public $memory;
133+
public $disk;
134+
public $uptime;
135+
public $cpu_usage;
136+
public $memory_usage;
137+
138+
public function __construct($data = []) {
139+
foreach ($data as $key => $value) {
140+
if (property_exists($this, $key)) {
141+
$this->$key = $value;
142+
}
143+
}
144+
}
145+
146+
public function toArray() {
147+
return get_object_vars($this);
148+
}
149+
}
150+
151+
126152
// VIRTUAL MAC DATA MODEL
127153
class VirtualMac {
128154
public $macAddress;
@@ -332,6 +358,21 @@ public static function mapToVM($data) {
332358
]);
333359
}
334360

361+
public static function mapToLXC($data) {
362+
return new LXC([
363+
'vmid' => $data['vmid'] ?? null,
364+
'name' => $data['name'] ?? null,
365+
'node' => $data['node'] ?? null,
366+
'status' => $data['status'] ?? null,
367+
'cores' => $data['cores'] ?? $data['cpus'] ?? null,
368+
'memory' => $data['memory'] ?? $data['maxmem'] ?? null,
369+
'disk' => $data['disk'] ?? $data['maxdisk'] ?? null,
370+
'uptime' => $data['uptime'] ?? null,
371+
'cpu_usage' => $data['cpu'] ?? null,
372+
'memory_usage' => $data['mem'] ?? null
373+
]);
374+
}
375+
335376
public static function mapToVirtualMac($data, $serviceName = null, $macAddress = null) {
336377
return new VirtualMac([
337378
'macAddress' => $macAddress ?? $data['macAddress'] ?? null,
@@ -499,6 +540,26 @@ public function getVMs($node = null) {
499540
////$this->logRequest('/nodes/*/qemu', 'GET', !empty($vms));
500541
return $vms;
501542
}
543+
public function getLXCs($node = null) {
544+
$lxcs = [];
545+
$nodes = $node ? [$node] : $this->getNodes();
546+
547+
foreach ($nodes as $nodeData) {
548+
$nodeName = is_array($nodeData) ? $nodeData['node'] : $nodeData;
549+
$url = $this->host . "/api2/json/nodes/$nodeName/lxc";
550+
$response = $this->makeRequest('GET', $url);
551+
552+
if ($response && isset($response['data'])) {
553+
foreach ($response['data'] as $lxcData) {
554+
$lxcData['node'] = $nodeName;
555+
$lxcs[] = DataMapper::mapToLXC($lxcData);
556+
}
557+
}
558+
}
559+
560+
////$this->logRequest('/nodes/*/qemu', 'GET', !empty($vms));
561+
return $lxcs;
562+
}
502563

503564
public function getVM($node, $vmid) {
504565
$url = $this->host . "/api2/json/nodes/$node/qemu/$vmid/config";
@@ -664,6 +725,13 @@ public function resumeVM($node, $vmid) {
664725
return $response;
665726
}
666727

728+
public function rebootVM($node, $vmid) {
729+
$url = $this->host . "/api2/json/nodes/$node/qemu/$vmid/status/reboot";
730+
$response = $this->makeRequest('POST', $url);
731+
//$this->logRequest("/nodes/$node/qemu/$vmid/status/reboot", 'POST', $response !== false);
732+
return $response;
733+
}
734+
667735
public function cloneVM($node, $vmid, $newVmid, $name = null) {
668736
$url = $this->host . "/api2/json/nodes/$node/qemu/$vmid/clone";
669737
$data = [
@@ -676,6 +744,63 @@ public function cloneVM($node, $vmid, $newVmid, $name = null) {
676744
return $response;
677745
}
678746

747+
//Proxmox LXC
748+
public function createLXC($node, $lxcData) {
749+
$url = $this->host . "/api2/json/nodes/$node/lxc";
750+
$response = $this->makeRequest('POST', $url, $lxcData);
751+
//$this->logRequest("/nodes/$node/lxc", 'POST', $response !== false);
752+
return $response;
753+
}
754+
public function editLXC($node, $vmid, $lxcData) {
755+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/config";
756+
$response = $this->makeRequest('PUT', $url, $lxcData);
757+
//$this->logRequest("/nodes/$node/lxc/$vmid/config", 'PUT', $response !== false);
758+
return $response;
759+
}
760+
public function deleteLXC($node, $vmid) {
761+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid";
762+
$response = $this->makeRequest('DELETE', $url);
763+
//$this->logRequest("/nodes/$node/lxc/$vmid", 'DELETE', $response !== false);
764+
return $response;
765+
}
766+
public function startLXC($node, $vmid) {
767+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/start";
768+
$response = $this->makeRequest('POST', $url);
769+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/start", 'POST', $response !== false);
770+
return $response;
771+
}
772+
public function stopLXC($node, $vmid) {
773+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/stop";
774+
$response = $this->makeRequest('POST', $url);
775+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/stop", 'POST', $response !== false);
776+
return $response;
777+
}
778+
public function resetLXC($node, $vmid) {
779+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/reset";
780+
$response = $this->makeRequest('POST', $url);
781+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/reset", 'POST', $response !== false);
782+
return $response;
783+
}
784+
public function suspendLXC($node, $vmid) {
785+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/suspend";
786+
$response = $this->makeRequest('POST', $url);
787+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/suspend", 'POST', $response !== false);
788+
return $response;
789+
}
790+
public function resumeLXC($node, $vmid) {
791+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/resume";
792+
$response = $this->makeRequest('POST', $url);
793+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/resume", 'POST', $response !== false);
794+
return $response;
795+
}
796+
797+
public function rebootLXC($node, $vmid) {
798+
$url = $this->host . "/api2/json/nodes/$node/lxc/$vmid/status/reboot";
799+
$response = $this->makeRequest('POST', $url);
800+
//$this->logRequest("/nodes/$node/lxc/$vmid/status/reboot", 'POST', $response !== false);
801+
return $response;
802+
}
803+
679804
// PROXMOX USER MANAGEMENt
680805
public function createProxmoxUser($userData) {
681806
$url = $this->host . "/api2/json/access/users";
@@ -3390,6 +3515,25 @@ public function getProxmoxVMs() {
33903515

33913516
return $this->proxmoxGet->getVMs();
33923517
}
3518+
3519+
public function getProxmoxLXCs() {
3520+
$apiCheck = $this->checkAPIEnabled('proxmox');
3521+
if ($apiCheck !== true) {
3522+
return $apiCheck;
3523+
}
3524+
3525+
// Expliziter Null-Check für zusätzliche Sicherheit
3526+
if (!$this->proxmoxGet) {
3527+
return [
3528+
'success' => false,
3529+
'error' => 'API_NOT_INITIALIZED',
3530+
'message' => 'Proxmox API nicht initialisiert',
3531+
'api' => 'proxmox'
3532+
];
3533+
}
3534+
3535+
return $this->proxmoxGet->getLXCs();
3536+
}
33933537
public function getProxmoxNodes() {
33943538
$apiCheck = $this->checkAPIEnabled('proxmox');
33953539
if ($apiCheck !== true) {
@@ -3732,41 +3876,57 @@ public function createProxmoxVM($vmData) {
37323876
return $this->proxmoxPost->createVM($vmData);
37333877
}
37343878

3735-
public function controlProxmoxVM($node, $vmid, $action) {
3879+
public function controlProxmoxVM($node, $vmid, $action, $type = 'qemu') {
37363880
$apiCheck = $this->checkAPIEnabled('proxmox');
37373881
if ($apiCheck !== true) {
37383882
return $apiCheck;
37393883
}
37403884

3885+
// Wähle die richtige Funktion basierend auf dem Typ
3886+
$functionPrefix = $type === 'lxc' ? 'LXC' : 'VM';
3887+
37413888
switch ($action) {
37423889
case 'start':
3743-
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'startVM', [$node, $vmid]);
3890+
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'start' . $functionPrefix, [$node, $vmid]);
37443891
case 'stop':
3745-
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'stopVM', [$node, $vmid]);
3892+
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'stop' . $functionPrefix, [$node, $vmid]);
3893+
case 'reboot':
3894+
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'reboot' . $functionPrefix, [$node, $vmid]);
37463895
case 'reset':
3896+
// Reset funktioniert nur für QEMU, nicht für LXC
3897+
if ($type === 'lxc') {
3898+
return [
3899+
'success' => false,
3900+
'error' => 'UNSUPPORTED_ACTION',
3901+
'message' => 'Reset wird für LXC-Container nicht unterstützt'
3902+
];
3903+
}
37473904
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'resetVM', [$node, $vmid]);
37483905
case 'suspend':
3749-
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'suspendVM', [$node, $vmid]);
3906+
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'suspend' . $functionPrefix, [$node, $vmid]);
37503907
case 'resume':
3751-
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'resumeVM', [$node, $vmid]);
3908+
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'resume' . $functionPrefix, [$node, $vmid]);
37523909
default:
37533910
return [
37543911
'success' => false,
37553912
'error' => 'INVALID_ACTION',
3756-
'message' => 'Ungültige Aktion: ' . $action,
3913+
'message' => 'Ungültige Aktion: ' . $action,
37573914
'api' => 'proxmox',
3758-
'valid_actions' => ['start', 'stop', 'reset', 'suspend', 'resume']
3915+
'valid_actions' => ['start', 'stop', 'reboot', 'reset', 'suspend', 'resume']
37593916
];
37603917
}
37613918
}
37623919

3763-
public function deleteProxmoxVM($node, $vmid) {
3920+
public function deleteProxmoxVM($node, $vmid, $type = 'qemu') {
37643921
$apiCheck = $this->checkAPIEnabled('proxmox');
37653922
if ($apiCheck !== true) {
37663923
return $apiCheck;
37673924
}
37683925

3769-
return $this->safeAPICall('proxmox', $this->proxmoxPost, 'deleteVM', [$node, $vmid]);
3926+
// Wähle die richtige Funktion basierend auf dem Typ
3927+
$functionName = $type === 'lxc' ? 'deleteLXC' : 'deleteVM';
3928+
3929+
return $this->safeAPICall('proxmox', $this->proxmoxPost, $functionName, [$node, $vmid]);
37703930
}
37713931

37723932
// ISPConfig Methods

0 commit comments

Comments
 (0)