1import{r as s,m as p,j as e,C as h,a as j,b as f,d as g,I as F,B as c,e as y,n as S}from"./index-BB5fkboq.js";import{A as w}from"./AdminLayout-BRk7rQsT.js";import{n as L}from"./nubiapush-admin-Bd4yEtKv.js";import{F as E}from"./file-clock-rmdHP2Kp.js";import"./bot-B6ZOeAF6.js";import"./layout-template-8IPIJXqR.js";import"./sparkles-CaHslxI5.js";import"./image-CTMT-bUo.js";import"./megaphone-BxQIFo8M.js";import"./link-2-BZqK56i4.js";import"./trash-2-CdnLprVv.js";function q(){const[i,N]=s.useState([]),[r,v]=s.useState(null),[a,d]=s.useState(""),[C,n]=s.useState(!0),[m,x]=s.useState(!1),l=async(t,k)=>{const o=await L.listAudit(t,k??void 0);N(A=>t?[...A,...o.items]:o.items),v(o.nextCursor)};s.useEffect(()=>{l(null).catch(t=>p.error(t.message||"Failed to load audit log")).finally(()=>n(!1))},[]);const u=async()=>{n(!0);try{await l(null,a.trim()||null)}catch(t){p.error(t instanceof Error?t.message:"Failed")}finally{n(!1)}},b=async()=>{if(r){x(!0);try{await l(r,a.trim()||null)}finally{x(!1)}}};return e.jsx(w,{title:"Audit log",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(E,{className:"h-6 w-6"}),"Audit log"]}),e.jsx("p",{className:"text-muted-foreground",children:"Every admin write action â compose, settings, automations, webhooks."})]}),e.jsxs(h,{children:[e.jsx(j,{children:e.jsx(f,{children:"Filter"})}),e.jsx(g,{children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{value:a,onChange:t=>d(t.target.value),placeholder:"Filter by action (e.g. webhook.create)"}),e.jsx(c,{onClick:u,children:"Apply"}),a&&e.jsx(c,{variant:"outline",onClick:()=>{d(""),u()},children:"Clear"})]})})]}),e.jsxs(h,{children:[e.jsx(j,{children:e.jsxs(f,{children:[i.length," entries"]})}),e.jsx(g,{children:C?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(y,{className:"h-5 w-5 animate-spin"})}):i.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No entries."}):e.jsxs("div",{className:"space-y-2",children:[i.map(t=>e.jsxs("div",{className:"border rounded-md px-3 py-2 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(S,{variant:"secondary",children:t.action}),t.target_type&&e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[t.target_type,":",t.target_id]})]}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(t.created_at).toLocaleString()})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[t.actor_email||"unknown actor"," · ",t.ip||"no-ip"]}),Object.keys(t.payload).length>0&&e.jsx("pre",{className:"mt-2 text-xs bg-muted p-2 rounded overflow-x-auto",children:JSON.stringify(t.payload,null,2)})]},t.id)),r&&e.jsx(c,{variant:"outline",className:"w-full",onClick:b,disabled:m,children:m?e.jsx(y,{className:"h-4 w-4 animate-spin"}):"Load more"})]})})]})]})})}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.