import{l as a,am as e,a4 as l,M as s,x as t,cn as u,$ as n,co as o,cp as i,cq as d,cr as c,cs as p,cm as r,az as m}from"./utils-lib.js?v=20260328163632";import{_ as v}from"./index.vue_vue_type_script_setup_true_lang5.js?v=20260328163632";import{_ as f}from"./index.vue_vue_type_script_setup_true_lang6.js?v=20260328163632";import{B as b}from"./index118.js?v=20260328163632";import{r as _,k as g,o as y,U as h,V as k,_ as x,a3 as j,O as w,Y as V,N as z,j as U,Z as C,l as q,W as O,F as N,L as B,X as D}from"./base-lib.js?v=20260328163632";import{e as E,b as H,B as M,au as P,s as F,v as I,w as J}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index158.js?v=20260328163632";import"./ace.js?v=20260328163632";const L=_("server"),S=_({}),W=_(!1),X=[{content:a("此处为MongoDB主配置文件,若您不了解配置规则,请勿随意修改。")}],Y=_(""),Z=_({columns:[{title:a("数据库名"),key:"name"},{title:a("数据库大小"),key:"size",render:a=>e(a.size)},l([{title:a("删除"),onClick:e=>{t({loading:a("正在删除数据库，请稍候..."),request:c({dbName:e.name}),message:!0,success:()=>{K()}})}}])],data:[]}),$=()=>{Y.value?t({loading:a("正在创建数据库，请稍候..."),request:u({dbName:Y.value}),message:!0,success:()=>{K()}}):s.error(a("请输入数据库名称"))},[A,G]=n(Z),K=()=>{t({loading:W,request:o(),success:a=>{Z.value.data=a.data}})},Q=_({}),R={bind_ip:a("监听IP,请勿随意修改"),port:a("监听端口,一般无需修改"),dbpath:a("数据存储位置"),logpath:a("日志文件位置")},T=_(""),aa=_(""),ea=()=>t({loading:W,request:p(),success:a=>{Object.keys(a.data).forEach((e=>{["config_file","logpath"].includes(e)||(Q.value[e]={name:e,value:a.data[e],ps:R[e]||""})})),T.value=a.data.logpath,aa.value=a.data.config_file}}),la=()=>{let e={};Object.keys(Q.value).forEach((a=>{e[a]=Q.value[a].value})),t({loading:a("正在保存配置，请稍候..."),request:i({options:JSON.stringify(e)}),message:!0,success:()=>{ea()}})},sa=_(!1),ta=_(""),ua=_({count:0,limit:99999999,log_end:!0,maxPage:200,page:1}),na=async(a="")=>{await t({loading:sa,request:d({path:T.value,limit:ua.value.limit,p:ua.value.page}),success:e=>{ta.value=a+e.data.data.join("\n"),Object.assign(ua.value,e.data.page)}})},oa=async a=>{switch(L.value=a,L.value){case"database":K();break;case"performance":ea();break;case"config":aa.value||ea();break;case"logs":T.value||await ea(),na()}},ia=g({__name:"index",props:{compData:{default:{}}},setup(e){const l=e;return y((()=>{S.value=l.compData})),(e,l)=>{const s=E,t=H,u=M,n=P,o=F,i=I,d=J,c=h("bt-loading");return k(),x(V(m),{modelValue:V(L),"onUpdate:modelValue":l[4]||(l[4]=a=>z(L)?L.value=a:null),type:"card",placement:"left",onChange:V(oa)},{default:j((()=>[w(s,{name:"server",tab:V(r)(V(a)("服务状态")),"display-directive":"show:lazy"},{default:j((()=>[w(v,{tab:V(L),modelValue:V(S).status,"onUpdate:modelValue":l[0]||(l[0]=a=>V(S).status=a),name:"mongodb"},null,8,["tab","modelValue"])])),_:1},8,["tab"]),w(s,{name:"database",tab:V(r)(V(a)("数据库")),"display-directive":"show:lazy"},{default:j((()=>[w(n,{class:"flex mb-10px",size:10},{default:j((()=>[w(t,{value:V(Y),"onUpdate:value":l[1]||(l[1]=a=>z(Y)?Y.value=a:null),placeholder:V(a)("数据库名称"),class:"!w-160px"},null,8,["value","placeholder"]),w(u,{type:"primary",onClick:V($)},{default:j((()=>[U(C(V(a)("创建数据库")),1)])),_:1},8,["onClick"])])),_:1}),w(V(A),{"max-height":480})])),_:1},8,["tab"]),w(s,{name:"performance",tab:V(r)(V(a)("配置项")),"display-directive":"show:lazy"},{default:j((()=>[q((k(),x(d,{class:"performance-form","label-align":"right","label-placement":"left","label-width":110},{default:j((()=>[(k(!0),O(N,null,B(V(Q),((e,l)=>(k(),x(i,{label:e.name,key:l,"feedback-class":"!min-h-10px"},{default:j((()=>[w(n,{align:"center"},{default:j((()=>["auth"===e.name?(k(),x(o,{key:0,value:e.value,"onUpdate:value":a=>e.value=a},null,8,["value","onUpdate:value"])):(k(),x(t,{key:1,value:e.value,"onUpdate:value":a=>e.value=a,placeholder:"",class:"!w-260px"},null,8,["value","onUpdate:value"])),D("span",null,C(V(a)(e.ps)),1)])),_:2},1024)])),_:2},1032,["label"])))),128)),w(i,{label:" ",class:"mt-10px"},{default:j((()=>[w(u,{type:"primary",onClick:V(la)},{default:j((()=>[U(C(V(a)("保存")),1)])),_:1},8,["onClick"])])),_:1})])),_:1})),[[c,V(W)]])])),_:1},8,["tab"]),w(s,{name:"config",tab:V(r)(V(a)("配置文件")),"display-directive":"show:lazy"},{default:j((()=>[w(f,{modelValue:V(L),"onUpdate:modelValue":l[2]||(l[2]=a=>z(L)?L.value=a:null),filename:V(aa),options:V(X)},null,8,["modelValue","filename","options"])])),_:1},8,["tab"]),w(s,{name:"logs",tab:V(r)(V(a)("日志")),"display-directive":"show:lazy"},{default:j((()=>[w(u,{type:"primary",onClick:l[3]||(l[3]=a=>V(na)("")),class:"mb-10px"},{default:j((()=>[U(C(V(a)("刷新日志")),1)])),_:1}),q(w(b,{content:V(ta),isHtml:!0,style:"height:500px"},null,8,["content"]),[[c,V(sa)]])])),_:1},8,["tab"])])),_:1},8,["modelValue","onChange"])}}});export{ia as default};
