PageSourceSearch

https://tuforums.com/assets/AuditLogPage.DF2_k1Uz.js

js tuforums.com collected 2026-10-02 00:58:24 UTC 10,361 bytes, 1 lines download raw bytes

1import{bn as $,j as e,b as B,o as V,a as Y,r as Z,w as z,M as W}from"./index.C_jEAofg.js";import{r as i,d as X}from"./reactRouter.C6cvQAHO.js";import{S as ee,a as te}from"./SortDescIcon.CZKLl-Qm.js";/* empty css             */import"./PackItem.D5eL2g8B.js";import"./packcard.CmgWfOZs.js";/* empty css                        *//* empty css                    */import"./i18n.BxWiIRpk.js";/* empty css                 */import"./VirtualList.CE9jB2m0.js";import{C as q}from"./Select.BO5et_f4.js";import"./recharts.DzmhKP_O.js";import"./dnd.esm.Cdkn9E5v.js";import"./raf-schd.esm.Do3U_zjQ.js";import"./DownloadIcon.DjUIGIn8.js";import"./InfoIcon.D6E0BSOK.js";import"./DragHandleIcon.DD8FtFny.js";import"./FolderIcon.C9FyMAKL.js";import"./SongSelectorPopup.DKzLh1D3.js";import"./WebAdofaiViewerButton.B_YDorpM.js";import"./CreatorStatusBadge.BebQkP3q.js";import"./verificationStates.C-65KJT3.js";import"./MarkdownText.L8wnX1BN.js";import"./ExternalLink.Dqxd3OTW.js";import"./EditLevelPopup.DRNO7Nwl.js";import"./RefreshIcon.C6h3Vb3d.js";import"./GraphIcon.CYoVe_gk.js";import"./ChartIcon.D6Na6YlP.js";import"./RatingInput.DaDmVNeA.js";import"./LevelUploadManagementPopup.D_Jm9B8a.js";import"./toastMessage.BnceMJYi.js";import"./levelselectionpopup.XTKS7ydm.js";import"./LevelSelectionPopup.BM_HqWse.js";import"./levelHelpers.CkOxyFNP.js";import"./passJudgementHitCount.Ccm5-J09.js";import"./communityTags.D2n_4RPi.js";import"./ItemPickManager.ByW3m6Qa.js";import"./TrashIcon.BeVW0keM.js";import"./useUnsavedClose.DBVfPN3-.js";/* empty css                    *//* empty css                            */import"./useVideoLinkResolver.CRdJO4N2.js";import"./resolveVideoUrl.CQLZGZ0c.js";/* empty css                          */import"./AdminLevelXaccCurvePopup.CEc05nAv.js";import"./XaccPassPickerJudgementStrip.RmYhi90o.js";import"./statFormatters.D_f0oQsy.js";import"./AdminReasonPrompt.DCSPFRYl.js";/* empty css                          */import"./SearchHelpPopup.BSQYCqH7.js";import"./EditIcon.C3zEPxhx.js";import"./PackIcon.BLDIeBiY.js";import"./TimeIcon.C24S6xSS.js";import"./LikeButton.JOd7Q3w3.js";import"./LikeIcon.DMlP2VPj.js";import"./curationTypeUtils.UzM-6L0y.js";import"./PlusIcon.CBMb1dFY.js";import"./SearchIcon.qDkSL_MV.js";import"./ImageIcon.CKUsHZmQ.js";import"./uploadErrors.BuoBavFt.js";import"./ImageSelectorPopup.sFab1OF6.js";import"./packRefUtils.Ch95Re_b.js";/* empty css                            */import"./TagConfidenceBar.kbpMl9x7.js";import"./MarqueeText.C_DzVbgp.js";import"./EyeIcon.B3GYw7db.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};a.SENTRY_RELEASE={id:"aec9389561908f1f1b5366362ca3b629220ab900"},a._sentryModuleMetadata=a._sentryModuleMetadata||{},a._sentryModuleMetadata[new a.Error().stack]=function(l){for(var c=1;c<arguments.length;c++){var u=arguments[c];if(u!=null)for(var m in u)u.hasOwnProperty(m)&&(l[m]=u[m])}return l}({},a._sentryModuleMetadata[new a.Error().stack],{"_sentryBundlerPluginAppKey:tuf-website":!0});var s=new a.Error().stack;s&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[s]="12141c5a-b327-4470-81f2-149fb1c145b8",a._sentryDebugIdIdentifier="sentry-dbid-12141c5a-b327-4470-81f2-149fb1c145b8")}catch{}})();function H({value:a}){let s=a;if(typeof a=="string")try{s=JSON.parse(a)}catch{s=a}return e.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,fontFamily:"monospace",fontSize:"1em",lineHeight:1.6},children:typeof s=="object"?JSON.stringify(s,null,2):String(s)})}const ae={GET:"#00bfff",POST:"#4caf50",PUT:"#ff9800",PATCH:"#ffc107",DELETE:"#f44336"};function se({log:a,user:s}){const[l,c]=i.useState(!1),[u,m]=i.useState(!1),n=ae[a.method]||"#888",o=new Date(a.createdAt).toLocaleString(),p=s?$(s):null;return e.jsxs("div",{className:"auditlog-card",children:[e.jsxs("div",{className:"auditlog-card-header",children:[e.jsx("span",{className:"auditlog-method",style:{color:n},children:a.method}),e.jsx("span",{className:"auditlog-action",children:a.action}),e.jsx("span",{className:"auditlog-route",children:a.route}),e.jsx("span",{className:"auditlog-user",children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"auditlog-user-name",children:s.username}),p&&e.jsx("img",{src:p,alt:"avatar",className:"auditlog-user-avatar"})]}):e.jsx("span",{className:"auditlog-user-id",children:a.userId})}),e.jsx("span",{className:"auditlog-date",children:o})]}),e.jsxs("div",{className:"auditlog-card-section",children:[e.jsxs("button",{className:"auditlog-expand-btn",onClick:()=>c(v=>!v),children:[l?"Hide":"Show"," Payload"]}),l&&e.jsx("div",{className:"auditlog-json-view auditlog-payload-view",children:e.jsx(H,{value:a.payload})})]}),e.jsxs("div",{className:"auditlog-card-section",children:[e.jsxs("button",{className:"auditlog-expand-btn",onClick:()=>m(v=>!v),children:[u?"Hide":"Show"," Result"]}),u&&e.jsx("div",{className:"auditlog-json-view auditlog-result-view",children:e.jsx(H,{value:a.result})})]})]})}const oe=[10,25,50,100],T=[{value:"createdAt",label:"Created at"},{value:"updatedAt",label:"Updated at"},{value:"id",label:"ID"},{value:"userId",label:"User ID"},{value:"action",label:"Action"},{value:"route",label:"Route"},{value:"method",label:"Method"}],re={userId:"",action:"",method:"",route:"",startDate:"",endDate:"",sort:"createdAt",order:"DESC"},R=({page:a,total:s,pageSize:l,setPage:c,setPageSize:u,pageSizeOptions:m,navLocked:n})=>e.jsxs("div",{className:"auditlog-pagination",children:[e.jsxs("span",{children:["Page ",a," of ",Math.
1ceil(s/l)||1]}),e.jsx("button",{onClick:()=>c(o=>Math.max(1,o-1)),disabled:a===1||n,children:"Prev"}),e.jsx("button",{onClick:()=>c(o=>o*l<s?o+1:o),disabled:a*l>=s||n,children:"Next"}),e.jsx(q,{options:m,value:m.find(o=>o.value===l.toString()),onChange:o=>{u(Number(o.value)),c(1)},width:"150px",isDisabled:n})]}),yt=()=>{const a=X(),s=i.useMemo(()=>B({title:"Audit Logs",description:"Audit Logs",pathname:a.pathname,image:"/og-image.jpg",noindex:!0}),[a.pathname]),[l,c]=i.useState([]),[u,m]=i.useState(0),[n,o]=i.useState(1),[p,v]=i.useState(25),[Q,C]=i.useState(!1),E=i.useMemo(()=>oe.map(t=>({value:t.toString(),label:`${t} / page`})),[]),[d,j]=i.useState(()=>({...re})),[r,A]=i.useState(!1),[I,w]=i.useState(""),[b,D]=i.useState(null),f=i.useRef(d);f.current=d;const L=V(500),x=i.useCallback(async(t,h,k,N)=>{C(!0);const y={...t,page:h,pageSize:k};N&&(y.q=N),Object.keys(y).forEach(g=>(y[g]===""||y[g]==null)&&delete y[g]);try{const g=await L(({signal:K})=>Y.get(Z.admin.auditLog(),{params:y,signal:K}));c(g.data.logs),m(g.data.total),C(!1)}catch(g){if(z.isCancel(g))return;c([]),m(0),C(!1)}},[L]);i.useEffect(()=>{r||x(d,n,p,void 0)},[r,d,n,p,x]),i.useEffect(()=>{if(!r||b===null)return;const t=b.trim()||void 0;x(f.current,n,p,t)},[r,b,n,p,x]);const M=()=>{A(!0),D(null),w("")},U=()=>{A(!1),D(null),w("")},F=()=>{const t=I.trim();D(t),o(1)},S=t=>{const{name:h,value:k}=t.target;j(N=>({...N,[h]:k})),r||o(1)},O=t=>{j(h=>({...h,[t.target.name]:t.target.value})),r||o(1)},G=t=>{if(!r&&f.current.sort===t){x(f.current,n,p,void 0);return}j(h=>({...h,sort:t})),r||o(1)},P=t=>{if(!r&&f.current.order===t){x(f.current,n,p,void 0);return}j(h=>({...h,order:t})),r||o(1)},_=r&&b===null,J=T.find(t=>t.value===d.sort);return e.jsxs("div",{className:"auditlog-page",children:[e.jsx(W,{...s}),e.jsxs("div",{className:"auditlog-container page-content",children:[e.jsx("h1",{children:"Audit Logs"}),e.jsxs("div",{className:"auditlog-filters",children:[e.jsxs("div",{className:"auditlog-filters-row",children:[e.jsx("input",{name:"userId",value:d.userId,onChange:S,placeholder:"User ID"}),e.jsx("input",{name:"action",value:d.action,onChange:S,placeholder:"Action"}),e.jsx("input",{name:"method",value:d.method,onChange:S,placeholder:"Method"}),e.jsx("input",{name:"route",value:d.route,onChange:S,placeholder:"Route"})]}),e.jsxs("div",{className:"auditlog-filters-row",children:[e.jsx("input",{type:"date",name:"startDate",value:d.startDate,onChange:O,placeholder:"Start Date"}),e.jsx("input",{type:"date",name:"endDate",value:d.endDate,onChange:O,placeholder:"End Date"}),e.jsxs("div",{className:"auditlog-filters-heavy",children:[e.jsxs("div",{className:`auditlog-heavy-lid ${r?"auditlog-heavy-lid--open":""}`,children:[e.jsx("div",{className:`auditlog-heavy-cover ${r?"auditlog-heavy-cover--lifted":""}`,onClick:()=>!r&&M(),onKeyDown:t=>{!r&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),M())},role:"button",tabIndex:0,"aria-label":"Open heavy search (payload and result)",children:e.jsx("span",{className:"auditlog-heavy-cover-label",children:"Heavy: payload / result"})}),r?e.jsx("button",{type:"button",className:"auditlog-heavy-lid-peek",onClick:U,"aria-label":"Lower lid and return to quick mode",children:e.jsx("span",{className:"auditlog-heavy-lid-peek-grip","aria-hidden":!0})}):null,e.jsxs("div",{className:"auditlog-heavy-lid-row",children:[e.jsx("input",{"aria-label":"Heavy search in payload or result",value:I,onChange:t=>w(t.target.value),placeholder:"Slow LIKE — only runs when you press Search",autoComplete:"off",disabled:!r}),e.jsx("button",{type:"button",className:"auditlog-heavy-search-btn",onClick:F,disabled:!r,children:"Search"})]})]}),e.jsx("p",{className:"auditlog-mode-hint",children:r?"Heavy mode: includes the query above to search through all existing text in logs.":"Quick mode: only search by filters."})]})]})]}),e.jsx("div",{className:"sort auditlog-sort-block",children:e.jsxs("div",{className:"sort-option",children:[e.jsx(q,{value:J,onChange:t=>t&&G(t.value),options:T,label:"Sort by",width:"14rem"}),e.jsxs("div",{className:"order",children:[e.jsx("p",{children:"Order"}),e.jsxs("div",{className:"wrapper",children:[e.jsx(ee,{className:"svg-fill",style:{backgroundColor:d.order==="ASC"?"rgba(255, 255, 255, 0.7)":""},onClick:()=>P("ASC")}),e.jsx(te,{className:"svg-fill",style:{backgroundColor:d.order==="DESC"?"rgba(255, 255, 255, 0.7)":""},onClick:()=>P("DESC")})]})]})]})}),e.jsx(R,{page:n,total:u,pageSize:p,setPage:o,setPageSize:v,pageSizeOptions:E,navLocked:_}),e.jsx("div",{className:"auditlog-card-list",children:Q?e.jsx("div",{children:"Loading..."}):l.length===0?e.jsx("div",{children:"No logs found."}):l.map(t=>e.jsx(se,{log:t,user:t.user},t.id))}),e.jsx(R,{page:n,total:u,pageSize:p,setPage:o,setPageSize:v,pageSizeOptions:E,navLocked:_})]})]})};export{yt 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.