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:
@@ -14,7 +14,7 @@ class Index extends Component
|
||||
|
||||
public $showRestore = false;
|
||||
|
||||
public $confirmRestore = true;
|
||||
public $confirmRestore = false;
|
||||
|
||||
public bool $showDelete = false;
|
||||
|
||||
@@ -75,6 +75,12 @@ class Index extends Component
|
||||
}
|
||||
|
||||
$proxmox = new Proxmox;
|
||||
|
||||
// Stop the VM before restoring — Proxmox requires it
|
||||
$proxmox->requestAndWait('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/status/stop', 'post', [
|
||||
'vmid' => $this->server->vm_id,
|
||||
], $this->server->node->name);
|
||||
|
||||
$proxmox->request('/nodes/' . $this->server->node->name . '/qemu', 'post', data: [
|
||||
'vmid' => $this->server->vm_id,
|
||||
'force' => true,
|
||||
@@ -121,20 +127,19 @@ class Index extends Component
|
||||
}
|
||||
|
||||
$proxmox = new Proxmox;
|
||||
$proxmox->requestAndWait('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/status/stop', 'post', [
|
||||
'vmid' => $this->server->vm_id,
|
||||
], $this->server->node->name);
|
||||
|
||||
$response = $proxmox->request('/nodes/' . $this->server->node->name . '/storage/' . $this->server->node->backup_location . '/content/' . $volid, 'delete');
|
||||
try {
|
||||
$response = $proxmox->request('/nodes/' . $this->server->node->name . '/storage/' . $this->server->node->backup_location . '/content/' . $volid, 'delete');
|
||||
|
||||
if ($response->status() == 200) {
|
||||
$this->notify('Backup deleted successfully', 'success');
|
||||
$this->backups = array_filter($this->backups, fn ($backup) => $backup['volid'] !== $volid);
|
||||
$this->backups = array_values(array_filter($this->backups, fn ($backup) => $backup['volid'] !== $volid));
|
||||
$this->showDelete = false;
|
||||
$this->confirmDelete = false;
|
||||
$this->volid = null;
|
||||
} else {
|
||||
$this->notify('Failed to delete backup: ' . $response->json()['errors'][0]['message'], 'error');
|
||||
} catch (\Illuminate\Http\Client\RequestException $e) {
|
||||
$errors = $e->response?->json()['errors'] ?? null;
|
||||
$message = is_array($errors) ? implode(', ', array_values($errors)) : 'Unknown error';
|
||||
$this->notify('Failed to delete backup: ' . $message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user