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