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