Files
CloudSearch/source_clean/frontend.bak.old/assets/Cleanup-GlGrtKk0.js

2 lines
7.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as I,o as J,a as f,c as h,f as a,w as s,j as p,i as L,b as u,l as m,y as j,e as y,t as x,h as C,v as i,E as d}from"./index-C5b4pIQL.js";import{m as O,n as q,r as H,o as K,_ as Q}from"./_plugin-vue_export-helper-CzL5NdOX.js";const W={class:"cleanup-section"},X={style:{display:"flex",gap:"10px","flex-wrap":"wrap"}},Y={key:0,class:"cleanup-info",style:{"margin-top":"10px"}},Z={key:0,style:{"margin-left":"16px"}},ee=I({__name:"Cleanup",setup(le){const n=L({}),_=C(!1),v=C(!1),b=C(!1),S=i(()=>String(n.cleanup_last_run||"")),k=i(()=>{const l=String(n.cleanup_last_stats||"");if(!l)return"";try{const e=JSON.parse(l),t=[];return e.filesTrashed>0&&t.push(`移入回收站 ${e.filesTrashed} 个文件夹`),e.logsDeleted>0&&t.push(`删除 ${e.logsDeleted} 条日志`),e.trashEmptied&&t.push("已清空回收站"),e.errors>0&&t.push(`⚠️ ${e.errors} 个错误`),t.join(" / ")||"无操作"}catch{return""}}),T=i({get:()=>String(n.cleanup_enabled)==="true",set:l=>{n.cleanup_enabled=l?"true":"false"}}),E=i({get:()=>String(n.cleanup_empty_trash)!=="false",set:l=>{n.cleanup_empty_trash=l?"true":"false"}}),N=i({get:()=>Number(n.cleanup_file_retention_days??7),set:l=>{n.cleanup_file_retention_days=l}}),U=i({get:()=>Number(n.cleanup_log_retention_days??30),set:l=>{n.cleanup_log_retention_days=l}}),g=i({get:()=>String(n.cleanup_space_threshold_enabled)==="true",set:l=>{n.cleanup_space_threshold_enabled=l?"true":"false"}}),B=i({get:()=>Number(n.cleanup_space_threshold_percent??90),set:l=>{n.cleanup_space_threshold_percent=l}}),D=i({get:()=>Number(n.cleanup_space_threshold_delete_percent??10),set:l=>{n.cleanup_space_threshold_delete_percent=l}}),R=i({get:()=>String(n.save_reuse_enabled)!=="false",set:l=>{n.save_reuse_enabled=l?"true":"false"}});async function z(){try{const l=await O();for(const e of l)n[e.key]=e.value}catch(l){console.error("加载清理配置失败",l)}}async function M(){var l,e;b.value=!0;try{const r=["cleanup_enabled","cleanup_file_retention_days","cleanup_log_retention_days","cleanup_empty_trash","cleanup_space_threshold_enabled","cleanup_space_threshold_percent","cleanup_space_threshold_delete_percent","save_reuse_enabled"].map(c=>({key:c,value:String(n[c]??"")}));await q(r),d.success("清理配置已保存")}catch(t){d.error(((e=(l=t.response)==null?void 0:l.data)==null?void 0:e.error)||"保存失败")}finally{b.value=!1}}async function P(){var l,e;_.value=!0;try{const t=await H();t.success?d.success(t.message):d.warning(t.message),await z()}catch(t){d.error(((e=(l=t.response)==null?void 0:l.data)==null?void 0:e.error)||"清理失败")}finally{_.value=!1}}async function A(){var l,e;v.value=!0;try{const t=await K();t.success?d.success(t.message):d.warning(t.message)}catch(t){d.error(((e=(l=t.response)==null?void 0:l.data)==null?void 0:e.error)||"清空回收站失败")}finally{v.value=!1}}return J(()=>{z()}),(l,e)=>{const t=p("el-switch"),r=p("el-form-item"),c=p("el-input-number"),V=p("el-divider"),$=p("el-slider"),F=p("el-form"),w=p("el-button"),G=p("el-card");return f(),h("div",W,[a(G,{class:"config-card"},{header:s(()=>[...e[8]||(e[8]=[u("span",null,"🧹 存储清理",-1)])]),default:s(()=>[a(F,{"label-width":"160px","label-position":"left",size:"small"},{default:s(()=>[a(r,{label:"启用自动清理"},{default:s(()=>[a(t,{modelValue:T.value,"onUpdate:modelValue":e[0]||(e[0]=o=>T.value=o),"active-text":"启用","inactive-text":"关闭"},null,8,["modelValue"]),e[9]||(e[9]=u("div",{class:"form-tip",style:{"margin-left":"8px"}}," 每天自动检查一次,将过期文件移入回收站、删除旧日志、清空回收站释放空间 ",-1))]),_:1}),a(r,{label:"云盘文件保留天数"},{default:s(()=>[a(c,{modelValue:N.value,"onUpdate:modelValue":e[1]||(e[1]=o=>N.value=o),min:1,max:365,style:{width:"140px"}},null,8,["modelValue"]),e[10]||(e[10]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"超过此天数的日期文件夹将被移入回收站",-1))]),_:1}),a(r,{label:"转存日志保留天数"},{default:s(()=>[a(c,{modelValue:U.value,"onUpdate:modelValue":e[2]||(e[2]=o=>U.value=o),min:1,max:365,style:{width:"140px"}},null,8,["modelValue"]),e[11]||(e[11]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"超过此天数的转存记录将被删除",-1))]),_:1}),a(r,{label:"清空回收站"},{default:s(()=>[a(t,{modelValue:E.value,"onUpdate:modelValue":e[3]||(e[3]=o=>E.value=o),"active-text":"启用","inactive-text":"关闭"},null,8,["modelValue"]),e[12]||(e[12]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"移入回收站后自动清空,永久删除文件以释放存储空间",-1))]),_:1}),a(V,{"content-position":"left"},{default:s(()=>[...e[13]||(e[13]=[m("空间阈值自动清理",-1)])]),_:1}),a(r,{label:"启用空间阈值清理"},{default:s(()=>[a(t,{modelValue:g.value,"onUpdate:modelValue":e[4]||(e[4]=o=>g.value=o),"active-text":"启用","inactive-text":"关闭"},null,8,["modelValue"]),e[14]||(e[14]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"已用空间超过阈值时,按比例删除最旧的转存文件(优先级高于保留天数)",-1))]),_:1}),g.value?(f(),j(r,{key:0,label:"使用阈值"},{default:s(()=>[a($,{modelValue:B.value,"onUpdate:modelValue":e[5]||(e[5]=o=>B.value=o),min:50,max:99,style:{width:"200px"},"show-input":""},null,8,["modelValue"]),e[15]||(e[15]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"已用空间超过此百分比时触发强制清理",-1))]),_:1})):y("",!0),g.value?(f(),j(r,{key:1,label:"删除比例"},{default:s(()=>[a($,{modelValue:D.value,"onUpdate:modelValue":e[6]||(e[6]=o=>D.value=o),min:5,max:50,step:5,style:{width:"200px"},"show-input":""},null,8,["modelValue"]),e[16]||(e[16]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"触发清理时释放总空间的百分比(如 10% 表示累计删除最旧文件直到达到总空间的 10%6TB 总空间 → 释放 ~600GB",-1))]),_:1})):y("",!0),a(V,{"content-position":"left"},{default:s(()=>[...e[17]||(e[17]=[m("分享链接复用",-1)])]),_:1}),a(r,{label:"复用已有分享链接"},{default:s(()=>[a(t,{modelValue:R.value,"onUpdate:modelValue":e[7]||(e[7]=o=>R.value=o),"active-text":"启用","inactive-text":"关闭"},null,8,["modelValue"]),e[18]||(e[18]=u("div",{class:"form-tip",style:{"margin-left":"8px"}},"相同原始链接不再重复转存复用已有分享链接会验证原链接有效性60秒内重复请求直接返回已有链接",-1))]),_:1})]),_:1}),a(V,{"content-position":"left"},{default:s(()=>[...e[19]||(e[19]=[m("手动操作",-1)])]),_:1}),u("div",X,[a(w,{type:"primary",size:"small",loading:b.value,onClick:M},{default:s(()=>[...e[20]||(e[20]=[m("💾 保存清理配置",-1)])]),_:1},8,["loading"]),a(w,{type:"danger",size:"small",loading:_.value,onClick:P},{default:s(()=>[m(x(_.value?"清理中...":"🗑️ 立即清理"),1)]),_:1},8,["loading"]),a(w,{type:"warning",size:"small",loading:v.value,onClick:A},{default:s(()=>[m(x(v.value?"清空中...":"🧹 立即清空回收站"),1)]),_:1},8,["loading"])]),S.value?(f(),h("div",Y,[u("span",null,"⏰ 上次清理:"+x(S.value),1),k.value?(f(),h("span",Z,"📊 "+x(k.value),1)):y("",!0)])):y("",!0)]),_:1})])}}}),ne=Q(ee,[["__scopeId","data-v-96d69897"]]);export{ne as default};