import{P as e,bI as a,x as l,k as s,aC as t,_ as n}from"./utils-lib.js?v=1761009159";import{r as i,o as c,c as o,q as d,H as m,v as u,N as r,B as p,e as _,z as b,I as f,y as v,Q as y,C as x,aC as h,G as g,aw as V,ay as C,ab as j,a9 as k}from"./base-lib.js?v=1761009159";import{B as w}from"./index115.js?v=1761009159";import{S as z,_ as E}from"./index.vue_vue_type_script_setup_true_lang7.js?v=1761009159";import{X as I,Y as T,V as q}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";const U=z(),G=i({}),P={bind:"监听IP",port:"监听端口",cachesize:"最大缓存容量",maxconn:"最大连接数限制",curr_connections:"当前打开的连接数",cmd_get:"GET请求数",get_hits:"GET命中次数",get_misses:"GET失败次数",hit:"GET命中率",curr_items:"当前被缓存的数据行数",evictions:"因内存不足而被清理的缓存行数",bytes:"当前已使用内存",bytes_read:"请求总大小",bytes_written:"发送总大小"},B=i("service"),H=i(""),N=i(!1),S=i(!1),M=i([]),O=c({ip:"",cachesize:"",maxconn:"",port:"",btn_set_memcached:""}),A=i(""),D=i([]),X=async()=>{await e({loading:"正在保存中，请稍后...",request:I(O),message:!0})},F=async()=>{await e({loading:"正在保存中，请稍后...",request:a({path:"/etc/init.d/memcached",data:H.value,encoding:"utf-8"}),message:!0})},Q=({props:{name:a}})=>{switch(a){case"service":R();break;case"performance":(async()=>{await e({loading:N,request:T(),success:e=>{O.ip=e.data.bind,O.cachesize=e.data.cachesize,O.maxconn=e.data.maxconn,O.port=e.data.port}})})();break;case"config":(async()=>{await e({loading:N,request:q({path:"/etc/init.d/memcached"}),data:{data:[String,H]}})})();break;case"load":(async()=>{await e({loading:N,request:T(),success:e=>{M.value=[];const a=["bytes","bytes_read","bytes_written"];Object.keys(e.data).forEach(s=>{"limit_maxbytes"!==s&&M.value.push({name:s,ps:P[s],value:a.includes(s)?l(Number(e.data[s])):e.data[s]})})}})})()}},R=e=>{B.value="service",e&&(G.value=e),U.init(G.value),A.value=G.value.version.split(".")[0]+"."+G.value.version.split(".")[1],D.value=G.value.versions},Y={class:"my-[12px]"},Z={class:"flex flex-col text-secondary performance"},J={class:"flex items-center"},K={class:"flex items-center"},L={class:"flex items-center"},W={class:"flex items-center"},$=n(o({__name:"index",props:{compData:{default:{}}},setup(e){const a=e;return d(()=>{R(a.compData)}),(e,a)=>{const l=h,n=w,i=g,c=V,o=C,d=s,z=j,I=k,T=t,q=m("bt-loading");return u(),r(T,{modelValue:v(B),"onUpdate:modelValue":a[5]||(a[5]=e=>y(B)?B.value=e:null),type:"left-bg-card",onTabClick:v(Q)},{default:p(()=>[_(l,{label:"服务",name:"service"},{default:p(()=>[_(E)]),_:1}),_(l,{label:"配置文件",name:"config"},{default:p(()=>[a[7]||(a[7]=b("span",{class:"my-[4px] text-secondary"},"提示：Ctrl+F 搜索关键字，Ctrl+S 保存，Ctrl+H 查找替换",-1)),b("div",Y,[f(_(n,{class:"!h-[36rem] !w-[full]",modelValue:v(H),"onUpdate:modelValue":a[0]||(a[0]=e=>y(H)?H.value=e:null),id:"configContent",filePath:"/etc/init.d/memcached"},null,8,["modelValue"]),[[q,v(N)]])]),_(i,{onClick:v(F),type:"primary"},{default:p(()=>a[6]||(a[6]=[x("保存",-1)])),_:1,__:[6]},8,["onClick"]),a[8]||(a[8]=b("ul",{class:"leading-8 mt-20px text-small list-disc ml-[20px]"},[b("li",null,"此处为memcached主配置文件,若您不了解配置规则,请勿随意修改")],-1))]),_:1,__:[7,8]}),_(l,{label:"负载状态",name:"load"},{default:p(()=>[f((u(),r(o,{"max-height":"500",data:v(M),border:"",style:{width:"100%"}},{default:p(()=>[_(c,{prop:"name",label:"字段"}),_(c,{prop:"value",label:"当前值"}),_(c,{prop:"ps",label:"说明"})]),_:1},8,["data"])),[[q,v(N)]])]),_:1}),f((u(),r(l,{label:"性能调整",name:"performance"},{default:p(()=>[b("div",Z,[_(I,{model:v(O)},{default:p(()=>[_(z,{label:"BindIp"},{default:p(()=>[b("div",J,[_(d,{modelValue:v(O).ip,"onUpdate:modelValue":a[1]||(a[1]=e=>v(O).ip=e)},null,8,["modelValue"]),a[9]||(a[9]=b("span",{class:"unit"},"监听IP,请勿随意修改",-1))])]),_:1}),_(z,{label:"PORT"},{default:p(()=>[b("div",K,[_(d,{modelValue:v(O).port,"onUpdate:modelValue":a[2]||(a[2]=e=>v(O).port=e),type:"number"},null,8,["modelValue"]),a[10]||(a[10]=b("span",{class:"unit"}," 监听端口,一般无需修改",-1))])]),_:1}),_(z,{label:"CACHESIZE"},{default:p(()=>[b("div",L,[_(d,{modelValue:v(O).cachesize,"onUpdate:modelValue":a[3]||(a[3]=e=>v(O).cachesize=e),type:"number"},null,8,["modelValue"]),a[11]||(a[11]=b("span",{class:"unit"}," MB,缓存大小,建议不要大于512M",-1))])]),_:1}),_(z,{label:"MAXCONN"},{default:p(()=>[b("div",W,[_(d,{modelValue:v(O).maxconn,"onUpdate:modelValue":a[4]||(a[4]=e=>v(O).maxconn=e),type:"number"},null,8,["modelValue"]),a[12]||(a[12]=b("span",{class:"unit"},"最大连接数,建议不要大于40960",-1))])]),_:1}),_(z,{label:" "},{default:p(()=>[_(i,{onClick:v(X),type:"primary"},{default:p(()=>a[13]||(a[13]=[x("保存",-1)])),_:1,__:[13]},8,["onClick"])]),_:1})]),_:1},8,["model"])])]),_:1})),[[q,v(S)]])]),_:1},8,["modelValue","onTabClick"])}}}),[["__scopeId","data-v-5cf77f24"]]);export{$ as default};
