← Back
Editing: feature-Quota.js
;(() => { const stylesheetSelector = "link[rel=stylesheet]" const loaded = new Set(Array.from(document.querySelectorAll(stylesheetSelector)).map(link => link.href)) const version = "1795169270504" const findLoadedLink = href => Array.from(document.querySelectorAll(stylesheetSelector)).find(link => link.href === href) const removeAfterLoad = (freshLink, staleLink) => { const remove = () => staleLink.remove() if (freshLink.sheet) { requestAnimationFrame(remove) return } freshLink.addEventListener("load", remove, { once: true }) } for (const link of Array.from(document.querySelectorAll(stylesheetSelector))) { const url = new URL(link.href, location.href) if (url.origin !== location.origin || url.searchParams.get("v") === version) continue url.searchParams.set("v", version) if (loaded.has(url.href)) { const freshLink = findLoadedLink(url.href) if (freshLink && freshLink !== link) removeAfterLoad(freshLink, link) continue } const freshLink = document.createElement("link") freshLink.rel = "stylesheet" freshLink.href = url.href link.parentNode?.insertBefore(freshLink, link.nextSibling) loaded.add(url.href) removeAfterLoad(freshLink, link) } })(); import{r as e}from"./rolldown-runtime.js?v=1795169270504";import{An as t,Br as n,Cn as r,En as i,Ln as a,Mn as o,Mr as s,Sn as c,Sr as l,Tn as u,Zn as d,fr as f,gr as p,ii as m,jn as h,kn as g,wn as _,wr as v,zt as y}from"./vendor-utils.js?v=1795169270504";import{l as b}from"./vendor-vue.js?v=1795169270504";import{Ct as x,I as S,T as C,Tt as w,j as T,jt as E,wt as D}from"./vendor-naive.js?v=1795169270504";import{Hf as O,_p as k,pn as A,vn as j}from"./app.js?v=1795169270504";import{na as M}from"./app-components.js?v=1795169270504";import{Hd as N,Vd as P}from"./app-shared.js?v=1795169270504";import{a as F,i as I}from"./vendor-pdf.js?v=1795169270504";a(),p(),n(),F();var L={class:`leading-20px`},R=o({__name:`index`,props:{type:{default:`site`},data:{},callback:{}},setup(e){let{t:n}=b(),a=e,o=c(()=>{let{data:e}=a,{quota:t}=e;return!t.size}),l=c(()=>{if(o.value)return 0;let{data:e}=a,t=y(e,`quota.used`,0),n=y(e,`quota.size`,0);return n=n*1024*1024,n===0?0:t/n*100}),u=c(()=>{let{data:e}=a,t=y(e,`quota.used`,0);return k(t)}),p=c(()=>{let{data:e}=a;return`${y(e,`quota.size`,0).toFixed(2)} MB`}),v=c(()=>l.value<90?`success`:`error`),x=new Map([[`site`,`Site`],[`ftp`,`FTP`],[`database`,`Database`]]),S=()=>{O({title:`${n(`Component.Quota.index_5`,[a.data.name,x.get(a.type)||`--`])}`,width:480,minHeight:222,footer:!0,data:{type:a.type,info:a.data,callback:a.callback},component:h(()=>I(()=>Promise.resolve().then(()=>q),void 0))})};return(e,n)=>{let a=j,c=C,h=E;return s(o)?(d(),_(a,{key:0,onClick:S},{default:f(()=>[g(m(e.$t(`Component.Quota.index_2`)),1)]),_:1})):(d(),i(`div`,{key:1,class:`cursor-pointer`,onClick:S},[t(h,{placement:`bottom-start`,"arrow-point-to-center":!0},{trigger:f(()=>[t(c,{type:`line`,status:s(v),percentage:s(l),height:12,"border-radius":2,"show-indicator":!1},null,8,[`status`,`percentage`])]),default:f(()=>[r(`div`,L,[r(`p`,null,m(e.$t(`Component.Quota.index_3`,[s(u)])),1),r(`p`,null,m(e.$t(`Component.Quota.index_12`,[s(p)])),1),r(`p`,null,m(e.$t(`Component.Quota.index_4`)),1)])]),_:1})]))}}}),z=e({default:()=>B}),B=R;a(),p(),n();var V={class:`px-20px py-24px`},H={class:`w-160px`},U={class:`w-160px`},W={class:`text-error`},G={key:0},K=o({__name:`quota-config`,props:{data:{}},setup(e,{expose:n}){let{type:a,info:o,callback:c}=e.data,p=l({used:`0`,size:0}),h=v(`MB`);return(()=>{let e=y(o,`quota.used`,0);if(e>0){let t=k(e).split(` `);p.used=t[0],h.value=t[1]}p.size=y(o,`quota.size`,0)})(),n({onConfirm:async({hide:e})=>{(a===`site`||a===`ftp`)&&await N({size:p.size,quota_type:a,path:y(o,`path`,``)}),a===`database`&&await P({size:p.size,db_name:y(o,`name`,``)}),c==null||c(),e()}}),(e,n)=>{let o=w,c=x,l=D,_=S,v=T,y=M,b=A;return d(),i(`div`,V,[t(y,{"label-width":`180`},{default:f(()=>[t(_,{label:e.$t(`Component.Quota.index_6`)},{default:f(()=>[r(`div`,H,[t(l,null,{default:f(()=>[t(o,{value:s(p).used,"onUpdate:value":n[0]||(n[0]=e=>s(p).used=e),disabled:!0},null,8,[`value`]),t(c,{class:`w-44px text-center`},{default:f(()=>[g(m(s(h)),1)]),_:1})]),_:1})])]),_:1},8,[`label`]),t(_,{label:e.$t(`Component.Quota.index_7`)},{default:f(()=>[r(`div`,U,[t(l,null,{default:f(()=>[t(v,{value:s(p).size,"onUpdate:value":n[1]||(n[1]=e=>s(p).size=e),min:0,"show-button":!1},null,8,[`value`]),t(c,{class:`w-44px text-center`},{default:f(()=>[...n[2]||(n[2]=[g(`MB`,-1)])]),_:1})]),_:1})])]),_:1},8,[`label`])]),_:1}),t(b,{class:`mt-8px`},{default:f(()=>[r(`li`,W,m(e.$t(`Component.Quota.index_8`)),1),r(`li`,null,m(e.$t(`Component.Quota.index_9`)),1),s(a)===`database`?u(``,!0):(d(),i(`li`,G,m(e.$t(`Component.Quota.index_10`)),1)),r(`li`,null,m(e.$t(`Component.Quota.index_11`)),1)]),_:1})])}}}),q=e({default:()=>J}),J=K;export{z as t};
Save File
Cancel