1import{r as o,j as s,D as Q,v as c,J as m,R as Te,$ as X,C as Be}from"./CgBZl8m0.production.bundle.min.js";import{B as De}from"./BpQvVIpM.production.bundle.min.js";import{B as Z}from"./B7jgtT_H.production.bundle.min.js";import{D as ze}from"./BaeVAzEX.production.bundle.min.js";import{S as Ae}from"./D4lvmK5r.production.bundle.min.js";import{a as Ne,R as Pe}from"./BFsIcxdk.production.bundle.min.js";import{P as G}from"./IimQW1M7.production.bundle.min.js";import{S as Ue}from"./BZwPEnwo.production.bundle.min.js";import{c as v,S as Le,b as Me}from"./uYRgXL5M.production.bundle.min.js";import{T as ee}from"./CHbz8HD7.production.bundle.min.js";import{g as ke}from"./CHbJgqnE.production.bundle.min.js";import{G as Ie,u as Ke}from"./PSw9bd14.production.bundle.min.js";import{u as Ge}from"./CUU-sqeu.production.bundle.min.js";import{J as $e,K as we,L as b,M as Oe,N as Re}from"./IggLV8Lk.production.bundle.min.js";import{L as Ve}from"./BkDLz1FT.production.bundle.min.js";import{u as $}from"./BWr4BVpJ.production.bundle.min.js";import{r as p,a4 as f}from"./9zG8c1d8.production.bundle.min.js";import"./BTOj8ijf.production.bundle.min.js";import"./Czbq-YEj.production.bundle.min.js";import"./BhEpiGZx.production.bundle.min.js";import"./CJLuAe4t.production.bundle.min.js";import"./Dsqj8S3w.production.bundle.min.js";import"./C7aKDdDU.production.bundle.min.js";import"./BOFlCg2s.production.bundle.min.js";import"./CK-5Vo_r.production.bundle.min.js";import"./CMxhj3GZ.production.bundle.min.js";import"./BS0dGend.production.bundle.min.js";import"./DohGM9_I.production.bundle.min.js";import"./Czj00ZrM.production.bundle.min.js";import"./vhNSgALD.production.bundle.min.js";import"./DV0DPFOt.production.bundle.min.js";import"./M_FBjfQJ.production.bundle.min.js";import"./DlG3g9Q4.production.bundle.min.js";import"./BAUftK01.production.bundle.min.js";import"./DvJkqRNe.production.bundle.min.js";import"./mPG1iAzk.production.bundle.min.js";import"./D9BowqIy.production.bundle.min.js";import"./CRSxynHN.production.bundle.min.js";/* empty css */const Ce=({details:l})=>{const[T,M]=o.useState(1),[k]=o.useState([{title:"Updated Date",columnKey:"created_at"},{title:"Infra Host",columnKey:"infra"},{title:"APM Host",columnKey:"apm"},{title:"Logs (GB)",columnKey:"log_size"},{title:"RUM",columnKey:"rum"},{title:"Metrics (GB)",columnKey:"metric_size"},{title:"Traces (GB)",columnKey:"trace_size"},{title:"Synthetic Checks",columnKey:"synthetics"},{title:"Database",columnKey:"database"}]),B=o.useMemo(()=>((l==null?void 0:l.getAuditUserById)||[]).flatMap(x=>{const D=x.created_at.split("T")[0];return x.meta_data.filter(a=>a.timestamp===D).map(a=>({created_at:D,infra:a.usage.infra,apm:a.usage.apm,log_size:`${(a.usage.log_size/1e9).toFixed(2)} GB`,rum:a.usage.rum,metric_size:`${(a.usage.metric_size/1e9).toFixed(2)} GB`,trace_size:`${(a.usage.trace_size/1e9).toFixed(2)} GB`,synthetics:a.usage.synthetics,database:a.usage.database}))}),[l]);return s.jsx("div",{className:"audit_logs_details",children:s.jsx(ee,{children:s.jsx(v,{columns:k,dataProvider:B,loading:l.inflight,uniqId:"audit-logs-tableview",pagination:{totalRecords:B.length,page:T,onChange:(h,x)=>{console.log(h,x),M(h)},recordsLabel:"Audit Logs"}})})})};c.extend(Ke);const Pt=()=>{var Y;const[l,T]=o.useState(!1),[M,k]=o.useState(""),[B,h]=o.useState(1),[x,D]=o.useState(!1),[a,te]=o.useState(""),se=$(ke)=="dark",[w,O]=o.useState(!1),[u,re]=o.useState("free"),d=Ge(),S=$($e),[j,I]=o.useState(S.auditUsers||[]),[oe,R]=o.useState(!1),[ne,V]=o.useState(!1),[N,C]=o.useState(!1),[r,F]=o.useState(null),ie=e=>{V(e)},H=e=>{const t=X.filter(n=>n.timeRangeOption===e.range)[0];return t.timeRangeOption===Q.Custom?`${c.unix(e.fromTs/1e3).format("MMM DD HH:mm")} - ${c.unix(e.toTs/1e3).format("MMM DD HH:mm")}`:t.label},[E,ae]=o.useState({fromTs:c(c().subtract(1,"day")).unix()*1e3,toTs:c(c()).unix()*1e3,interval:2400,range:Q.OneDay}),[ce,le]=o.useState(H(E)),P=e=>{const t=new Date(e),n=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),y=String(t.getDate()).padStart(2,"0"),U=String(t.getHours()).padStart(2,"0"),L=String(t.getMinutes()).padStart(2,"0"),_=String(t.getSeconds()).padStart(2,"0"),g=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${i}-${y} ${U}:${L}:${_}.${g}`},[z,de]=o.useState(P(c(c().subtract(1,"day")).unix()*1e3)),[A,me]=o.useState(P(c(c()).unix()*1e3)),ue=e=>{V(!1);const t=H(e);le(t),ae(e);const n=P(e.fromTs),i=P(e.toTs);de(n),me(i),d(b({search:a,fromTs:n,toTs:i,billing_status:u}))},ge=$(we);o.useEffect(()=>{d(b({search:"",fromTs:z,toTs:A,billing_status:u}))},[]),o.useEffect(()=>{S.auditUsers&&S.auditUsers.length>0?I(oe?e=>[...e,...S.auditUsers]:S.auditUsers):I([]),R(!1)},[S.auditUsers]);const pe=(e,t)=>{var i;D(!0),R(!0);const n=B;h(n+1),((i=j[0])==null?void 0:i.total_record)!==j.length&&d(b({search:a,page:n,limit:t,fromTs:z,toTs:A,billing_status:u},()=>{D(!1)}))},fe=[{title:"Updated Date",columnKey:"created_at",fixed:!0,renderTooltipContent:"",render:e=>typeof e=="string"||typeof e=="number"?s.jsx("span",{children:c.utc(e).format("MMM DD, YYYY hh:mm a")}):s.jsx("span",{children:String(e)})},{title:"Email",columnKey:"email"},{title:"Infra Hosts",columnKey:"infra",defaultSortOrder:(r==null?void 0:r.column)==="infra"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsx("span",{children:String(e)})}},{title:"APM Hosts",columnKey:"apm",defaultSortOrder:(r==null?void 0:r.column)==="apm"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsx("span",{children:String(e)})}},{title:"Log Size (GB)",columnKey:"log_size",defaultSortOrder:(r==null?void 0:r.column)==="log_size"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," GB"," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsxs("span",{children:[String(e)," GB"]})}},{title:"RUM",columnKey:"rum",defaultSortOrder:(r==null?void 0:r.column)==="rum"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsx("span",{children:String(e)})}},{title:"Metrics (GB)",columnKey:"metric_size",defaultSortOrder:(r==null?void 0:r.column)==="metric_size"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," GB"," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsxs("span",{children:[String(e)," GB"]})}},{title:"Traces (GB)",columnKey:"trace_size",defaultSortOrder:(r==null?void 0:r.column)==="trace_size"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," GB"," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsx("span",{children:String(e)})}},{title:"Synthetic Checks",columnKey:"synthetics",defaultSortOrder:(r==null?void 0:r.column)==="synthetics"?r.order:m.None,render:e=>{if(typeof e=="object"&&e!==null&&"message"in e&&"color"in e){const t=e;return s.jsxs("span",{style:{color:t.color},children:[t.message," ",t.color==="red"?s.jsx(p,{}):"",t.color==="green"?s.jsx(f,{}):""]})}return s.jsx("span",{children:String(e)})}},{title:"Account ID",columnKey:"account_id"}],q=e=>isNaN(e)||e===0?"0":(e/1e9).toFixed(2),he=j.map(e=>{const t=e.meta_data,n={email:e.email,created_at:e.created_at,meta_data:e.meta_data,infra:"N/A",apm:"N/A",log_size:"N/A",rum:"N/A",metric_size:"N/A",trace_size:"N/A",database:"N/A",synthetics:"N/A",account_id:e.account_id},i=y=>{var J,W;t.sort((_e,be)=>new Date(_e.timestamp).getTime()-new Date(be.timestamp).getTime());const U=((J=t[0])==null?void 0:J.usage[y])||0,L=((W=t[1])==null?void 0:W.usage[y])||0,_=["log_size","metric_size","trace_size"].includes(y)?Number(q(U)):U,g=["log_size","metric_size","trace_size"].includes(y)?Number(q(L)):L;return g>_?{message:`${_} to ${g}`,color:"green"}:g<_?{message:`${_} to ${g}`,color:"red"}:{message:`${g}`,color:`${se?"white":"black"}`}};return(t==null?void 0:t.length)>=2&&(n.infra=i("infra"),n.apm=i("apm"),n.log_size=i("log_size"),n.rum=i("rum"),n.metric_size=i("metric_size"),n.trace_size=i("trace_size"),n.database=i("database"),n.synthetics=i("synthetics")),n});function xe(e){te(e),d(b({search:e,fromTs:z,toTs:A}))}function Se(e){d(Re({account_id:e}))}const K=e=>{re(e),d(b({fromTs:z,toTs:A,billing_status:e}))},je=s.jsxs("div",{children:[s.jsx(G,{selected:u==="free",onClick:()=>K("free"),children:"Free"}),s.jsx(G,{selected:u==="active",onClick:()=>K(De.active),children:"Paid"}),s.jsx(G,{selected:u==="all",onClick:()=>K("all"),children:"All"})]}),ye=()=>{C(!0),d(Oe(()=>{C(!1)}))};return s.jsxs(Te.Fragment,{children:[s.jsx(Ve,{}),s.jsxs("div",{className:"middleware-data audit-data",children:[s.jsxs("section",{className:"top-section",children:[s.jsx("h5",{children:"Audit Logs"}),s.jsx("div",{className:"search-bar",children:s.jsxs("div",{className:"d-flex",children:[s.jsx(Ue,{width:500,placeholder:"Search by Email",onChange:e=>xe(e)}),s.jsx("div",{className:"date-picker-block",children:s.jsx(ze,{isDatePickerVisible:ne,handleDatePickerVisibility:ie,datePickerBtnText:ce,onChange:ue,defaultValue:E,presetOptions:X,disableFutureDates:!0,maxDaysSelection:30})}),s.jsx("div",{className:"plan-filter",children:s.jsx(Ne,{content:je,isVisible:w,onClose:()=>{O(!1)},children:s.jsx("div",{children:s.jsx(Z,{onClick:()=>O(!w),children:"Plans"})})})}),s.jsxs("div",{className:"update-button",children:[s.jsx(Z,{size:Ae.Small,secondary:!0,prefixicon:N?s.jsx(Be,{}):s.jsx(Pe,{}),onClick:()=>
1ye(),disabled:N,children:N?"Loading...":"Fetch Latest Audit Logs"}),N?s.jsx("p",{children:"Please wait.. the Cron job is running."}):""]})]})})]}),s.jsx("div",{className:"audit-details",children:s.jsx(ee,{children:s.jsx("div",{className:"table_audit_logs",children:s.jsx(v,{columns:fe,dataProvider:he,loading:x,uniqId:"audit-logs-tableview",onSortingChange:(e,t)=>{t===m.None?F(null):F({column:e,order:t,priority:0}),d(b({sort:e,order_by:t,fromTs:z,toTs:A,billing_status:u}))},onScroll:pe,rowOnClick:e=>{const t=e;T(!0),k(t.email),Se(t.account_id)},pagination:{totalRecords:(Y=j==null?void 0:j[0])==null?void 0:Y.total_record,page:B,onChange:(e,t)=>{h(e)},recordsLabel:"Audit Logs"},maxHeight:"calc(100vh - 150px)"})})})})]}),l&&s.jsx(Ie,{title:"Audit Logs",isOpen:l,onBackBtnClick:()=>{T(!1)},onClose:()=>{T(!1)},datePicker:!1,headerElements:s.jsx(Le,{labelText:M,type:Me.Success}),children:s.jsx(Ce,{details:{inflight:!1,getAuditUserById:ge.getAuditUserById}})})]})};export{Pt 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.