import{d as a,h as t,Z as e,u as s}from"./public.js?v=1764830988434";import{aL as i,n as o,d as n,fM as l,x as d,eq as r}from"./page_layout.js?v=1764830988434";import{e as m}from"./file.js?v=1764830988434";import{a as p,_}from"./index.vue_vue_type_script_setup_true_lang12.js?v=1764830988434";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=1764830988434";import{dk as w}from"./naive.js?v=1764830988434";import"./common.js?v=1764830988434";import"./__commonjsHelpers__.js?v=1764830988434";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:U}){const{t:q}=c(),F=x,{ids:H}=F.data,M=U,P=i(),S=u(!0),V=u([]),W=a=>{let t="--";for(let e=0;e<P.remoteList.length;e++){const s=P.remoteList[e];if(s.id===a){t=s.ps||s.db_host;break}}return t},Z=u([{key:"name",title:q("Database.index_12"),ellipsis:{tooltip:{width:"trigger"}}},{key:"total",title:q("Component.UploadFile.index_4"),width:120,render:a=>o(a.total)},{key:"position",title:q("Database.index_19")},{key:"addtime",title:q("Docker.Container.config.status.index_11"),width:160,render:a=>a.addtime},{key:"result",title:q("Database.tools.index_24"),align:"right",width:140,render:a=>a.position!==P.remoteList[0].ps?b("div",{class:"text-error"},[q("Database.tools.index_25")]):b("div",{class:S.value?"":"text-error"},[S.value?q("Database.tools.index_26"):q("Database.tools.index_25")])}]),{loading:z,setLoading:A}=a(),B=async a=>await r(P.type,{name:a.name,id:a.id}),E=()=>{s({title:q("Database.index_30"),hideClose:!0,data:{title:q("Database.index_30"),api:B,data:V.value,callback:G},component:p})},G=a=>{M("close"),P.setRefresh(!0),s({title:q("Database.tools.index_30"),width:440,footer:!0,component:_,data:{title:q("Database.index_30"),data:a,status:"done",columns:[{key:"name",title:q("Database.index_12"),ellipsis:{tooltip:{width:"trigger"}}}]}})};return(async()=>{await(async()=>{const{message:a}=await m();n(a)&&(S.value=a.status_db)})(),(async()=>{try{A(!0);const{message:a}=await l({ids:H});n(a)?V.value=d(a.data)?a.data.map(a=>({...a,position:W(a.sid)})):[]:V.value=[]}finally{A(!1)}})()})(),R({onConfirm:()=>{const a=q("Database.tools.index_27"),t=q("Database.tools.index_28");e({text:q("Database.index_30"),title:q("Database.tools.index_29"),content:S.value?a:t,onConfirm:async({hide:a})=>{E(),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(z),"loading-num":v(H).length,"max-height":300,data:v(V),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(S)?k("",!0):(D(),g("p",$,h(a.$t("Database.tools.index_22")),1))])])}}});export{R as default};
