2024-11-30 00:28:12 +08:00
|
|
|
import{_ as x,D as I,g as B,a as o,c as a,d as l,w as b,b as e,n as k,t as c,f as y,i as u,e as v,m as U,v as G,u as M,j as _,r as N,p as R,T as V,q as p,o as K,s as O,F as S,h as w,W,k as q}from"./index-CV0JZrP5.js";import{L as h}from"./localeText-CNaY6kD6.js";import{C as F}from"./storageMount.vue_vue_type_style_index_0_scoped_5d74c517_lang-yJR54hbP.js";const C={name:"configurationCard",components:{LocaleText:h},props:{c:{Name:String,Status:Boolean,PublicKey:String,PrivateKey:String},delay:String},data(){return{configurationToggling:!1}},setup(){return{dashboardConfigurationStore:I()}},methods:{toggle(){this.configurationToggling=!0,B("/api/toggleWireguardConfiguration/",{configurationName:this.c.Name},n=>{n.status?this.dashboardConfigurationStore.newMessage("Server",`${this.c.Name} ${n.data?"is on":"is off"}`):this.dashboardConfigurationStore.newMessage("Server",n.message,"danger"),this.c.Status=n.data,this.configurationToggling=!1})}}},T=()=>{M(n=>({"1d5189b2":n.delay}))},L=C.setup;C.setup=L?(n,t)=>(T(),L(n,t)):T;const j={class:"card conf_card rounded-3 shadow text-decoration-none"},z={class:"mb-0"},E={class:"card-title mb-0"},H={class:"card-footer d-flex gap-2 flex-column"},Y={class:"row"},A={class:"col-6 col-md-3"},J={class:"text-primary-emphasis col-6 col-md-3"},Q={class:"text-success-emphasis col-6 col-md-3"},X={class:"text-md-end col-6 col-md-3"},Z={class:"d-flex align-items-center gap-2"},ee={class:"text-muted"},te={style:{"word-break":"keep-all"}},se={class:"mb-0 d-block d-lg-inline-block"},oe={style:{"line-break":"anywhere"}},ne={class:"form-check form-switch ms-auto"},ae=["for"],ie={key:4,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},re=["disabled","id"];function le(n,t,s,g,m,r){const d=_("RouterLink"),i=_("LocaleText");return o(),a("div",j,[l(d,{to:"/configuration/"+s.c.Name+"/peers",class:"card-body d-flex align-items-center gap-3 flex-wrap text-decoration-none"},{default:b(()=>[e("h6",z,[e("span",{class:k(["dot",{active:s.c.Status}])},null,2)]),e("h6",E,[e("samp",null,c(s.c.Name),1)]),t[2]||(t[2]=e("h6",{class:"mb-0 ms-auto"},[e("i",{class:"bi bi-chevron-right"})],-1))]),_:1},8,["to"]),e("div",H,[e("div",Y,[e("small",A,[t[3]||(t[3]=e("i",{class:"bi bi-arrow-down-up me-2"},null,-1)),y(c(s.c.DataUsage.Total>0?s.c.DataUsage.Total.toFixed(4):0)+" GB ",1)]),e("small",J,[t[4]||(t[4]=e("i",{class:"bi bi-arrow-down me-2"},null,-1)),y(c(s.c.DataUsage.Receive>0?s.c.DataUsage.Receive.toFixed(4):0)+" GB ",1)]),e("small",Q,[t[5]||(t[5]=e("i",{class:"bi bi-arrow-up me-2"},null,-1)),y(c(s.c.DataUsage.Sent>0?s.c.DataUsage.Sent.toFixed(4):0)+" GB ",1)]),e("small",X,[e("span",{class:k(["dot me-2",{active:s.c.ConnectedPeers>0}])},null,2),y(" "+c(s.c.ConnectedPeers)+" / "+c(s.c.TotalPeers)+" ",1),l(i,{t:"Peers"})])]),e("div",Z,[e("small",ee,[e("strong",te,[l(i,{t:"Public Key"})])]),e("small",se,[e("samp",oe,c(s.c.PublicKey),1)]),e("div",ne,[e("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+s.c.PrivateKey},[!s.c.Status&&this.configurationToggling?(o(),u(i,{key:0,t:"Turning Off..."})):s.c.Status&&this.configurationToggling?(o(),u(i,{key:1,t:"Turning On..."})):s.c.Status&&!this.configurationToggling?(o(),u(i,{key:2,t:"On"})):!s.c.Status&&!this.configurationToggling?(o(),u(i,{key:3,t:"Off"})):v("",!0),this.configurationToggling?(o(),a("span",ie)):v("",!0)],8,ae),U(e("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:this.configurationToggling,type:"checkbox",role:"switch",id:"switch"+s.c.PrivateKey,onChange:t[0]||(t[0]=f=>this.toggle()),"onUpdate:modelValue":t[1]||(t[1]=f=>s.c.Status=f)},null,40,re),[[G,s.c.Status]])])])])])}const ce=x(C,[["render",le],["__scopeId","data-v-a85a04a5"]]),de={class:"text-muted me-2"},ue={class:"fw-bold"},ge={__name:"storageMount",props:{mount:String,percentage:Number,align:Boolean,square:Boolean},setup(n){M(m=>({"703ec95e":g.value}));const t=n,s=N(!1),g=R(()=>t.square?"40px":"25px");return(m,r)=>(o(),a("div",{class:"flex-grow-1 square rounded-3 border position-relative",onMouseenter:r[0]||(r[0]=d=>s.value=!0),onMouseleave:r[1]||(r[1]=d=
|