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