import{Z as t,P as s,r as a,e as o,X as e,j as i,F as n}from"./vue.js?v=1763625242172";import{n as c,ao as u,ap as l,aq as r,ah as d,c as _}from"./page_layout.js?v=1763625242172";import{d as k,f as p,j as m,a as f}from"./public.js?v=1763625242172";import{bH as y}from"./naive.js?v=1763625242172";const g=t("diskStore",(()=>{const{t:t}=s(),{loading:g,setLoading:D}=k(),h=a({device:"",mountpoint:"",fstype:"",total:0,used:0,free:0,used_percent:0,inodes_total:0,inodes_used:0,inodes_free:0,inodes_used_percent:0,is_group_quota:!1,is_user_quota:!1,is_default:!1,account_allocate:0,account_percent:0}),v=o({data:[]}),A=a(!1),w=a([{title:t("Account.Disk.disk_810348-0"),key:"mountpoint"},{title:t("Account.Disk.disk_810348-1"),key:"device"},{title:t("Account.Disk.disk_810348-9"),key:"is_group_quota",render:s=>s.is_user_quota?e("span",null,[t("Account.Disk.disk_810348-10")]):e("div",null,[e("span",{class:"text-warning"},[t("Account.Disk.disk_810348-11")]),i(" | "),e("span",{class:"text-primary cursor-pointer",onClick:()=>async function(t){await r(t),j()}(s.mountpoint)},[t("Account.Disk.disk_810348-12")])])},{title:t("Account.Disk.disk_810348-2"),key:"total",width:120,render:t=>c(t.total)},{title:t("Account.Disk.disk_810348-3"),key:"used",render:t=>{const s=Math.round(t.used_percent);return e(n,null,[e("div",{class:"mb-[.2rem]"},[s,i("% / "),c(t.used)]),e(y,{height:10,color:C(s),percentage:s,showIndicator:!1},null)])}},p({title:t("Public.Table.Action"),align:"right",width:200,options:s=>[{label:t("Account.Disk.disk_810348-4"),show:s.is_default&&!A.value,disabled:!0},{label:"重启服务",show:s.is_default&&A.value,type:"warning",onClick:async()=>m()},{label:t("Account.Disk.disk_810348-5"),show:!s.is_default,onClick:async()=>{f({title:t("Account.Disk.disk_810348-6"),content:t("Account.Disk.disk_810348-7",[s.mountpoint]),onConfirm:async()=>{await u({mountpoint:s.mountpoint}),A.value=!0,j()}})}}]})]),b=l();const C=t=>{const s=Math.round(t);return s>80?b.value.errorColor:s>60?b.value.warningColor:b.value.primaryColor},j=async()=>{try{D(!0);const t=await d();if(_(t)){v.data=t.message;const s=t.message.find((t=>t.is_default));if(s){const t={...s};t.account_percent=Math.round(t.account_allocate/t.total*100),h.value=t}}}finally{D(!1)}};return{loading:g,DefaultDisk:h,init:j,columns:w,table:v,diskColor:C}}));export{g as u};
