import{_ as a}from"./index105.js?v=1761009159";import{aP as e,M as s,P as t,jC as n,p as i,jD as o,ck as l,ax as r,aB as c,l as d}from"./utils-lib.js?v=1761009159";import{c as m,r as u,o as p,V as _,q as f,H as b,v as y,N as C,B as g,e as h,y as j,C as I,I as w,G as k}from"./base-lib.js?v=1761009159";import{u as v}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const N=m({__name:"container-net",setup(m){const{refs:{currentConDetail:N},getCurrentCon:P}=e(),V=u(),A=p({container_id:""}),W=p({list:[],loading:!1}),q=_([]),x=async()=>{const a={id:A.container_id,container_id:N.value.Id};a.id?t({request:n({data:JSON.stringify(a)}),message:!0,success:async a=>{a.status&&(await P(N.value.Id),D(),A.container_id="")}}):s.error("请选择网络")},D=async()=>{W.loading=!0;const a=Object.entries(N.value.NetworkSettings.Networks),e=[];a.forEach(a=>{e.push({name:a[0],...a[1]})}),W.list=e,W.loading=!1};let M=u([{label:"网络名",prop:"name",minWidth:100},{label:"IPV4地址",prop:"IPAddress",minWidth:100,isCustom:!0},{label:"IPV6地址",prop:"IPAddress6",minWidth:100,isCustom:!1},{label:"网关",prop:"Gateway",minWidth:100,isCustom:!0},{label:"MAC地址",prop:"MacAddress",minWidth:100,isCustom:!0},v([{onClick:async a=>{await i({title:"退出网络【".concat(a.name,"】"),content:"您真的要退出网络【".concat(a.name,"】吗？")});const e={id:a.NetworkID,container_id:N.value.Id};t({request:o({data:JSON.stringify(e)}),message:!0,success:async a=>{a.status&&(await P(N.value.Id),D())}})},width:60,title:"退出网络"}])]);return f(async()=>{D(),t({request:l(),data:Array,success:a=>{q.value=a.map(a=>({label:a.name,value:a.id}))}})}),(e,s)=>{const t=r,n=k,i=c,o=d,l=a,m=b("bt-loading");return y(),C(l,null,{"header-left":g(()=>[h(t,{modelValue:j(A).container_id,"onUpdate:modelValue":s[0]||(s[0]=a=>j(A).container_id=a),options:j(q),class:"!w-[20rem]"},null,8,["modelValue","options"]),h(n,{title:"加入网络",class:"!ml-[1rem]",type:"primary",onClick:x},{default:g(()=>s[1]||(s[1]=[I("加入网络",-1)])),_:1,__:[1]})]),"header-right":g(()=>[h(i,{name:"containerNetColumn",column:j(M),tableRef:j(V)},null,8,["column","tableRef"])]),content:g(()=>[w(h(o,{ref_key:"dockerNetTable",ref:V,column:j(M),data:j(W).list,description:"容器网络列表为空"},null,8,["column","data"]),[[m,j(W).loading],[m,"正在加载容器网络列表，请稍后...","title"]])]),_:1})}}});export{N as default};
