import{K as e,fa as a,M as s,ar as t}from"./utils-lib.js?v=1761009159";import{c as l,r as o,g as r,e as n,c1 as i,C as u,G as m,a6 as d,v as c,x as p,y as v}from"./base-lib.js?v=1761009159";import{j as _,h as f,b as h,f as b}from"./form-item.js?v=1761009159";import{u as w,c as g,t as j}from"./index62.js?v=1761009159";import{u as x,a as y}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 C={class:"p-[2rem]"},k=l({__name:"index",props:{compData:{default:()=>({nodes:[]})}},setup(l,{expose:k}){const{addNodeData:D,httpRowData:S}=w(),{nodesStatusList:q,testLinkStatus:L}=x(),N=o(l.compData.nodes.map(e=>({label:"".concat(e.label," - ").concat(e.server_ip," (").concat(""==e.version?"本机地址":e.version," ").concat(y(e.version,"9.7.0")<0?"版本较低无法显示站点":"",")"),value:e.value}))),V=o([]),B=o(!1),F=o("");let G=o({path:"/",weight:1,max_fail:5,fail_timeout:10,ps:"",node_status:"online"});const{BtForm:H,submit:K}=e({data:()=>G.value,options:e=>r(()=>[_("负载均衡节点","node_id",N.value,{attrs:{class:"!w-[38rem]",placeholder:"请选择负载均衡节点",onChange:async t=>{B.value=!0,V.value=[],e.value.node_site_name="";try{const{data:e}=await a({node_id:t});e.msg&&!1===e.status&&s.error(e.msg),V.value=e.data.map(e=>({label:e.site_name,value:e.site_id,port:e.ports}))}catch(l){}finally{B.value=!1}}},rules:[{required:!0,message:"请选择负载均衡节点"}]}),f("节点网站",()=>n(i,{modelValue:e.value.node_site_name,"onUpdate:modelValue":a=>e.value.node_site_name=a,"fetch-suggestions":g(V.value),clearable:!0,class:"inline-input !w-[38rem]",onSelect:a=>{var s;let t=[];return F.value=a.value,e.value.node_site_id=a.value,t=null==(s=V.value.find(e=>e.value===a.value))?void 0:s.port,e.value.port=(null==t?void 0:t[1])?t[1]:(null==t?void 0:t[0])||80,a.value},"value-key":"label",placeholder:"请输入或选择网站"},null),"node_site_name",{rules:[{required:!0,message:"请输入或选择节点网站"}]}),h("端口","port",{attrs:{class:"!w-[38rem]",placeholder:"请输入端口"},rules:[t({message:"请输入端口"})]}),h("验证路径","path",{attrs:{class:"!w-[38rem]",placeholder:"请输入验证路径"}}),_("节点算法","node_status",q.value,{attrs:{class:"!w-[38rem]",placeholder:"请输入或选择节点算法"}}),h("权重","weight",{attrs:{class:"!w-[38rem]",placeholder:"请输入权重"}}),h("阈值","max_fail",{attrs:{class:"!w-[38rem]",placeholder:"请输入最大失败次数"}}),h("恢复时间（秒）","fail_timeout",{attrs:{class:"!w-[37.5rem]",placeholder:"请输入恢复时间（秒）"}}),h("备注信息","ps",{attrs:{class:"!w-[38rem]",placeholder:"请输入备注"}}),f("测试连接",()=>n(m,{type:"primary",loading:L.value,onClick:()=>j(e,V.value)},{default:()=>[u("测试连接")]})),b("",[{content:"[节点算法]: 节点在负载均衡中的参与类型，参与：参与负载均衡，备用：无可用节点时启用，停用：停止使用的节点"},{content:"[权重] 当前节点在负载均衡中的节点负载权重，数值越大，使用率越高，请根据节点负载能力设置"},{content:"[阀值] 当负载节点访问故障次数超过指定阀值时，自动暂停此节点"},{content:"[恢复时间] 当负载节点因访问故障被自动暂停后，尝试自动恢复的间隔时间"},{content:"当后端节点返回的http状态码在错误状态码中时，该节点将会被视为处理失败"},{content:"当该节点在恢复时间内失败次数到达阈值后将会自动暂停访问该节点，并在间隔恢复时间时长后再次尝试使用该节点"}],{attrs:{class:"!mt-[1rem]"}})]),submit:async(e,a,s)=>{await a();const t=N.value.find(a=>a.value===e.value.node_id)||"";V.value.some(a=>a.label===e.value.node_site_name)||delete e.value.node_site_id;const{port:l}=e.value,o={node_remarks:t.label.split("-")[0].trim(),...e.value,port:Number(l)};return D.value.push(o),!0}});return k({onConfirm:K}),d(()=>{L.value=!1,F.value=""}),(e,a)=>(c(),p("div",C,[n(v(H))]))}});export{k as default};
