import{c as e,r as a,o as l,q as t,v as s,x as r,e as m,B as u,y as o,I as i,C as n,J as d,R as p,z as y,ab as c,a9 as f,G as b}from"./base-lib.js?v=1761009159";import{aP as v,P as C,jE as _,ax as x,k as R}from"./utils-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const g={class:"pt-1.6rem"},N=e({__name:"container-reset",setup(e){const{refs:{currentConDetail:N},getCurrentCon:M}=v(),V=a(),j=l({Name:"",MaximumRetryCount:0}),q=[{value:"no",label:"不重启"},{value:"unless-stopped",label:"仅非正常退出的时候重启"},{value:"always",label:"停止后马上重启"},{value:"on-failure",label:"失败后重启"}],w={MaximumRetryCount:[{required:!0,message:"请输入最大重试计数",trigger:["blur"]},{type:"number",message:"请输入正整数",min:0,trigger:["blur"]}]};return t(async()=>{var e,a;j.Name=(null==(e=N.value.HostConfig)?void 0:e.RestartPolicy.Name)||"",j.MaximumRetryCount=(null==(a=N.value.HostConfig)?void 0:a.RestartPolicy.MaximumRetryCount)||0}),(e,a)=>{const l=x,t=c,v=R,P=f,k=b;return s(),r("div",g,[m(P,{ref_key:"cmdFormRef",ref:V,model:o(j),rules:w,onSubmit:a[2]||(a[2]=p(()=>{},["prevent"]))},{default:u(()=>[m(t,{prop:"type",label:"重启策略"},{default:u(()=>[m(l,{modelValue:o(j).Name,"onUpdate:modelValue":a[0]||(a[0]=e=>o(j).Name=e),options:q,class:"!w-[20rem]"},null,8,["modelValue"])]),_:1}),i(m(t,{prop:"MaximumRetryCount",label:"最大重试计数"},{default:u(()=>[m(v,{width:"20rem",type:"number",modelValue:o(j).MaximumRetryCount,"onUpdate:modelValue":a[1]||(a[1]=e=>o(j).MaximumRetryCount=e),modelModifiers:{number:!0},placeholder:"请输入最大重试计数",min:0,textType:"次"},{append:u(()=>a[4]||(a[4]=[n(" 次 ",-1)])),_:1},8,["modelValue"])]),_:1},512),[[d,"on-failure"==o(j).Name]])]),_:1},8,["model"]),m(k,{class:"ml-[10rem]",title:"保存策略",type:"primary",onClick:a[3]||(a[3]=e=>(async()=>{await V.value.validate();const e={id:N.value.Id,restart_policy:{Name:j.Name}};"on-failure"==j.Name&&(e.restart_policy.MaximumRetryCount=Number(j.MaximumRetryCount)),C({loading:"正在保存策略,请稍后...",request:_({data:JSON.stringify(e)}),message:!0,success:async e=>{e.status&&M(N.value.Id)}})})())},{default:u(()=>a[5]||(a[5]=[n("保存策略",-1)])),_:1,__:[5]}),a[6]||(a[6]=y("ul",{class:"tips mt-[3.4rem] list-square ml-[10rem]"},[y("li",{class:"mt-[4px]"},"手动关闭的将不会自动启动")],-1))])}}});export{N as default};
