PageSourceSearch

https://alperrefrigerants.com/assets/AuditLogManager-CjUIRz5N.js

js alperrefrigerants.com collected 2026-10-09 22:37:41 UTC 2,644 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-E7cH9GT0.js";import{r as d}from"./vendor-Cpi2Ks0G.js";import{V as u,C as h,d as j,e as p,a1 as f,f as g,aB as w,Q as y,aP as N,aQ as _,aR as c,aS as r,aT as v,aU as t,B as b,X as C}from"./index-BeEEDwOo.js";import{S}from"./scroll-text-DGb2p4pW.js";import{L as T}from"./loader-circle-D3Z90CiJ.js";import"./router-CKghwl56.js";const E=()=>{const[i,o]=d.useState(""),{data:n=[],isLoading:m}=u({queryKey:["admin-audit-log"],queryFn:async()=>{const{data:a,error:s}=await C.from("admin_audit_log").select("id, admin_email, action, resource_type, resource_label, new_value, created_at").order("created_at",{ascending:!1}).limit(200);if(s)throw s;return a||[]}}),l=d.useMemo(()=>{const a=i.trim().toLowerCase();return a?n.filter(s=>[s.admin_email,s.action,s.resource_type,s.resource_label].filter(Boolean).some(x=>String(x).toLowerCase().includes(a))):n},[n,i]);return e.jsx("div",{className:"space-y-6",children:e.jsxs(h,{children:[e.jsxs(j,{children:[e.jsxs(p,{className:"flex items-center gap-2",children:[e.jsx(S,{className:"h-5 w-5"})," Audit log"]}),e.jsx(f,{children:"Read-only record of admin actions. Entries are written server-side and cannot be edited or deleted from the app."})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(w,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(y,{className:"pl-8",placeholder:"Search admin, action or resource",value:i,onChange:a=>o(a.target.value)})]}),m?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(T,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):l.length===0?e.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:"No admin activity recorded yet."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(N,{children:[e.jsx(_,{children:e.jsxs(c,{children:[e.jsx(r,{children:"When"}),e.jsx(r,{children:"Admin"}),e.jsx(r,{children:"Action"}),e.jsx(r,{children:"Resource"}),e.jsx(r,{children:"Details"})]})}),e.jsx(v,{children:l.map(a=>e.jsxs(c,{children:[e.jsx(t,{className:"whitespace-nowrap text-sm",children:new Date(a.created_at).toLocaleString()}),e.jsx(t,{className:"text-sm",children:a.admin_email||"—"}),e.jsx(t,{children:e.jsx(b,{variant:"secondary",children:a.action})}),e.jsxs(t,{className:"text-sm",children:[e.jsx("div",{children:a.resource_label||"—"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.resource_type})]}),e.jsx(t,{className:"max-w-[320px] truncate text-xs text-muted-foreground",children:a.new_value?JSON.stringify(a.new_value):"—"})]},a.id))})]})})]})]})})};export{E 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.