feat: add reorder functionality for firewall rules, enhancing user control over rule order

This commit is contained in:
2025-12-04 20:38:40 -05:00
parent 83823e2103
commit 651dd0c563

View File

@@ -340,6 +340,7 @@
<table class="w-full">
<thead>
<tr class="border-b border-neutral/20">
<th class="text-left py-3 px-4 text-xs font-semibold text-base/70 uppercase">Order</th>
<th class="text-left py-3 px-4 text-xs font-semibold text-base/70 uppercase">Pos</th>
<th class="text-left py-3 px-4 text-xs font-semibold text-base/70 uppercase">Action</th>
<th class="text-left py-3 px-4 text-xs font-semibold text-base/70 uppercase">Direction</th>
@@ -354,6 +355,32 @@
<tbody>
@foreach($rules as $index => $rule)
<tr class="border-b border-neutral/10 hover:bg-background-secondary/30 transition-colors">
<td class="py-3 px-4 text-sm">
<div class="flex flex-col gap-1">
@if($index > 0)
<button type="button"
wire:click="reorderRules({{ $rule['pos'] }}, {{ $rules[$index - 1]['pos'] }})"
wire:key="move-up-{{ $index }}"
class="text-base/50 hover:text-primary transition-colors p-0.5 hover:bg-primary/10 rounded"
title="Move up">
<x-ri-arrow-up-s-line class="size-4" />
</button>
@else
<div class="size-4 p-0.5"></div>
@endif
@if($index < count($rules) - 1)
<button type="button"
wire:click="reorderRules({{ $rule['pos'] }}, {{ $rules[$index + 1]['pos'] }})"
wire:key="move-down-{{ $index }}"
class="text-base/50 hover:text-primary transition-colors p-0.5 hover:bg-primary/10 rounded"
title="Move down">
<x-ri-arrow-down-s-line class="size-4" />
</button>
@else
<div class="size-4 p-0.5"></div>
@endif
</div>
</td>
<td class="py-3 px-4 text-sm font-mono">{{ $rule['pos'] ?? '-' }}</td>
<td class="py-3 px-4 text-sm">
@php