import{I as a,t as e,k as t,X as n,Q as s,o,b as i}from"./utils-lib.js?v=1761009159";import{_ as l}from"./index103.js?v=1761009159";import{c as r,r as c,h as m,o as d,B as p,k as u,l as f,e as b,x as _,y,C as g,p as w,A as h}from"./base-lib.js?v=1761009159";import{be as j,bf as C,bg as k}from"./useStore4.js?v=1761009159";import{p as v}from"./useMethods.js?v=1761009159";import{h as x,u as q,g as W}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index104.js?v=1761009159";const z={class:"p-[1.6rem]"},A=r({__name:"container-backups-dialog",props:{compData:{default:()=>({})}},setup(r){const A=i(),D=r,I=c(),S=c(D.compData.row),B=m({loading:!1,list:[]}),H=[{label:"删除",value:"delete",event:async(a,e,t,n)=>{const{label:s,value:o}=n,i=async(a,e)=>{const{container_id:t,container_name:n,name:s}=a;if("delete"===o)return await k({data:JSON.stringify({container_id:t,container_name:n,name:s})})};await a({title:"批量".concat(s,"容器备份"),content:"批量".concat(s,"已选的容器备份，删除后备份文件将无法恢复，是否继续操作！"),column:[{label:"文件名",prop:"name"},x()],onConfirm:async()=>(await e(i),O(),!1)})}}],J=async()=>{a({request:j({container_id:S.value.id}),message:!0,success:async a=>{a.status&&(await O(),await v(!0))}})},M=async e=>{try{await o({icon:"warning-filled",title:"删除备份文件",width:"45rem",content:"删除[".concat(e.name,"]备份文件后，该备份文件将永久消失，是否继续操作？")}),a({loading:"正在删除...",request:k({container_id:e.container_id,container_name:e.container_name,name:e.name}),success:async({status:a})=>{a&&(await O(),A.success("删除成功"))},error:a=>{A.request(a)}})}catch(t){console.log(t)}},N=async a=>{window.open("/download?filename="+encodeURIComponent(a.filename))},O=async()=>{B.loading=!0,a({request:C({container_id:S.value.id}),data:Array,success:a=>{B.list=a,B.loading=!1}})},Q=[q(),{label:"文件名",prop:"name",minWidth:140},{label:"存储位置",prop:"filename",minWidth:180,isCustom:!0},{label:"文件大小",prop:"size",minWidth:86,isCustom:!0,render:a=>e(a.size)},{label:"备份时间",prop:"addtime",minWidth:120,isCustom:!0},W([{onClick:N,title:"下载"},{onClick:M,title:"删除"}])];return d((()=>{O()})),(a,e)=>{const o=h,i=t,r=n,c=l,m=s,d=p("bt-loading");return u(),f("div",z,[b(c,null,{"header-left":_((()=>[b(o,{type:"primary",onClick:J},{default:_((()=>e[0]||(e[0]=[y("容器备份")]))),_:1})])),content:_((()=>[g(b(i,{ref_key:"backupTable",ref:I,column:w(Q),"max-height":"220",data:w(B).list,description:"备份列表为空"},null,8,["column","data"]),[[d,w(B).loading],[d,"正在加载镜像列表，请稍后...","title"]])])),"footer-left":_((()=>[b(r,{"table-ref":w(I),options:H},null,8,["table-ref"])])),_:1}),b(m,{class:"mt-[2rem] ml-[1rem]",options:[{content:"备份任务创建成功后后台进行，可以关闭黑色窗口，备份完成可能需要1分钟以上！"}]})])}}});export{A as default};
