File: /www/server/panel/BTPanel/static/js/useController3.js
import{u as o,k as m,e as d,_ as h,ey as _,w as g}from"./utils-lib.js?v=1777008528";import{aI as f,aJ as v,r as i,Q as y}from"./base-lib.js?v=1777008528";const k=()=>o.post("xterm/get_host_list",{check:"array"}),x=t=>o.post("xterm/create_host",{data:t,check:"msg"}),T=(t,e)=>o.post("xterm/remove_host",{data:{host:t,port:e},check:"msg"}),H=(t,e)=>o.post("xterm/get_host_find",{data:{host:t,port:e},check:"object"}),D=()=>o.post("ssh_security/get_login_record",{check:"object"}),O=t=>{const e=t?"stop_login_record":"start_login_record";return o.post("ssh_security/".concat(e),{check:"msg"})},j=t=>o.post("ssh_security/get_record_list",{data:t,check:"object"}),F=()=>o.post("xterm/get_command_list",{check:"array"}),V=t=>o.post("xterm/create_command",{data:t,check:"msg"}),q=t=>o.post("xterm/modify_command",{data:t,check:"msg"}),w=t=>o.post("xterm/remove_command",{data:{title:t},check:"msg"}),P=()=>o.post("xterm/out_command",{check:"msg"}),J=(t,e)=>o.post("xterm/set_completion_tool_status",{data:{status:t,ai_shell:e},check:"msg"}),N=t=>o.post("xterm/set_ai_shell_status",{data:{status:t},check:"msg"}),$=()=>o.post("xterm/completion_tool_status",{check:"object"}),B=t=>o.post("ssh_security/get_record_video",{data:{record_id:t},check:"object"}),M=t=>o.post("ssh_security/remove_video_record",{data:{record_ids:JSON.stringify(t)},check:"msg"}),z=t=>o.post("xterm/set_terminal_theme",{data:{status:t},check:"msg"}),Q=t=>o.post("xterm/into_command_more",{data:{command_file_path:t},check:"msg"}),G=t=>o.post("xterm/set_ai_shell_analyze",{data:{status:t},check:"msg"}),A=v("TERM-HOST-LIST",()=>{const t=i({}),e=i(!1),s=i(!1),a=i("password"),n=i(!1);return{isEdit:e,rowData:t,$reset:()=>{e.value=!1,s.value=!1,a.value="password"},isTableLoad:s,cutAuthType:a,getHostData:async()=>{const p=await m({loading:s,request:k(),data:Array});return{data:p,total:p.length,other:{}}},isRefreshList:n}}),L=()=>{const t=A();return{...t,...f(t)}},{cutAuthType:R,isEdit:u,rowData:c,isRefreshList:S}=L(),K=(t,e,s)=>{s==null||s.stopPropagation(),c.value=t,d({title:u.value?"编辑主机信息":"添加主机信息",area:48,component:()=>h(()=>import("./add-host.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{rows:t||{},refresh:e},showFooter:!0})},U=t=>{if(u.value||!y(t)||!t.value)return;let e=t.value.host,s,a,n;if(e.indexOf("@")!=-1){let r=e.split("@");if(e=r[1],a=r[0],a.indexOf(":")!=-1){let l=a.split(":");a=l[0],n=l[1]}}if(e.indexOf(":")!=-1){let r=e.split(":");e=r[0],s=r[1]}e&&(t.value.host=e,t.value.ps=e),s&&(t.value.port=Number(s)),a&&(t.value.username=a),n&&(t.value.password=n)},W=(t,e)=>{e();for(const s in t.value)s==="password"&&(t.value[s]="");R.value==="password"?(t.value.pkey="",t.value.pkey_passwd=""):t.value.password=""},b=t=>{let e=t.shell;try{e=JSON.parse(t==null?void 0:t.shell)}catch(s){e=t.shell}t.shell=e},C=async t=>{const{data:e}=await H(t.host,t.port);for(const s in e)s!=="host"&&(t[s]=e[s]);return b(t),e},X=async t=>{try{const{status:e}=await m({loading:"正在"+(u.value?"修改":"创建")+"主机信息,请稍后...",request:x(_(t.value)),data:{status:Boolean,msg:String},message:!0});return S.value=!0,e}catch(e){return!1}},Y=async(t,e,s)=>{s.stopPropagation();try{await g({title:"删除服务器信息【"+t.host+"】",content:"删除选中的信息后,该服务器信息将不在列表中显示,是否继续操作?",icon:"warning-filled"});const{status:a}=await m({loading:"正在删除服务器信息,请稍后...",request:T(t.host,t.port),data:{status:Boolean},message:!0});a&&e()}catch(a){}},Z=async()=>{if(c.value){if(c.value.isLocal)return{...c.value.rows,authType:c.value.rows.pkey?"private":"password"};{const t=await C(c.value);return t.authType=t.pkey?"private":"password",t}}else return{host:"",port:22,username:"root",password:"",pkey:"",pkey_passwd:"",ps:"",authType:"password"}};export{U as a,J as b,W as c,N as d,G as e,z as f,$ as g,K as h,Z as i,Y as j,j as k,D as l,O as m,M as n,B as o,F as p,Q as q,T as r,X as s,P as t,L as u,q as v,V as w,w as x};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}