refactor: remove DHCP management logic from Proxmox Firewall component to simplify configuration handling and improve clarity

This commit is contained in:
2025-12-02 07:21:01 -05:00
parent b100625a2b
commit bc2171511c
3 changed files with 3 additions and 18 deletions

View File

@@ -737,7 +737,6 @@ class Firewall extends Component
$segments = array_filter(array_map('trim', explode(',', $currentConfig)));
$newSegments = [];
$firewallFound = false;
$dhcpFound = false;
$currentFirewallState = $this->adapterFirewallStates[$adapterName] ?? false;
$newFirewallState = !$currentFirewallState;
@@ -755,15 +754,6 @@ class Firewall extends Component
$newSegments[] = 'firewall=1';
}
// If disabling, we skip adding firewall=1, effectively removing it
} elseif (strtolower($segmentKey) === 'dhcp') {
$dhcpFound = true;
// If enabling firewall, disable DHCP
if ($newFirewallState) {
$newSegments[] = 'dhcp=0';
} else {
// Keep existing DHCP setting when disabling firewall
$newSegments[] = $segment;
}
} else {
$newSegments[] = $segment;
}
@@ -774,11 +764,6 @@ class Firewall extends Component
$newSegments[] = 'firewall=1';
}
// If DHCP wasn't in the config and we're enabling firewall, explicitly disable DHCP
if (!$dhcpFound && $newFirewallState) {
$newSegments[] = 'dhcp=0';
}
$newConfig = implode(',', $newSegments);
$proxmox->request(

View File

@@ -46,7 +46,7 @@ class Overview extends Component
$this->loadVmStatus();
}
$this->hostname = $server->hostname ?? $this->status->name ?? '';
$this->hostname = $server->hostname ?? ($this->status->name ?? '');
// Load notes from Proxmox VM description
try {

View File

@@ -401,7 +401,7 @@
<label class="text-sm font-semibold text-base/80">Status</label>
<div class="flex items-center gap-2 px-3 py-2 text-sm text-base/80">
<div class="relative inline-flex size-5">
@if ($status->status === 'running')
@if ($status && $status->status === 'running')
<span class="absolute inset-0 rounded-full bg-success/20 animate-ping"></span>
<span class="relative flex items-center justify-center size-5 p-1 rounded-full text-success bg-success/20">
<x-ri-circle-fill />
@@ -413,7 +413,7 @@
@endif
</div>
<span class="truncate flex-1">
{{ $status->status === 'running' ? 'Running' : 'Stopped' }}
{{ $status && $status->status === 'running' ? 'Running' : 'Stopped' }}
</span>
</div>
</div>