feat: implement dynamic sidebar navigation and section scrolling in Proxmox firewall view for enhanced user interaction and organization

This commit is contained in:
2025-12-04 10:24:57 -05:00
parent 9b5cd08c55
commit b0f3bceb37
2 changed files with 132 additions and 9 deletions

View File

@@ -443,9 +443,9 @@
left: 50%;
transform: translateX(-50%);
min-width: 180px;
background: color-mix(in srgb, var(--color-background-secondary) 95%, transparent);
backdrop-filter: blur(16px);
border: 1px solid color-mix(in srgb, var(--color-neutral) 35%, transparent);
background: color-mix(in srgb, var(--color-background-secondary) 60%, transparent);
backdrop-filter: blur(12px);
border: 1px solid color-mix(in srgb, var(--color-neutral) 30%, transparent);
border-radius: 12px;
box-shadow:
0 4px 16px rgba(0, 0, 0, 0.12),
@@ -455,8 +455,8 @@
}
.dark .dropdown-menu {
background: color-mix(in srgb, var(--color-background-secondary) 95%, transparent);
border-color: color-mix(in srgb, var(--color-neutral) 45%, transparent);
background: color-mix(in srgb, var(--color-background-secondary) 80%, transparent);
border-color: color-mix(in srgb, var(--color-neutral) 40%, transparent);
box-shadow:
0 4px 20px rgba(0, 0, 0, 0.4),
0 0 0 1px rgba(255, 255, 255, 0.08);

View File

@@ -371,9 +371,132 @@
}
</style>
<div class="space-y-6">
<!-- Error Message - Centered Modal -->
@if($error && $showErrorModal)
<div x-data="{
activeSection: 'status',
scrollToSection(sectionId) {
this.activeSection = sectionId;
const element = document.getElementById(sectionId);
if (element) {
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
},
init() {
// Set up intersection observer to update active section on scroll
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting && entry.intersectionRatio > 0.2) {
this.activeSection = entry.target.id;
}
});
}, { threshold: 0.2, rootMargin: '-10% 0px -70% 0px' });
// Observe all sections
document.querySelectorAll('.firewall-section-card').forEach(section => {
observer.observe(section);
});
}
}" class="lg:grid lg:grid-cols-5 gap-6">
<!-- Sidebar Navigation -->
<div class="lg:col-span-1 mb-6 lg:mb-0">
<div class="firewall-sidebar bg-background-secondary border border-neutral rounded-lg p-4">
<div class="flex items-center gap-2 mb-4 pb-3 border-b border-neutral/30">
<x-ri-shield-line class="size-5 text-primary" />
<h3 class="text-base font-semibold">Firewall</h3>
</div>
<nav class="space-y-1">
<!-- Status Section -->
<button
@click="scrollToSection('status')"
:class="activeSection === 'status' ? 'active' : ''"
class="firewall-nav-item">
<x-ri-toggle-line class="firewall-nav-icon" />
<span>Status</span>
@if($firewallEnabled)
<span class="firewall-nav-badge firewall-nav-badge-success">ON</span>
@else
<span class="firewall-nav-badge firewall-nav-badge-neutral">OFF</span>
@endif
</button>
<!-- Network Adapters Section -->
<button
@click="scrollToSection('adapters')"
:class="activeSection === 'adapters' ? 'active' : ''"
class="firewall-nav-item">
<x-ri-wifi-line class="firewall-nav-icon" />
<span>Adapters</span>
<span class="firewall-nav-badge firewall-nav-badge-neutral">{{ count($networkAdapters) }}</span>
</button>
@if($firewallEnabled)
<!-- Firewall Rules Section -->
<button
@click="scrollToSection('rules')"
:class="activeSection === 'rules' ? 'active' : ''"
class="firewall-nav-item">
<x-ri-list-check class="firewall-nav-icon" />
<span>Rules</span>
<span class="firewall-nav-badge firewall-nav-badge-neutral">{{ count($rules) }}</span>
</button>
<!-- Firewall Logs Section -->
<button
@click="scrollToSection('logs')"
:class="activeSection === 'logs' ? 'active' : ''"
class="firewall-nav-item">
<x-ri-file-list-3-line class="firewall-nav-icon" />
<span>Logs</span>
@if(count($firewallLogs) > 0)
<span class="firewall-nav-badge firewall-nav-badge-warning">{{ count($firewallLogs) }}</span>
@else
<span class="firewall-nav-badge firewall-nav-badge-neutral">0</span>
@endif
</button>
@endif
</nav>
<!-- Quick Actions -->
<div class="mt-4 pt-4 border-t border-neutral/30">
<p class="text-xs font-semibold text-base/50 uppercase tracking-wide mb-2">Quick Actions</p>
<div class="space-y-1">
<button
wire:click="toggleFirewall"
wire:loading.attr="disabled"
class="firewall-nav-item text-sm {{ $firewallEnabled ? 'text-error/80 hover:text-error' : 'text-success/80 hover:text-success' }}">
@if($firewallEnabled)
<x-ri-shield-cross-line class="firewall-nav-icon" />
<span>Disable Firewall</span>
@else
<x-ri-shield-check-line class="firewall-nav-icon" />
<span>Enable Firewall</span>
@endif
</button>
@if($firewallEnabled)
<button
wire:click="startCreateRule"
class="firewall-nav-item text-sm text-primary/80 hover:text-primary">
<x-ri-add-line class="firewall-nav-icon" />
<span>Add Rule</span>
</button>
<button
wire:click="loadFirewallLogs"
wire:loading.attr="disabled"
class="firewall-nav-item text-sm">
<x-ri-refresh-line class="firewall-nav-icon" />
<span>Refresh Logs</span>
</button>
@endif
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="lg:col-span-4 space-y-6">
<!-- Error Message - Centered Modal -->
@if($error && $showErrorModal)
<div class="fixed inset-0 flex items-center justify-center z-50 bg-black/50 backdrop-blur-sm"
wire:click="$set('error', ''); $set('showErrorModal', false)">
<div class="bg-error/20 border-2 border-error rounded-lg p-6 shadow-lg max-w-3xl w-full mx-4 max-h-[80vh] overflow-y-auto" wire:click.stop>
@@ -396,7 +519,7 @@
@endif
<!-- Firewall Status Card -->
<div class="bg-background border border-neutral rounded-lg p-6">
<div id="status" class="firewall-section-card bg-background border border-neutral rounded-lg p-6">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-3">
<div class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">