import{a4 as D,R as y,r,e as h,a0 as a,j as k,F as A}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{C as f,a5 as v,Z as b,i as C,h as w,a6 as q}from"./index-BTglIPU2.js?v=1773287522785";import{u as x}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as F}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{u as M}from"./useRestart-m69F1Jd4.js?v=1773287522785";import{ab as S,u as T}from"./naive-ui--dJnpVcV.js?v=1773287522785";const B=D("diskStore",()=>{const{t:e}=y(),{loading:p,setLoading:c}=F(),l=r({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}),d=h({data:[]}),i=r(!1),m=r([{title:e("Account.Disk.disk_810348-0"),key:"mountpoint"},{title:e("Account.Disk.disk_810348-1"),key:"device"},{title:e("Account.Disk.disk_810348-9"),key:"is_group_quota",render:t=>t.is_user_quota?a("span",null,[e("Account.Disk.disk_810348-10")]):a("div",null,[a("span",{class:"text-warning"},[e("Account.Disk.disk_810348-11")]),k(" | "),a("span",{class:"text-primary cursor-pointer",onClick:()=>g(t.mountpoint)},[e("Account.Disk.disk_810348-12")])])},{title:e("Account.Disk.disk_810348-2"),key:"total",width:120,render:t=>f(t.total)},{title:e("Account.Disk.disk_810348-3"),key:"used",render:t=>{const s=Math.round(t.used_percent);return a(A,null,[a("div",{class:"mb-[.2rem]"},[s,k("% / "),f(t.used)]),a(S,{height:10,color:_(s),percentage:s,showIndicator:!1},null)])}},x({title:e("Public.Table.Action"),align:"right",width:200,options:t=>[{label:e("Account.Disk.disk_810348-4"),show:t.is_default&&!i.value,disabled:!0},{label:"重启服务",show:t.is_default&&i.value,type:"warning",onClick:async()=>M()},{label:e("Account.Disk.disk_810348-5"),show:!t.is_default,onClick:async()=>{w({title:e("Account.Disk.disk_810348-6"),content:e("Account.Disk.disk_810348-7",[t.mountpoint]),onConfirm:async()=>{await q({mountpoint:t.mountpoint}),i.value=!0,u()}})}}]})]),o=T();async function g(t){await v(t),u()}const _=t=>{const s=Math.round(t);return s>80?o.value.errorColor:s>60?o.value.warningColor:o.value.primaryColor},u=async()=>{try{c(!0);const t=await b();if(C(t)){d.data=t.message;const s=t.message.find(n=>n.is_default);if(s){const n={...s};n.account_percent=Math.round(n.account_allocate/n.total*100),l.value=n}}}finally{c(!1)}};return{loading:p,DefaultDisk:l,init:u,columns:m,table:d,diskColor:_}});export{B as u};
