File: /www/server/panel/BTPanel/static/js/index17.js
import{_ as O}from"./index206.js?v=1777008528";import{r,g as m,e as f,c as R,x as K,o as A,j as S,k as C,p as c,q as d,s as q,y as E,C as D,aV as z,aX as j}from"./base-lib.js?v=1777008528";import{w as H,M as w,e as k,_ as M,G as x,k as J,X as G,fa as X,Y as Q,cZ as U}from"./utils-lib.js?v=1777008528";import{F as h,a as Y,b as P,c as Z,d as $,f as B}from"./form-item.js?v=1777008528";import{P as W,Q as N,R as ee,S as te,L as se}from"./config.js?v=1777008528";import{d as ae}from"./useMethod.js?v=1777008528";import{a as re}from"./useController3.js?v=1777008528";const y=r({last_update:"",total_time:"",start_time:"",panel_addr:"",panel_user:"",panel_password:"",panel_port:""});r("计算中...");r("计算中...");r({total:0,use:0});const L=r({}),oe=r([]),s=r({status:0,progress:0,msg:"准备开始迁移",progressLog:"",remain_time:100}),b=r(!1),Ee=[{type:"index"},{label:"失败项",prop:"name"},{label:"失败原因",prop:"msg",width:320,render:e=>f("span",{class:"text-dangerDark"},[e.msg])}],I=r({}),le=async e=>{I.value=e;try{await H({title:"整机迁移提醒",content:"迁移至目标服务器【"+e.server_ip+"】,迁移过程中网站访问受影响,是否继续操作?",type:"calc"}),b.value=!0,T();const a=w.load("正在检查目标服务器连接,请稍后..."),n=await W(e);if(a.close(),n.status){let i=w.load("正在开始迁移,请稍后...");const u=await N({...e,...L.value});i.close(),u.status?(s.value.status=0,s.value.msg="准备迁移中...",s.value.progress=0,s.value.progressLog="",F()):w.error(u.msg)}else w.error(n.msg)}catch(a){}},Pe=async()=>{try{T(),s.value.status=1,b.value=!0;const e=await N(I.value);s.value.msg="准备迁移中...",s.value.progress=0,s.value.progressLog="",F()}catch(e){}},ne=()=>(L.value={},ae.value.operateType="add",k({area:84,title:"设置迁移数据",component:()=>M(()=>import("./index450.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{saveConfig:(e,a,n,i)=>{const u={site:"site",database:"database",wptools:"wp_tools",plugin:"plugin",runtime:"soft",Ftp:"ftp",Crontab:"crontab",Vmail:"vmail",Terminal:"ssh",Firewall:"firewall",node:"node"},p=[];Object.entries(a).map(([t,o])=>{if(t==="database"&&i.length>0){p.push(u[t]);return}if(t==="site"&&n.length>0){p.push(u[t]);return}o&&p.push(u[t])}),L.value={site_id:JSON.stringify(n.map(t=>t.id)),database_id:JSON.stringify(i.map(t=>t.id)),backup_data:JSON.stringify(p)}}},btn:["确定","取消"],showFooter:!0})),ie=r([]);m(()=>x(ie.value.reduce((e,a)=>e+Number(a.size),0)));const ue=r([]);m(()=>x(ue.value.reduce((e,a)=>e+Number(a.size),0)));const ce=r([]);m(()=>x(ce.value.reduce((e,a)=>e+Number(a.size),0)));r([]);const pe=r([]);m(()=>x(pe.value.reduce((e,a)=>e+Number(a.size),0)));r({ftpList:[],crontabList:[],termList:[],firewallList:[]});r({site:!0,database:!0,ftp:!0,crontab:!0,terminal:!0,firewall:!0,wptools:!0,plugin:!0,runtime:!0});m(()=>({Ftp:{title:"FTP",icon:"ftp",dataKey:"ftpList",loadingKey:"Ftp",tooltip:"仅备份FTP账号和密码,不备份FTP目录"},Crontab:{title:"计划任务",icon:"crontab",dataKey:"crontabList",loadingKey:"Crontab"},Terminal:{title:"终端",icon:"xterm",dataKey:"termList",loadingKey:"Terminal"},Firewall:{title:"系统防火墙",icon:"firewall",dataKey:"firewallList",loadingKey:"Firewall"}}));const de=async()=>{try{const{data:e}=await ee();T(),e.data.task_status&&(b.value=!0,F())}catch(e){}},T=()=>{s.value={status:0,progress:0,msg:"准备开始迁移",progressLog:"",remain_time:100}},F=async()=>{try{const{data:e}=await te();if(s.value.progress=e.data.migrate_progress,s.value.progressLog=e.data.migrate_log,s.value.msg=e.data.migrate_msg,s.value.status=e.data.run_status,e.data.run_status!==2&&e.data.run_status!==3)setTimeout(()=>{F()},1e3);else{if(e.data.run_status===2||(oe.value=e.data.err_info),y.value=e.data,e.data.task_info.panel_info){const{panel_url:a,password:n,username:i}=e.data.task_info.panel_info;y.value.panel_addr=a,y.value.panel_user=i,y.value.panel_password=n}b.value=!1,ge()}}catch(e){}},V=async(e=!0)=>{e&&await H({title:"取消迁移",content:"取消迁移后,迁移任务将被删除,是否继续操作?"}),J({loading:"正在取消迁移,请稍后...",request:se(),message:!0,success:a=>{w.success("迁移任务已取消"),b.value=!1,s.value.status=0,s.value.msg="准备开始迁移",s.value.progress=0,s.value.progressLog=""}})},me=()=>{k({area:60,title:"迁移历史",component:()=>M(()=>import("./migrate-history.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})},ge=()=>{k({area:60,title:!1,component:()=>M(()=>import("./migrate-progress.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})},_e={class:""},ve={class:"p-2rem"},fe={class:"w-[56rem]"},we={key:0,class:"flex-col flex"},be={class:"text-base"},he={class:"mb-1.2rem mt-[0.4rem] flex items-center"},ye=R({__name:"index",setup(e){const a=[{label:"密码认证",value:"password"},{label:"私钥验证",value:"key"}],n=(t,o,g,l)=>{g?l():l(new Error(t.value.auth_type==="password"?"请输入SSH密码":"请输入SSH私钥"))},{BtForm:i,submit:u,ref:p}=G({data:()=>({auth_type:"password",server_ip:"",ssh_port:"22",ssh_user:"",password:""}),options:t=>m(()=>{const o=[h("密码","password",{attrs:{placeholder:"请输入SSH密码",class:"mr-4 !w-[275px]"},rules:[{required:!0,validator:(l,_,v)=>n(t,l,_,v),trigger:["change","blur"]}]})],g=[Y("私钥","password",{attrs:{placeholder:"请输入SSH私钥",class:"mr-4 !w-[275px]",autosize:{minRows:4,maxRows:4}},rules:[{required:!0,validator:(l,_,v)=>n(t,l,_,v),trigger:["change","blur"]}]})];return[P([h("服务器IP","server_ip",{attrs:{class:"mr-[8px] !w-[180px]",placeholder:"请输入服务器IP",onInput:()=>{t.value.ps=t.value.server_ip},onBlur:()=>re(t)},rules:[{required:!0,message:"请输入服务器IP",trigger:["change","blur"]},X()]}),h("端口","ssh_port",{attrs:{placeholder:"请输入端口",class:"!w-[84px]"},rules:[{required:!0,message:"请输入端口",trigger:["change","blur"]},Q()]})]),h("账号","ssh_user",{attrs:{placeholder:"请输入SSH账号",class:"mr-4 !w-[275px]"},rules:[{required:!0,message:"请输入SSH账号",trigger:["change","blur"]}]}),Z("验证方式","auth_type",a,{attrs:{class:"mr-4 !w-[275px]",onChange:()=>{var l;t.value.password="",(l=p.value)==null||l.clearValidate()}}}),...(t==null?void 0:t.value.auth_type)==="password"?o:g,$("",[{content:"请在上方输入目标服务器的root账号信息进行迁移"},{content:"迁移后本机旧数据仍然存在"},{content:f("span",{class:"bt-link",onClick:ne},[K("点击选择迁移数据(默认为全部)")])}],{attrs:{class:"ml-[6rem]"}}),P([B("迁移记录",{attrs:{class:"ml-[4rem]",onClick:me}}),B("开始迁移",{attrs:{class:"ml-[40rem]",type:"primary",onClick:u}})])]}),submit:async(t,o)=>{await o(),le(t.value)}});return A(()=>{de()}),(t,o)=>{const g=z,l=j,_=O;return S(),C("div",_e,[f(g,{class:"!mb-[1.2rem] !text-small","show-icon":"",title:"整机迁移会自动安装宝塔面板,建议使用【全新机器】进行迁移,如有数据将会覆盖,支持不同系统之间进行迁移!",closable:!1,type:"warning"}),f(c(i)),d("div",ve,[d("div",fe,[c(s).status===1?(S(),C("div",we,[o[1]||(o[1]=d("span",{class:"text-secondary font-bold text-base mb-[2rem]"},"迁移进度",-1)),d("span",be,q(c(s).msg),1),d("div",he,[f(l,{class:"w-full","text-inside":!0,"stroke-width":20,percentage:c(s).progress,status:"success"},null,8,["percentage"]),d("i",{class:"svgtofont-el-circle-close text-dangerDark !text-large pl-4px cursor-pointer",onClick:o[0]||(o[0]=(...v)=>c(V)&&c(V)(...v))})])])):E("",!0),c(s).status===1?(S(),D(_,{key:1,class:"h-22rem !rounded-none w-[56rem] mt-[2rem]",content:c(s).progressLog,fullScreen:{title:"全屏查看日志",onRefresh:()=>{}}},null,8,["content"])):E("",!0)])])])}}}),xe=U(ye,[["__scopeId","data-v-11ad9586"]]),Be=Object.freeze(Object.defineProperty({__proto__:null,default:xe},Symbol.toStringTag,{value:"Module"}));export{Ee as a,oe as e,Be as i,s as p,Pe as r,y as s};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}