1import{r as f,j as a,b as g}from"./index-BPFw6Db2.js";import{F as w,a as j,A as y}from"./FilterBadge-B5ZF2x-Z.js";import{D as N}from"./DataTable-CoXoLeQB.js";import{P}from"./PageHeader-OYiuNClG.js";import{S as v}from"./SearchField-D5QlXDiv.js";import{u as F}from"./useAdminFirewallRules-C1vilvRr.js";import{u as k}from"./usePaginatedListState-DAOdY1bN.js";import{a as A,ax as o,C,aw as L,L as S}from"./main-DlSV9Dem.js";import"./TagIcon-CkEBG2v5.js";import"./Pagination-BAgzW9Xj.js";const c=10,b={page:1,search:""};function q(){const l=A(),{params:s,setPage:m,setSearch:d}=k({defaults:b}),{rules:r,totalCount:i,isLoading:x,error:n}=F({page:s.page,perPage:c}),u=f.useMemo(()=>{if(!s.search)return r;const e=s.search.toLowerCase();return r.filter(t=>t.action.toLowerCase().includes(e)||t.source_ip.toLowerCase().includes(e)||t.username.toLowerCase().includes(e)||String(t.priority).includes(e))},[r,s.search]),p=Math.ceil(i/c),h=[{key:"priority",header:"Priority",render:e=>a.jsx(L,{color:"primary",children:e.priority})},{key:"action",header:"Action",render:e=>a.jsx("div",{className:"flex items-center gap-1.5",children:e.action==="allow"?a.jsxs(a.Fragment,{children:[a.jsx(g,{className:"w-4 h-4 text-accent-green"}),a.jsx("span",{className:"text-xs font-medium text-accent-green",children:"Allow"})]}):a.jsxs(a.Fragment,{children:[a.jsx(w,{className:"w-4 h-4 text-accent-red"}),a.jsx("span",{className:"text-xs font-medium text-accent-red",children:"Deny"})]})})},{key:"source_ip",header:"Source IP",render:e=>e.source_ip===".*"?a.jsx("span",{className:"text-xs text-text-secondary",children:"Any IP"}):a.jsx("span",{className:"text-xs font-mono text-text-primary",children:e.source_ip})},{key:"username",header:"Username",render:e=>e.username===".*"?a.jsx("span",{className:"text-xs text-text-secondary",children:"All users"}):a.jsx("span",{className:"text-xs font-mono text-text-primary",children:e.username})},{key:"filter",header:"Device Filter",render:e=>a.jsx(j,{filter:e.filter})},{key:"status",header:"Status",render:e=>a.jsx(y,{active:e.active})},{key:"namespace",header:"Namespace",render:e=>a.jsx(S,{to:`/admin/namespaces/${e.tenant_id}`,onClick:t=>t.stopPropagation(),className:"text-xs text-primary hover:underline font-mono truncate block max-w-[180px]",title:e.tenant_id,children:e.tenant_id})}];return a.jsxs("div",{children:[a.jsx(P,{icon:a.jsx(o,{className:"w-6 h-6"}),overline:"Firewall Administration",title:"Firewall Rules",description:"View all firewall rules configured across the instance"}),a.jsx(v,{className:"mb-5",value:s.search,onChange:d,placeholder:"Search by action, priority, IP, or username...","aria-label":"Search firewall rules by action, priority, IP, or username"}),n&&a.jsx(C,{variant:"error",className:"mb-4",children:n.message}),a.jsx(N,{columns:h,data:s.search?u:r,rowKey:e=>e.id,isLoading:x,loadingMessage:"Loading firewall rules...",onRowClick:e=>{l(`/admin/firewall-rules/${e.id}`)},...!s.search&&{page:s.page,totalPages:p,totalCount:i,itemLabel:"rule",onPageChange:m},emptyState:a.jsxs("div",{className:"text-center",children:[a.jsx(o,{className:"w-10 h-10 text-text-muted/30 mx-auto mb-3",strokeWidth:1}),a.jsx("p",{className:"text-xs font-mono text-text-muted",children:s.search?`No rules matching "${s.search}"`:"No firewall rules found"})]})})]})}export{q as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.