import{k as e,r as a,t,c as s,o as l,V as r,W as n,X as i,Z as o,Y as d,K as p,O as u,a3 as c,_ as m,j as v,a1 as x,F as k,L as y,H as g,l as f,v as b}from"./base-lib.js?v=20260328163632";import{l as j,x as _,_ as w}from"./utils-lib.js?v=20260328163632";import{u as h,d as C}from"./index50.js?v=20260328163632";import{w as I,x as S,y as N}from"./wsl.js?v=20260328163632";import{a as O}from"./index192.js?v=20260328163632";import{B as A,au as B,aB as P}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index97.js?v=20260328163632";import"./index89.js?v=20260328163632";import"./index91.js?v=20260328163632";import"./index92.js?v=20260328163632";const D={class:"container-dialog"},J={class:"pb-[30px] border-0px border-b-1px border-[var(--border-color)] border-solid"},L={class:"flex items-center ml-[20px]"},H={class:"ml-[1rem]"},M={class:"table ml-[2rem] mt-[2rem]"},R={class:"w-[30%]"},T={key:0,class:"w-[70%] truncate"},V=["onClick"],Y={key:1,class:"h-[5rem] flex items-center"},q=w(e({__name:"index",setup(e){const{sid:w,rowData:q,isRefreshList:E}=h(),F=a(),G=[{key:"name",label:j("容器名称")},{key:"id",label:j("容器ID"),tooltip:!0},{key:"image",label:j("使用的镜像")},{key:"run",label:j("运行时间")},{key:"created",label:j("创建时间")},{key:"start",label:j("启动时间")},{key:"port",label:j("端口"),tag:!0,expand:t(!1)},{key:"ip",label:"IP",tag:!0,expand:t(!1)},{key:"ipv6",label:"IPV6",tag:!0,expand:t(!1)}],K=s((()=>X(F.value))),W=s((()=>{var e,a,t;return null==(t=null==(a=null==(e=F.value)?void 0:e.ContainerJSONBase)?void 0:a.State)?void 0:t.Running})),X=e=>{if(!e)return{name:"正在获取...",id:"正在获取...",run:"正在获取...",created:"正在获取...",start:"正在获取...",image:"正在获取...",port:[],ip:[],ipv6:[]};const{Name:a,Id:t,State:s,Created:l,Image:r}=null==e?void 0:e.ContainerJSONBase,{Ports:n,Networks:i}=null==e?void 0:e.NetworkSettings,o=((e,a)=>{const t=Math.abs(e-a);return Math.floor(t/36e5)})((new Date).getTime(),new Date(null==s?void 0:s.StartedAt).getTime()),d=Object.values(i||{}),p=d.map((e=>e.IPAddress)).filter((e=>""!==e))||[],u=d.map((e=>e.GlobalIPv6Address)).filter((e=>""!==e))||[],c=[];return Object.keys(n).forEach((e=>{c.push(e)})),{name:a,id:t,run:(null==s?void 0:s.StartedAt)?o>0?j("{0}小时",[o]):j("不到1小时"):"--",created:C(l),start:C(null==s?void 0:s.StartedAt),image:r,port:c,ip:p,ipv6:u}},Z=async e=>{const a=j("start"==e?"启动":"stop"==e?"停止":"重启"),t={start:I,stop:S,restart:N};await _({loading:j("正在{0}容器，请稍候...",[a]),request:t[e]({container_id:F.value.ContainerJSONBase.Id,sid:w.value}),message:!0,success:e=>{e.status&&(E.value=!0)}})};return l((async()=>{const e=await O();F.value=e.data})),(e,a)=>{const t=A,s=B,l=P;return r(),n("div",D,[i("div",J,[i("div",L,[i("span",null,o(d(j)("当前状态：")),1),i("span",H,o(d(W)?d(j)("运行中"):d(j)("已停止")),1),i("span",{class:p(d(W)?"svgtofont-icon-start text-primary":"svgtofont-icon-stop text-danger")},null,2)]),u(s,{class:"flex mt-[20px] ml-[20px] !gap-10px"},{default:c((()=>[d(W)?x("",!0):(r(),m(t,{key:0,onClick:a[0]||(a[0]=e=>Z("start"))},{default:c((()=>[v(o(d(j)("启动")),1)])),_:1})),d(W)?(r(),m(t,{key:1,onClick:a[1]||(a[1]=e=>Z("stop"))},{default:c((()=>[v(o(d(j)("停止")),1)])),_:1})):x("",!0),u(t,{onClick:a[2]||(a[2]=e=>Z("restart"))},{default:c((()=>[v(o(d(j)("重启")),1)])),_:1})])),_:1})]),i("div",M,[(r(),n(k,null,y(G,(e=>i("div",{key:e.key,class:"item"},[i("div",R,o(e.label),1),e.tag?x("",!0):(r(),n("div",T,o(d(K)[e.key]),1)),e.tag?(r(),n("div",{key:1,class:p(["w-[70%] relative",{"cursor-pointer":d(K)[e.key].length>("ipv6"===e.key?2:3)}]),onClick:a=>(e=>{var a;!e.tag||(null==(a=K.value[e.key])?void 0:a.length)<=("ipv6"===e.key?2:3)||(e.expand.value=!e.expand.value)})(e)},[d(K)[e.key].length>0?(r(),n("div",{key:0,class:p(["py-[10px] pr-[20px] min-h-[50px] grid gap-[10px]",{"h-[50px]":!e.expand.value,"items-center":!e.expand.value}]),style:g("grid-template-columns: repeat(auto-fill, minmax(".concat("ipv6"===e.key?"160":"130","px, 1fr))"))},[(r(!0),n(k,null,y(d(K)[e.key],((a,t)=>f((r(),m(l,{key:a,class:"custom-success-tag text-center flex-1",type:"info"},{default:c((()=>[v(o(a),1)])),_:2},1536)),[[b,("ipv6"===e.key?t<2:t<3)||e.expand.value]]))),128)),d(K)[e.key].length>("ipv6"===e.key?2:3)?(r(),n("span",{key:0,class:p(["absolute top-[50%] right-[0rem] text-extraLarge",e.expand.value?"svgtofont-el-arrow-up":"svgtofont-el-arrow-down"]),style:{transform:"translateY(-50%)"}},null,2)):x("",!0)],6)):x("",!0),d(K)[e.key].length?x("",!0):(r(),n("div",Y,"--"))],10,V)):x("",!0)]))),64))])])}}}),[["__scopeId","data-v-3a48b9be"]]);export{q as default};
