import{K as a,ar as e}from"./utils-lib.js?v=1761009159";import{c as s,r as t,g as r,e as o,C as l,G as i,a6 as n,v as m,x as u,y as p}from"./base-lib.js?v=1761009159";import{j as c,b as d,h as v,f as _}from"./form-item.js?v=1761009159";import{b as f,g as h}from"./index62.js?v=1761009159";import{u as j,a as x}from"./useController10.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./index105.js?v=1761009159";import"./column.js?v=1761009159";import"./index219.js?v=1761009159";const b={class:"p-[2rem]"},g=s({__name:"index",props:{compData:{default:()=>({nodes:[]})}},setup(s,{expose:g}){const{addTcpudpNodeData:w}=f(),{nodesStatusList:C,testLinkStatus:y}=j(),N=t(s.compData.nodes.map(a=>({label:"".concat(a.label," - ").concat(a.server_ip," (").concat(""==a.version?"本机地址":a.version," ").concat(x(a.version,"9.7.0")<0?"版本较低无法显示站点":"",")"),value:a.value,server_ip:a.server_ip}))),D=t(""),{BtForm:k,submit:I}=a({data:()=>({port:80,node_status:"online",weight:1,max_fail:3,fail_timeout:600,ps:""}),options:a=>r(()=>[c("负载均衡节点","node_id",N.value,{attrs:{class:"!w-[40rem]",placeholder:"请选择负载均衡节点",onChange:a=>{var e;D.value=(null==(e=N.value.find(e=>e.value===a))?void 0:e.server_ip)||""}},rules:[{required:!0,message:"负载均衡节点不能为空"}]}),d("端口","port",{attrs:{class:"!w-[40rem]",placeholder:"请输入端口"},rules:[e({message:"请输入端口"})]}),c("节点状态","node_status",C.value,{attrs:{class:"!w-[40rem]",defaultValue:"online"}}),d("权重","weight",{attrs:{class:"!w-[40rem]",placeholder:"请输入权重"}}),d("阈值","max_fail",{attrs:{class:"!w-[40rem]",placeholder:"请输入阈值"}}),d("恢复时间（秒）","fail_timeout",{attrs:{class:"!w-[39.5rem]",placeholder:"请输入恢复时间（秒）"}}),d("备注","ps",{attrs:{class:"!w-[40rem]",placeholder:"请输入备注"}}),v("测试连接",()=>o(i,{type:"primary",loading:y.value,onClick:()=>h({...a.value,host:D.value})},{default:()=>[l("测试连接")]})),_("",[{content:"备份状态: 指当其它节点都无法使用时才会使用此节点"},{content:"参与状态: 正常参与负载均衡,请至少添加1个普通节点"},{content:"IP地址: 仅支持IP地址,否则无法正常参与负载均衡"},{content:"阈值: 在恢复时间的时间段内，如果Nginx与节点通信尝试失败的次数达到此值，Nginx就认为服务器不可用"}],{attrs:{class:"!mt-[1rem]"}})]),submit:async(a,e,s)=>{var t;await e();const r=null==(t=N.value.find(e=>e.value===a.value.node_id))?void 0:t.server_ip,{port:o}=a.value,l={...a.value,port:Number(o),host:r};return w.value=[...w.value,l],!0}});return g({onConfirm:I}),n(()=>{y.value=!1}),(a,e)=>(m(),u("div",b,[o(p(k))]))}});export{g as default};
