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