From b95c59be8145ac20222bdb9a8f49197e958032c8 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Sat, 6 Dec 2025 08:07:52 -0500 Subject: [PATCH] feat: reimplement server icon customization feature - Add user_set_icon and user_set_icon_color to Server model fillable - Add icon modal properties and methods to Overview component - Add clickable icon button next to server hostname in layout - Add icon picker modal with search, color selection, and preview - Support for 100+ Remix icons across various categories - Icons persist to database and display on page load --- .../Servers/Proxmox/Livewire/Overview.php | 46 +- extensions/Servers/Proxmox/Models/Server.php | 2 + .../Proxmox/views/components/layout.blade.php | 422 +++++++++++++++++- 3 files changed, 466 insertions(+), 4 deletions(-) diff --git a/extensions/Servers/Proxmox/Livewire/Overview.php b/extensions/Servers/Proxmox/Livewire/Overview.php index 0ee3cc31d..78397b16b 100644 --- a/extensions/Servers/Proxmox/Livewire/Overview.php +++ b/extensions/Servers/Proxmox/Livewire/Overview.php @@ -22,8 +22,10 @@ class Overview extends Component public $isEditingPassword = false; public $passwordError = ''; - // Legacy property - kept to prevent errors for users with stale Livewire state + // Server icon customization public bool $showIconModal = false; + public string $selectedIcon = ''; + public string $selectedIconColor = ''; public string $cpuTimeRange = 'hour'; public string $cpuAggregation = 'average'; @@ -51,6 +53,10 @@ class Overview extends Component $this->hostname = $server->hostname ?? ($this->status->name ?? ''); + // Load icon customization + $this->selectedIcon = $server->user_set_icon ?? ''; + $this->selectedIconColor = $server->user_set_icon_color ?? ''; + // Load notes from Proxmox VM description try { $proxmox = new Proxmox; @@ -61,6 +67,44 @@ class Overview extends Component } } + public function openIconModal(): void + { + $this->showIconModal = true; + } + + public function closeIconModal(): void + { + $this->showIconModal = false; + } + + public function saveIcon(string $icon, string $color): void + { + $this->server->update([ + 'user_set_icon' => $icon ?: null, + 'user_set_icon_color' => $color ?: null, + ]); + + $this->selectedIcon = $icon; + $this->selectedIconColor = $color; + $this->showIconModal = false; + + $this->notify('Server icon updated successfully', 'success'); + } + + public function resetIcon(): void + { + $this->server->update([ + 'user_set_icon' => null, + 'user_set_icon_color' => null, + ]); + + $this->selectedIcon = ''; + $this->selectedIconColor = ''; + $this->showIconModal = false; + + $this->notify('Server icon reset to default', 'success'); + } + public function checkStatus() { $currentStatus = $this->status->status; diff --git a/extensions/Servers/Proxmox/Models/Server.php b/extensions/Servers/Proxmox/Models/Server.php index 9dc1b3c62..508534ae6 100644 --- a/extensions/Servers/Proxmox/Models/Server.php +++ b/extensions/Servers/Proxmox/Models/Server.php @@ -20,6 +20,8 @@ class Server extends Model 'status', 'hostname', 'password', + 'user_set_icon', + 'user_set_icon_color', ]; public function node() diff --git a/extensions/Servers/Proxmox/views/components/layout.blade.php b/extensions/Servers/Proxmox/views/components/layout.blade.php index 74edf9834..3b0b5d56d 100644 --- a/extensions/Servers/Proxmox/views/components/layout.blade.php +++ b/extensions/Servers/Proxmox/views/components/layout.blade.php @@ -38,9 +38,149 @@ @endphp
- - {{ $server->hostname }} - +
+ + + + {{ $server->hostname }} + +
+ + @if($view === 'overview') +
+ +
+
+ + +
+ @endif + @else @php $statuses = [