import{c as a,aA as e,r as l,g as t,q as s,v as n,x as i,z as c,A as m,y as u,e as o,B as r,K as p,C as d,c1 as _,G as g}from"./base-lib.js?v=1761009159";import{iz as v,iA as f,M as x,_ as y}from"./utils-lib.js?v=1761009159";import{p as b}from"./index29.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index105.js?v=1761009159";import"./useMethods.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";const V={class:"flex-wrap p-[2rem]"},j={class:""},w={class:"bg-light p-[2rem] rounded-base"},D={class:"text-medium"},h={class:"mt-[1rem] text-secondary"},k={class:"flex mt8px"},A=["title"],C={class:"max-w-[25rem]"},z={class:"text-base leading-[1.4] max-w-[25rem] truncate"},H={class:"text-small leading-[1.2] text-disabled mt-[1rem]"},I={class:"name"},M=y(a({__name:"pull-image-details-dialog",props:{compData:{default:()=>({name:""})}},setup(a){const y=a;e("popupClose",()=>{});const M=l({id:0,selectValue:"",detail:{name:"",last_updated:"",is_official:!1,pull_count:0}}),S=t(()=>{let a=M.value.detail.pull_count;return a?a.toLocaleString():""}),q=t(()=>"library"===M.value.detail.namespace?"是":"否"),B=l([]),G=a=>{M.value.selectValue=a.tag_name},K=(a,e)=>{(async()=>{await L();const l=B.value,t=M.value.selectValue,s=a===t?l.sort((a,e)=>a.tag_name===t&&e.tag_name!==t?-1:a.tag_name!==t&&e.tag_name===t?1:0):l.filter(e=>e.tag_name.includes(a));e(s)})()},L=async()=>{const{id:a}=M.value,{data:e}=await f({image:y.compData.name,id:a,search:M.value.selectValue}),l=e.data;B.value=l},P=async()=>{const a=M.value.selectValue;if(!a)return x.error("未获取到镜像ID,请选择一个镜像"),!1;await b({name:y.compData.name,tag:a},y.compData.refresh)};return s(async()=>{try{const{data:a}=await v({image:y.compData.name}),e=a.data;M.value.detail=e,M.value.id=e.id,await L()}catch(a){}}),(a,e)=>{const l=_,t=g;return n(),i("div",V,[c("div",j,[c("div",w,[c("strong",D,m(y.compData.name),1),c("ul",h,[c("li",null,[e[1]||(e[1]=c("span",null,"最近一次更新时间：",-1)),c("span",null,m(u(M).detail.last_updated),1)]),c("li",null,[e[2]||(e[2]=c("span",null,"是否为官方镜像：",-1)),c("span",null,m(u(q)),1)]),e[4]||(e[4]=c("li",null,[c("span",null,"来源："),c("span",null,"Docker Hub")],-1)),c("li",null,[e[3]||(e[3]=c("span",null,"Pulls量：",-1)),c("span",null,m(u(S)),1)])])])]),c("div",k,[o(l,{"popper-class":"my-autocomplete",modelValue:u(M).selectValue,"onUpdate:modelValue":e[0]||(e[0]=a=>u(M).selectValue=a),class:"!w-[40rem]","popper-append-to-body":!1,"fetch-suggestions":K,onSelect:G,placeholder:"请选择或搜索镜像"},{default:r(({item:a})=>{var e;return[c("div",{class:p(["flex items-center justify-between py-[1rem]",a.tag_name===u(M).selectValue?" text-primary hover:text-primaryDark":""]),title:"".concat(a.tag_name)},[c("div",C,[c("div",z,m("".concat(a.tag_name)),1),c("div",H,m("".concat((null==(e=a.digest)?void 0:e.slice(0,30))||"")),1)]),c("span",I,m(a.last_updated)+"更新",1)],10,A)]}),_:1},8,["modelValue"]),o(t,{type:"primary",class:"ml-8px",onClick:P},{default:r(()=>e[5]||(e[5]=[d("拉取",-1)])),_:1,__:[5]})])])}}}),[["__scopeId","data-v-01af0ccf"]]);export{M as default};
