import{c as e,r as s,h as l,o as t,k as a,l as i,e as p,x as r,y as o,q as u,p as m,C as n,D as _,N as d,a7 as c,a4 as b}from"./base-lib.js?v=1761009159";import{ak as y,M as v,I as f,W as g,j as h,e as z}from"./utils-lib.js?v=1761009159";import{bb as V}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const x={class:"container-dialog"},w={class:"flex items-center"},N={class:"tips mt-[1.6rem] list-square ml-[2rem]"},k={class:"mt-[.5rem]"},q=z(e({__name:"log-cut-config",props:{compData:{default:()=>({})}},emits:["close"],setup(e,{expose:z,emit:q}){const j=e,D=q,T=s({}),U=l({split_type:"size",split_hour:2,split_minute:0,save:"180",split_size:"10.00"}),C=s(),M={split_hour:[{required:!0,message:"请输入小时",trigger:"blur"}],split_minute:[{required:!0,message:"请输入分钟",trigger:"blur"}],save:[{required:!0,message:"请输入保留数量",trigger:"blur"}],split_size:[{required:!0,message:"请输入日志大小",trigger:"blur"}]},S=[{value:"size",label:"按日志大小"},{value:"day",label:"按执行时间"}],B=async e=>{y("Path","/var/lib/docker/containers/history_logs"),window.location.href=window.location.origin+"/files"};t((()=>{T.value=j.compData.data.value,U.split_type=T.value.split_type,U.split_size=T.value.split_size,U.split_hour=T.value.split_hour,U.split_minute=T.value.split_minute,U.save=T.value.save}));return z({onConfirm:async()=>{if("size"===U.split_type){if(Number(U.split_hour)<0)return void v.error("请填写正确的大小")}else{if(Number(U.split_hour)>23||Number(U.split_hour)<0)return void v.error("请填写正确的小时");if(Number(U.split_minute)>59||Number(U.split_minute)<0)return void v.error("请填写正确的分钟")}Number(U.save)>1800||Number(U.save)<0?v.error("请填写正确的保留份数（1-1800）"):f({loading:"正在设置...",request:V({data:JSON.stringify({pid:j.compData.id,type:"add",log_path:j.compData.path,split_type:U.split_type,split_size:U.split_size,split_hour:U.split_hour,split_minute:U.split_minute,save:U.save})}),message:!0,success:({status:e})=>{e&&D("close")}})}}),(e,s)=>{const l=c,t=g,y=h,v=b;return a(),i("div",x,[p(v,{ref_key:"manualFormRef",ref:C,size:"small",model:m(U),rules:M,class:"relative w-full","label-position":"right",onSubmit:s[5]||(s[5]=d((()=>{}),["prevent"]))},{default:r((()=>[p(l,{prop:"name",label:"切割路径"},{default:r((()=>[s[6]||(s[6]=o(" /var/lib/docker/containers/history_logs ")),u("span",{class:"bt-link text-[1.2rem] ml-[1rem]",onClick:B},"打开目录")])),_:1}),p(l,{prop:"split_type",label:"切割方式"},{default:r((()=>[p(t,{modelValue:m(U).split_type,"onUpdate:modelValue":s[0]||(s[0]=e=>m(U).split_type=e),options:S},null,8,["modelValue"])])),_:1}),n(p(l,{prop:"split_hour",label:"执行时间"},{default:r((()=>[u("div",w,[p(y,{prependText:"每天",type:"number",min:0,max:23,modelValue:m(U).split_hour,"onUpdate:modelValue":s[1]||(s[1]=e=>m(U).split_hour=e),class:"!w-[18rem] mr-[1rem]",textType:"时"},{prepend:r((()=>s[7]||(s[7]=[o("每天")]))),append:r((()=>s[8]||(s[8]=[o("时")]))),_:1},8,["modelValue"]),p(l,{prop:"split_minute",class:"!mb-0",label:""},{default:r((()=>[p(y,{modelValue:m(U).split_minute,"onUpdate:modelValue":s[2]||(s[2]=e=>m(U).split_minute=e),class:"!w-[14rem]",textType:"分",type:"number",min:0,max:59},{append:r((()=>s[9]||(s[9]=[o("分")]))),_:1},8,["modelValue"])])),_:1})])])),_:1},512),[[_,"day"===m(U).split_type]]),n(p(l,{prop:"split_size",label:"日志大小"},{default:r((()=>[p(y,{modelValue:m(U).split_size,"onUpdate:modelValue":s[3]||(s[3]=e=>m(U).split_size=e),class:"!w-[15rem]",textType:"MB",type:"number",min:.1},{append:r((()=>s[10]||(s[10]=[o("MB")]))),_:1},8,["modelValue"])])),_:1},512),[[_,"size"===m(U).split_type]]),p(l,{label:"保留最新",prop:"save"},{default:r((()=>[p(y,{modelValue:m(U).save,"onUpdate:modelValue":s[4]||(s[4]=e=>m(U).save=e),class:"!w-[12rem]",textType:"份"},{append:r((()=>s[11]||(s[11]=[o("份")]))),_:1},8,["modelValue"])])),_:1})])),_:1},8,["model"]),u("ul",N,[n(u("li",null,"每5分钟执行一次",512),[[_,"day"===m(U).split_type]]),n(u("li",k,"【日志大小】：日志文件大小超过指定大小时进行切割日志文件",512),[[_,"size"===m(U).split_type]]),s[12]||(s[12]=u("li",{class:"mt-[.5rem]"},"【保留最新】：保留最新的日志文件，超过指定数量时，将自动删除旧的日志文件",-1))])])}}}),[["__scopeId","data-v-fb4e8f61"]]);export{q as default};
