From 3508a032db892bb8ba65d2ea5b374c8d8cf398cf Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Sat, 6 Dec 2025 07:38:19 -0500 Subject: [PATCH] perf: make delete statistics modal open instantly - Remove @entangle which caused server round-trip on modal open - Pass statistic data inline via Alpine event dispatch instead of fetching from DB - Add direct deleteStatistic(id) method for simpler deletion - Modal now opens immediately without any server communication --- .../Servers/Proxmox/Livewire/Statistics.php | 28 +++++++ .../Proxmox/views/statistics.blade.php | 83 +++++++++---------- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/extensions/Servers/Proxmox/Livewire/Statistics.php b/extensions/Servers/Proxmox/Livewire/Statistics.php index 709ad2142..0dc417f23 100644 --- a/extensions/Servers/Proxmox/Livewire/Statistics.php +++ b/extensions/Servers/Proxmox/Livewire/Statistics.php @@ -766,6 +766,34 @@ class Statistics extends Component ->paginate(50); } + public function deleteStatistic($statisticId) + { + if (!$statisticId) { + return; + } + + try { + $statistic = ServerStatistics::where('id', $statisticId) + ->where('server_id', $this->server->id) + ->first(); + + if (!$statistic) { + $this->notify('Statistics entry not found', 'error'); + return; + } + + // Clear selection if this is the selected statistic + if ($this->selectedStatisticId == $statisticId) { + $this->selectedStatisticId = null; + } + + $statistic->delete(); + $this->notify('Statistics entry deleted successfully', 'success'); + } catch (\Throwable $e) { + $this->notify('Error deleting statistics: ' . $e->getMessage(), 'error'); + } + } + public function confirmDeleteStatistic() { if (!$this->statisticToDeleteId) { diff --git a/extensions/Servers/Proxmox/views/statistics.blade.php b/extensions/Servers/Proxmox/views/statistics.blade.php index 8bc38ce82..84ee41137 100644 --- a/extensions/Servers/Proxmox/views/statistics.blade.php +++ b/extensions/Servers/Proxmox/views/statistics.blade.php @@ -866,7 +866,8 @@