2025-08-16 17:21:08 +08:00
|
|
|
import{_ as D,g as B,D as N,c as i,a as t,b as r,w as x,h as y,n as m,e as p,t as u,m as U,j as b,d as h,v as I,f as o,p as K,q as G,r as R,s as C,k as V,o as O,x as W,F as w,i as k,T as q,G as L,W as F,y as z}from"./index-B-jc5mKC.js";import{L as S}from"./localeText-DmTH4uVF.js";import{_ as j}from"./protocolBadge-B1YhumvL.js";import{C as E}from"./storageMount.vue_vue_type_style_index_0_scoped_9509d7a0_lang-MKU1bXF1.js";const T={name:"configurationCard",components:{ProtocolBadge:j,LocaleText:S},props:{c:{Name:String,Status:Boolean,PublicKey:String,PrivateKey:String},delay:String,display:String},data(){return{configurationToggling:!1}},setup(){return{dashboardConfigurationStore:N()}},methods:{toggle(){this.configurationToggling=!0,B("/api/toggleWireguardConfiguration",{configurationName:this.c.Name},a=>{a.status?this.dashboardConfigurationStore.newMessage("Server",`${this.c.Name} ${a.data?"is on":"is off"}`):this.dashboardConfigurationStore.newMessage("Server",a.message,"danger"),this.c.Status=a.data,this.configurationToggling=!1})}}},P=()=>{K(a=>({"0d365bfc":a.delay}))},M=T.setup;T.setup=M?(a,s)=>(P(),M(a,s)):P;const H={class:"card conf_card rounded-3 shadow text-decoration-none"},Y={class:"mb-0"},A={class:"card-title mb-0 d-flex align-items-center gap-2"},J={key:0},Q={class:"badge text-bg-info rounded-3 shadow"},X={class:"card-footer d-flex gap-2 flex-column"},Z={class:"row"},tt={class:"d-flex gap-2 align-items-center"},et={class:"text-muted"},st={class:"mb-0 d-block d-lg-inline-block"},ot={style:{"line-break":"anywhere"}},at={class:"form-check form-switch ms-auto"},nt=["for"],it={key:4,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},rt=["disabled","id"];function lt(a,s,e,f,n,g){const d=y("ProtocolBadge"),l=y("RouterLink"),c=y("LocaleText");return o(),i("div",{class:m(["col-12",{"col-lg-6 col-xl-4":this.display==="Grid"}])},[t("div",H,[r(l,{to:"/configuration/"+e.c.Name+"/peers",class:"card-body d-flex align-items-center gap-3 flex-wrap text-decoration-none"},{default:x(()=>[t("h6",Y,[t("span",{class:m(["dot",{active:e.c.Status}])},null,2)]),t("h6",A,[t("samp",null,u(e.c.Name),1),t("small",null,[r(d,{protocol:e.c.Protocol,mini:!0},null,8,["protocol"])]),e.c.Info.Description?(o(),i("small",J,[t("span",Q,[s[2]||(s[2]=t("i",{class:"bi bi-pencil-fill me-2"},null,-1)),p(" "+u(e.c.Info.Description),1)])])):h("",!0)]),s[3]||(s[3]=t("h6",{class:"mb-0 ms-auto"},[t("i",{class:"bi bi-chevron-right"})],-1))]),_:1,__:[3]},8,["to"]),t("div",X,[t("div",Z,[t("small",{class:m(["col-6",{"col-md-3":this.display==="List"}])},[s[4]||(s[4]=t("i",{class:"bi bi-arrow-down-up me-2"},null,-1)),p(u(e.c.DataUsage.Total>0?e.c.DataUsage.Total.toFixed(4):0)+" GB ",1)],2),t("small",{class:m(["text-primary-emphasis col-6",{"col-md-3":this.display==="List"}])},[s[5]||(s[5]=t("i",{class:"bi bi-arrow-down me-2"},null,-1)),p(u(e.c.DataUsage.Receive>0?e.c.DataUsage.Receive.toFixed(4):0)+" GB ",1)],2),t("small",{class:m(["text-success-emphasis col-6",{"col-md-3":this.display==="List"}])},[s[6]||(s[6]=t("i",{class:"bi bi-arrow-up me-2"},null,-1)),p(u(e.c.DataUsage.Sent>0?e.c.DataUsage.Sent.toFixed(4):0)+" GB ",1)],2),t("small",{class:m(["col-6",{"col-md-3 text-md-end ":this.display==="List"}])},[t("span",{class:m(["dot me-2",{active:e.c.ConnectedPeers>0}])},null,2),p(" "+u(e.c.ConnectedPeers)+" / "+u(e.c.TotalPeers)+" ",1),r(c,{t:"Peers"})],2)]),t("div",{class:m(["d-flex gap-2",[this.display==="Grid"?"flex-column":"gap-lg-3 flex-column flex-lg-row"]])},[t("div",tt,[t("small",et,[t("strong",null,[r(c,{t:"Public Key"})])]),t("small",st,[t("samp",ot,u(e.c.PublicKey),1)])]),t("div",at,[t("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+e.c.PrivateKey},[!e.c.Status&&this.configurationToggling?(o(),b(c,{key:0,t:"Turning Off..."})):e.c.Status&&this.configurationToggling?(o(),b(c,{key:1,t:"Turning On..."})):e.c.Status&&!this.configurationToggling?(o(),b(c,{key:2,t:"On"})):!e.c.Status&&!this.configurationToggling?(o(),b(c,{key:3,t:"Off"})):h("",!0),this.configurationToggling?(o(),i("span",it)):h("",!0)],8,nt),U(t("input",{cl
|