import{l as e,t as a,x as t,v as s}from"./utils-lib.js?v=20260328163632";import{a5 as l}from"./wsl.js?v=20260328163632";import{a as r}from"./index192.js?v=20260328163632";import{u as i}from"./index50.js?v=20260328163632";import{k as o,r as u,c as n,o as m,V as p,W as c,O as d,Y as y,F as v}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index89.js?v=20260328163632";import"./index91.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./index97.js?v=20260328163632";const x=o({__name:"index",setup(o){const{sid:x,rowData:b}=i(),_=u(""),j=[{content:e("手动关闭的将不会自动启动")}],f={labelStyle:"min-width: 100px"},g=u({formAttrs:{labelWidth:"auto"},formItems:[]}),h=u({label:e("重启策略"),attrs:f,ruleKey:"policy",rules:[{required:!0,message:e("请选择重启策略"),trigger:["blur","change"]}],children:[{key:"policy",type:"select",attrs:{class:"!w-[320px]",options:[{value:"no",label:"不重启"},{value:"unless-stopped",label:"仅非正常退出的时候重启"},{value:"always",label:"停止后马上重启"},{value:"on-failure",label:"失败后重启"}],placeholder:e("请选择重启策略"),"onUpdate:value":e=>{_.value=e}}}]}),w=u({label:e("最大重试计数"),attrs:f,ruleKey:"maximum_retry_count",rules:[{required:!0,message:e("请输入最大重试计数"),trigger:["blur","input"]}],children:[{key:"maximum_retry_count",type:"input",attrs:{class:"!w-[320px]",placeholder:e("请输入最大重试计数")}}]}),k=u({label:" ",attrs:f,children:[{type:"button",key:"save",attrs:{type:"primary",buttonText:e("保存策略"),onClick:()=>O()}}]}),C=n((()=>(g.value.formItems=[h.value,..."on-failure"===_.value?[w.value]:[],k.value],g.value))),[q,I,N]=a(C),O=async()=>{var a;try{await(null==(a=N.value)?void 0:a.validate());const{policy:s,maximum_retry_count:r}=I.value;return(await t({loading:e("正在更新重启策略，请稍后..."),request:l({container_id:b.value.Id,policy:s,..."on-failure"===s?{maximum_retry_count:Number(r)}:{},sid:x.value}),message:!0,success:e=>{H()}})).status}catch(s){}},H=async()=>{const e=await r(),{ContainerJSONBase:{HostConfig:{RestartPolicy:{MaximumRetryCount:a,Name:t}}}}=e.data;Object.assign(I.value,{policy:t||"",maximum_retry_count:a||0}),_.value=t||""};return m((()=>{H()})),(e,a)=>(p(),c(v,null,[d(y(q)),d(y(s),{class:"!pl-20px",options:j})],64))}});export{x as default};
