import{Q as $}from"./QPage-DjgmKzZ_.js";import{u as A}from"./use-meta-Drr87NGw.js";import{u as M}from"./use-quasar-CxlsMA-r.js";import{u as D,Q as F}from"./QItemLabel-BRceraJL.js";import{a as y,r as n,o as N,e as P,w,a2 as L,a3 as T,a6 as r,a7 as i,a8 as S,ad as p,a5 as c,as as G,a9 as C,aq as R,ab as U}from"./index-D6xcdmSy.js";import{a as E,b as H}from"./rtl-BJcSdsPV.js";import{Q as K,a as W,b as j}from"./QTable-mJIsuc0j.js";import{e as J,g as O}from"./axios-B_9szzRp.js";import{u as X}from"./language-BmNUDO97.js";import{u as Y}from"./vue-i18n.runtime-BS3IaizX.js";const Z={class:"q-pa-md"},ee={__name:"NetworkList",setup(q){const{t:o}=Y(),s=M(),f=D(),v=X(),_=y(()=>[{name:"bytes_sent",label:o("network.bytes_sent"),align:"left",field:"bytes_sent"},{name:"bytes_recv",align:"center",label:o("network.bytes_recv"),field:"bytes_recv"},{name:"updated_time",align:"center",label:o("updated_time"),field:"updated_time"}]),m=y(()=>f.token),g=n([]),h=n([]),b=n(0);let k=null;const u=n({sortBy:"updated_time",descending:!1,page:1,rowsPerPage:30,rowsNumber:30}),x=y(()=>m.value!==""?Math.ceil(b.value/u.value.rowsPerPage):0),V=n(s.screen.height*.73+"px"),z=n(s.screen.width*.825+"px"),B=n(s.dark.isActive?"#121212":"#ffffff");function d(a){let t={};a?t=a:t.pagination=u.value,f.tokenDataGet!==""&&(O({url:"core/network/",params:{page:t.pagination.page,max_page:t.pagination.rowsPerPage}}).then(e=>{g.value=e.results.map(l=>({...l,bytes_sent:Q(l.bytes_sent),bytes_recv:Q(l.bytes_recv),created_time:l.created_time,updated_time:l.updated_time})),b.value=e.count,h.value=e.users}).catch(e=>{s.notify({type:"error",message:e}),s.loading.hide()}),u.value=t.pagination)}function Q(a){if(a===0)return"0 Bytes";const t=["Bytes","KB","MB","GB","TB"],e=Math.floor(Math.log(a)/Math.log(1024)),l=(a/Math.pow(1024,e)).toFixed(2);return new Intl.NumberFormat().format(l)+" "+t[e]}N(()=>{I(),d(),k=setInterval(()=>{d()},6e4)}),P(()=>{k&&clearInterval(k)}),w(()=>s.dark.isActive,a=>{B.value=a?"#121212":"#ffffff"});function I(){J.on("needLogin",a=>{a&&(g.value=[],h.value=[],b.value=0)})}return w(()=>v.langData,a=>{a&&d()}),(a,t)=>(T(),L("div",Z,[r(j,{class:R(c(s).dark.isActive?"my-sticky-header-column-table-dark":"my-sticky-header-column-table"),flat:"",bordered:"",rows:g.value,columns:_.value,"row-key":"index",pagination:u.value,"onUpdate:pagination":t[3]||(t[3]=e=>u.value=e),separator:"cell","no-data-label":c(o)("nodata"),"rows-per-page-label":c(o)("per_page"),"rows-per-page-options":[10,30,50,200,1e3],"table-style":{height:V.value,width:z.value},"card-style":{backgroundColor:B.value},onRequest:d},{top:i(e=>[r(E,{flat:""},{default:i(()=>[r(C,{label:c(o)("refresh"),icon:"refresh",onClick:t[0]||(t[0]=l=>d())},{default:i(()=>[r(F,{class:"bg-indigo",offset:[10,10],"content-style":"font-size: 12px"},{default:i(()=>[S(p(c(o)("refreshdata")),1)]),_:1})]),_:1},8,["label"])]),_:1}),r(H),r(C,{flat:"",round:"",dense:"",icon:e.inFullscreen?"fullscreen_exit":"fullscreen",onClick:e.toggleFullscreen},null,8,["icon","onClick"])]),"body-cell":i(e=>[r(W,{props:e},{default:i(()=>[G("div",null,p(e.value),1)]),_:2},1032,["props"])]),pagination:i(()=>[S(p(c(o)("total"))+p(x.value)+" "+p(c(o)("page"))+" ",1),r(K,{modelValue:u.value.page,"onUpdate:modelValue":[t[1]||(t[1]=e=>u.value.page=e),t[2]||(t[2]=e=>d())],max:x.value,input:"","input-class":"text-orange-10"},null,8,["modelValue","max"])]),_:1},8,["class","rows","columns","pagination","no-data-label","rows-per-page-label","table-style","card-style"])]))}},de={__name:"NetworkReader",setup(q){const o=M(),s=n(!1),f=n(""),v=n(""),_=n("");return A(()=>({title:f.value,meta:{description:{name:"description",content:v.value},keywords:{name:"keywords",content:_.value}}})),N(()=>{}),P(()=>{}),w(()=>o.dark.isActive,m=>{s.value=m}),(m,g)=>(T(),U($,{class:"flex flex-top"},{default:i(()=>[r(ee)]),_:1}))}};export{de as default};
