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