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 @@