PageSourceSearch

https://rerere.ai/_next/static/chunks/1932.f088e108d9d19e27.js

js rerere.ai collected 2026-10-05 12:31:52 UTC 8,147 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1932],{45255:(e,t,a)=>{a.d(t,{A:()=>s});var l=a(95155),n=a(12115);function s(e){let{title:t,onClose:a,children:s}=e;return(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&a()};document.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=t}},[a]),(0,l.jsxs)("div",{className:"fixed inset-0 z-50 flex justify-end",children:[(0,l.jsx)("div",{className:"absolute inset-0 bg-app/60 backdrop-blur-sm",onClick:a,"aria-hidden":!0}),(0,l.jsxs)("div",{className:"relative h-full w-full max-w-2xl overflow-y-auto border-l border-line bg-surface-100 shadow-2xl",children:[(0,l.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between border-b border-line bg-surface-100/95 px-4 py-2 backdrop-blur",children:[(0,l.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-ink-soft",children:t}),(0,l.jsx)("button",{type:"button",onClick:a,className:"shrink-0 text-xs text-ink-soft hover:text-ink","aria-label":"Close",children:"Esc ✕"})]}),(0,l.jsx)("div",{className:"p-5",children:s})]})]})}},91932:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var l=a(95155),n=a(12115),s=a(90960),r=a(41091),o=a(22408),i=a(45255);let d={admin_user:"text-brand bg-brand/10",portal:"text-good bg-good-bg",system:"text-ink-soft bg-hovertint",celery_task:"text-info bg-info-bg",erp_sync:"text-warn bg-warn-bg",api_key:"text-purple-400 bg-purple-400/10"},c={created:"text-good bg-good-bg",updated:"text-warn bg-warn-bg",deleted:"text-bad bg-bad-bg",access:"text-ink-soft bg-hovertint",api_call:"text-info bg-info-bg",login:"text-brand bg-brand/10"};function x(){let{user:e,activeInstance:t}=(0,r.z8)(),[a,x]=(0,n.useState)([]),[m,p]=(0,n.useState)(0),[v,h]=(0,n.useState)(!0),[f,g]=(0,n.useState)(1),[j]=(0,n.useState)(100),[y,k]=(0,n.useState)(""),[N,w]=(0,n.useState)(""),[_,S]=(0,n.useState)(""),[C,A]=(0,n.use
1State)(null);async function E(){h(!0);try{let e=new URLSearchParams({page:String(f),page_size:String(j)});y&&e.set("event_type",y),N&&e.set("table_name",N),_&&e.set("actor_type",_);let t=await (0,s.apiGet)("/api/v1/audit/events?".concat(e));x(t.events),p(t.total)}catch(e){console.error("Failed to load audit events",e)}finally{h(!1)}}(0,n.useEffect)(()=>{E()},[f,y,N,_]);let T=(0,n.useMemo)(()=>a.find(e=>e.id===C)||null,[a,C]),I=Math.max(1,Math.ceil(m/j)),L=[{field:"occurredAt",headerName:"When",flex:1,minWidth:165,valueGetter:e=>{var t;return(null==(t=e.data)?void 0:t.occurredAt)?new Date(e.data.occurredAt).toLocaleString():"—"}},{field:"eventType",headerName:"Event",flex:.7,minWidth:110,cellRenderer:e=>e.data?(0,l.jsx)("span",{className:"inline-block px-2 py-0.5 rounded-full text-[11px] font-medium ".concat(c[e.data.eventType]||"text-ink-soft bg-hovertint"),children:e.data.eventType}):""},{field:"tableName",headerName:"Table",flex:1,minWidth:150,cellClass:"font-mono"},{field:"actorType",headerName:"Actor",flex:1,minWidth:150,valueGetter:e=>e.data?"".concat(e.data.actorType).concat(e.data.actorLabel?" \xb7 ".concat(e.data.actorLabel):""):"",cellRenderer:e=>e.data?(0,l.jsxs)("span",{children:[(0,l.jsx)("span",{className:"inline-block px-2 py-0.5 rounded-full text-[11px] font-medium ".concat(d[e.data.actorType]||"text-ink-soft bg-hovertint"),children:e.data.actorType}),e.data.actorLabel&&(0,l.jsx)("span",{className:"ml-2 text-ink-faint text-[11px]",children:e.data.actorLabel})]}):""},{field:"recordId",headerName:"Record",flex:.7,minWidth:110,cellClass:"font-mono",valueGetter:e=>e.data?"".concat(e.data.recordId.slice(0,8),"…"):""}];return(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mb-5",children:[(0,l.jsx)("h1",{className:"font-display text-2xl font-semibold text-ink mb-1",children:"Events"}),(0,l.jsxs)("p",{className:"text-ink-faint text-sm",children:["Immutable append-only trail of every data change.",(null==e?void 0:e.is_platform_user)?" Showing all tenants.":" Showing your client's events only."]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,l.jsxs)("select",{value:y,onChange:e=>{k(e.target.value),g(1)},className:"px-3 py-2 rounded-lg text-sm bg-surface-100 border border-line text-ink",children:[(0,l.jsx)("option",{value:"",children:"All event types"}),(0,l.jsx)("option",{value:"api_call",children:"api_call"}),(0,l.jsx)("option",{value:"created",children:"created"}),(0,l.jsx)("option",{value:"updated",children:"updated"}),(0,l.jsx)("option",{value:"deleted",children:"deleted"}),(0,l.jsx)("option",{value:"access",children:"access"}),(0,l.jsx)("option",{value:"login",children:"login"})]}),(0,l.jsx)("input",{type:"text",placeholder:"Table name…",value:N,onChange:e=>{w(e.target.value),g(1)},className:"px-3 py-2 rounded-lg text-sm bg-surface-100 border border-line text-ink placeholder-ink-faint focus:outline-none focus:border-brand/40 w-48"}),(0,l.jsxs)("select",{value:_,onChange:e=>{S(e.target.value),g(1)},className:"px-3 py-2 rounded-lg text-sm bg-surface-100 border border-line text-ink",children:[(0,l.jsx)("option",{value:"",children:"All actor types"}),(0,l.jsx)("option",{value:"admin_user",children:"admin_user"}),(0,l.jsx)("option",{value:"portal",children:"portal"}),(0,l.jsx)("option",{value:"system",children:"system"}),(0,l.jsx)("option",{value:"celery_task",children:"celery_task"})]}),(0,l.jsxs)("div",{className:"ml-auto text-ink-faint text-xs",children:[m.toLocaleString()," events \xb7 page ",f," / ",I]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(o.A,{rowData:a,columnDefs:L,loading:v,height:"62vh",exportFileName:"events",isAdmin:!!(null==e?void 0:e.is_platform_user),onRowClicked:e=>A(e.id),enableGrouping:!0,enablePivot:!0,enableCharts:!0,exportSource:{source:"audit_events",params:{...t?{client_slug:t}:{},...y?{event_type:y}:{},...N?{table_name:N}:{},..._?{actor_type:_}:{}}}}),(0,l.jsxs)("div",{className:"flex items-center justify-between mt-3",children:[(0,l.jsx)("button",{onClick:()=>g(e=>Math.max(1,e-1)),disabled:f<=1,className:"px-3 py-1 rounded text-xs text-ink-soft border border-line disabled:opacity-30 hover:text-ink",children:"Previous"}),(0,l.jsxs)("span",{className:"text-ink-faint text-xs",children:["Page ",f," of ",I]}),(0,l.jsx)("button",{onClick:()=>g(e=>Math.min(I,e+1)),disabled:f>=I,className:"px-3 py-1 rounded text-xs text-ink-soft border border-line disabled:opacity-30 hover:text-ink",children:"Next"})]}),T&&(0,l.jsxs)(i.A,{title:"Event detail",onClose:()=>A(null),children:[(0,l.jsx)(u,{label:"Event",value:T.eventType}),(0,l.jsx)(u,{label:"Table",value:T.tableName,mono:!0}),(0,l.jsx)(u,{label:"Record ID",value:T.recordId,mono:!0,small:!0}),(0,l.jsx)(u,{label:"Actor type",value:T.actorType}),(0,l.jsx)(u,{label:"Actor ID",value:T.actorId||"—",mono:!0,small:!0}),(0,l.jsx)(u,{label:"Actor label",value:T.actorLabel||"—"}),(0,l.jsx)(u,{label:"Client ID",value:T.clientId||"—",mono:!0,small:!0}),(0,l.jsx)(u,{label:"Session",value:T.sessionId||"—",mono:!0,small:!0}),(0,l.jsx)(u,{label:"Occurred",value:T.occurredAt||"—",mono:!0,small:!0}),T.changedFields&&T.changedFields.length>0&&(0,l.jsx)(u,{label:"Changed",value:T.changedFields.join(", ")}),(0,l.jsx)(b,{label:"Before",value:T.beforeState}),(0,l.jsx)(b,{label:"After",value:T.afterState}),(0,l.jsx)(b,{label:"Metadata",value:T.metadata})]})]})]})}function u(e){let{label:t,value:a,mono:n,small:s}=e;return(0,l.jsxs)("div",{className:"mb-2",children:[(0,l.jsx)("div",{className:"text-[10px] text-ink-faint uppercase tracking-wider mb-0.5",children:t}),(0,l.jsx)("div",{className:"text-ink ".concat(n?"font-mono":""," ").concat(s?"text-xs break-all":"text-sm"),children:a})]})}function b(e){let{label:t,value:a}=e;return a&&0!==Object.keys(a).length?(0,l.jsxs)("div",{className:"mb-3 mt-3",children:[(0,l.jsx)("div",{className:"text-[10px] text-ink-faint uppercase tracking-wider mb-1",children:t}),(0,l.jsx)("pre",{className:"text-[10px] font-mono text-ink-soft bg-black/40 rounded-lg p-2 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap break-words",children:JSON.stringify(a,null,2)})]}):null}}}]);

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.