feat: Update Proxmox extension with various improvements and bug fixes
- Change listStates method to accept nullable integer for limit parameter. - Modify TechnitiumDns class to return structured error messages on failure. - Enhance VNC and xterm popup routes with user authorization checks. - Update backups view to improve loading states and add unique keys for dynamic elements. - Refactor cloud-init view to ensure proper data binding and improve user experience. - Add wire:key attributes to various elements in views for better Livewire performance. - Improve error handling and user feedback in the firewall view. - Update server overview and statistics views to handle potential null values gracefully. - Add new migration files to extend database schema with user-set icons and notes for Proxmox nodes.
This commit is contained in:
@@ -91,6 +91,10 @@ class BootOrder extends Component
|
||||
|
||||
public function saveOrder()
|
||||
{
|
||||
// Validate boot order entries against available devices
|
||||
$validDevices = array_keys($this->availableDevices);
|
||||
$this->order = array_values(array_filter($this->order, fn ($device) => in_array($device, $validDevices, true)));
|
||||
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
|
||||
@@ -134,8 +138,16 @@ class BootOrder extends Component
|
||||
$slot = null;
|
||||
$lastError = null;
|
||||
|
||||
// Try IDE slots first (ide0-ide4, up to 5 attempts)
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
// Fetch current VM config to check slot occupancy (rawConfig is protected and not persisted between requests)
|
||||
try {
|
||||
$currentConfig = $proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config')->json()['data'] ?? [];
|
||||
} catch (\Exception $e) {
|
||||
$this->notify('Failed to fetch VM configuration: ' . $e->getMessage(), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Try IDE slots first (ide0-ide3, up to 4 valid IDE slots)
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$ideSlot = 'ide' . $i;
|
||||
|
||||
// Skip if this slot already exists as a CD-ROM drive
|
||||
@@ -144,9 +156,9 @@ class BootOrder extends Component
|
||||
}
|
||||
|
||||
// Skip if slot exists and is already configured (not empty)
|
||||
if (isset($this->rawConfig[$ideSlot]) && $this->rawConfig[$ideSlot] !== '') {
|
||||
if (isset($currentConfig[$ideSlot]) && $currentConfig[$ideSlot] !== '') {
|
||||
// Check if it's a CD-ROM drive
|
||||
if (is_string($this->rawConfig[$ideSlot]) && str_contains($this->rawConfig[$ideSlot], 'media=cdrom')) {
|
||||
if (is_string($currentConfig[$ideSlot]) && str_contains($currentConfig[$ideSlot], 'media=cdrom')) {
|
||||
// Already a CD-ROM, skip
|
||||
continue;
|
||||
}
|
||||
@@ -184,8 +196,8 @@ class BootOrder extends Component
|
||||
}
|
||||
|
||||
// Skip if slot exists and is already configured
|
||||
if (isset($this->rawConfig[$sataSlot]) && $this->rawConfig[$sataSlot] !== '') {
|
||||
if (is_string($this->rawConfig[$sataSlot]) && str_contains($this->rawConfig[$sataSlot], 'media=cdrom')) {
|
||||
if (isset($currentConfig[$sataSlot]) && $currentConfig[$sataSlot] !== '') {
|
||||
if (is_string($currentConfig[$sataSlot]) && str_contains($currentConfig[$sataSlot], 'media=cdrom')) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
@@ -315,9 +327,9 @@ class BootOrder extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if ($drive) {
|
||||
$this->selectedIsos[$drive] = 'none';
|
||||
} else {
|
||||
// Always update selectedIsos for the target drive
|
||||
$this->selectedIsos[$targetDrive] = 'none';
|
||||
if (!$drive) {
|
||||
$this->selectedIso = 'none';
|
||||
}
|
||||
|
||||
@@ -333,7 +345,7 @@ class BootOrder extends Component
|
||||
{
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
$config = $proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config')->json()['data'];
|
||||
$config = $proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config')->json()['data'] ?? [];
|
||||
|
||||
$this->rawConfig = $config;
|
||||
$this->availableDevices = $this->extractBootableDevices($config);
|
||||
|
||||
Reference in New Issue
Block a user