Refactor Proxmox components: optimize data fetching in Server and Overview; enhance macro handling in Firewall; improve task data refresh logic in Statistics and views
This commit is contained in:
@@ -69,8 +69,8 @@ class Firewall extends Component
|
||||
public bool $showApplyToAllModal = false;
|
||||
public array $applyToAllResults = [];
|
||||
|
||||
// Available Proxmox Macros
|
||||
public array $availableMacros = [
|
||||
// Available Proxmox Macros (constant to avoid serialization in every Livewire request)
|
||||
protected const AVAILABLE_MACROS = [
|
||||
'' => 'None',
|
||||
'Amanda' => 'Amanda Backup',
|
||||
'Auth' => 'Auth (identd)',
|
||||
@@ -148,7 +148,7 @@ class Firewall extends Component
|
||||
];
|
||||
|
||||
// Macro Definitions with ports and protocols (as per Proxmox)
|
||||
protected array $macroDefinitions = [
|
||||
protected const MACRO_DEFINITIONS = [
|
||||
'Amanda' => ['proto' => 'tcp', 'dport' => '10080,10081,10082,10083'],
|
||||
'Auth' => ['proto' => 'tcp', 'dport' => '113'],
|
||||
'BGP' => ['proto' => 'tcp', 'dport' => '179'],
|
||||
@@ -598,12 +598,20 @@ class Firewall extends Component
|
||||
|
||||
// ==================== RULES ====================
|
||||
|
||||
/**
|
||||
* Get available macros for frontend use (avoids serializing large static data on every request)
|
||||
*/
|
||||
public function getAvailableMacrosProperty(): array
|
||||
{
|
||||
return self::AVAILABLE_MACROS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get macro definitions for frontend use
|
||||
*/
|
||||
public function getMacroDefinitionsProperty(): array
|
||||
{
|
||||
return $this->macroDefinitions;
|
||||
return self::MACRO_DEFINITIONS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,7 +619,7 @@ class Firewall extends Component
|
||||
*/
|
||||
public function getMacroDetails(string $macro): ?array
|
||||
{
|
||||
return $this->macroDefinitions[$macro] ?? null;
|
||||
return self::MACRO_DEFINITIONS[$macro] ?? null;
|
||||
}
|
||||
|
||||
protected function loadFirewallRules(): void
|
||||
|
||||
Reference in New Issue
Block a user