import{d as a,h as t,Z as e,u as s}from"./public.js?v=1764233927359";import{bn as i,n as o,d as n,fU as l,x as d,eU as r}from"./page_layout.js?v=1764233927359";import{e as m}from"./file.js?v=1764233927359";import{a as p,_}from"./index.vue_vue_type_script_setup_true_lang14.js?v=1764233927359";import{k as x,P as c,r as u,W as b,R as g,V as D,S as f,a3 as y,a4 as h,U as v,an as k}from"./vue.js?v=1764233927359";import{dk as w}from"./naive.js?v=1764233927359";import"./common.js?v=1764233927359";import"./__commonjsHelpers__.js?v=1764233927359";const j={class:"px-20px py-24px"},C={class:"font-bold"},L={class:"mt-16px text-error"},U={key:0,class:"mt-4px"},$=x({__name:"index",props:{data:{}},emits:["close"],setup(x,{expose:$,emit:R}){const{t:F}=c(),H=x,{ids:P}=H.data,S=R,V=i(),W=u(!0),Z=u([]),q=a=>{let t="--";for(let e=0;e<V.remoteList.length;e++){const s=V.remoteList[e];if(s.id===a){t=s.ps||s.db_host;break}}return t},z=u([{key:"name",title:F("Database.index_12"),ellipsis:{tooltip:{width:"trigger"}}},{key:"total",title:F("Component.UploadFile.index_4"),width:120,render:a=>o(a.total)},{key:"position",title:F("Database.index_19")},{key:"addtime",title:F("Docker.Container.config.status.index_11"),width:160,render:a=>a.addtime},{key:"result",title:F("Database.tools.index_24"),align:"right",width:140,render:a=>a.position!==V.remoteList[0].ps?b("div",{class:"text-error"},[F("Database.tools.index_25")]):b("div",{class:W.value?"":"text-error"},[W.value?F("Database.tools.index_26"):F("Database.tools.index_25")])}]),{loading:A,setLoading:B}=a(),E=async a=>await r(V.type,{name:a.name,id:a.id}),G=()=>{s({title:F("Database.index_30"),hideClose:!0,data:{title:F("Database.index_30"),api:E,data:Z.value,callback:I},component:p})},I=a=>{S("close"),V.setRefresh(!0),s({title:F("Database.tools.index_30"),width:440,footer:!0,component:_,data:{title:F("Database.index_30"),data:a,status:"done",columns:[{key:"name",title:F("Database.index_12"),ellipsis:{tooltip:{width:"trigger"}}}]}})};return(async()=>{await(async()=>{const{message:a}=await m();n(a)&&(W.value=a.status_db)})(),(async()=>{try{B(!0);const{message:a}=await l({ids:P});n(a)?Z.value=d(a.data)?a.data.map(a=>({...a,position:q(a.sid)})):[]:Z.value=[]}finally{B(!1)}})()})(),$({onConfirm:()=>{const a=F("Database.tools.index_27"),t=F("Database.tools.index_28");e({text:F("Database.index_30"),title:F("Database.tools.index_29"),content:W.value?a:t,onConfirm:async({hide:a})=>{G(),a()}})}}),(a,e)=>{const s=w,i=t;return D(),g("div",j,[b(s,{type:"warning"},{default:y(()=>[f("span",C,h(a.$t("Database.tools.index_20"))+": ",1),f("span",null,h(a.$t("Database.tools.index_21")),1)]),_:1}),b(i,{class:"mt-16px",loading:v(A),"loading-num":v(P).length,"max-height":300,data:v(Z),columns:v(z)},null,8,["loading","loading-num","data","columns"]),f("div",L,[f("p",null,h(a.$t("Database.tools.index_21")),1),v(W)?k("",!0):(D(),g("p",U,h(a.$t("Database.tools.index_22")),1))])])}}});export{$ as default};
