Files
WGDashboard/src/static/dist/WGDashboardAdmin/assets/peerShareLinkModal-DXpwgyyG.js
google-labs-jules[bot] 57652d9f8e Fix: Correct system status indicator layout
The system status indicators (CPU, Storage, Memory, Swap Memory) were not aligned properly, appearing misplaced and cluttered. This was caused by incorrect Bootstrap grid classes, which resulted in a 2x2 layout on medium screens and a 1x4 layout on extra-large screens.

This commit fixes the layout by using the correct Bootstrap grid classes to ensure a responsive layout. The new layout is a 1x4 on large screens, a 2x2 on medium screens, and a 1x1 on small screens. This provides a clean and organized UI across different screen resolutions.

This commit also corrects a typo in the `width` style binding for the Swap Memory progress bar.
2025-11-07 04:48:58 +00:00

2 lines
11 KiB
JavaScript

import{_ as H,r as y,I as N,H as W,c as u,f as o,a as e,d as k,t as M,e as L,b as l,n as w,z as P,g as Y,D as j,J as U,h as S,m as _,y as C,u as $,G as D,v as V,w as B,s as R,j as x,S as A}from"./index-B8BTG8Ck.js";import{d as E}from"./dayjs.min-DBUL_c4Y.js";import{r as J}from"./vue-datepicker-BJv95e-b.js";import{L as h}from"./localeText-B8Zr5hW3.js";import"./index-8zP1UIo9.js";const O={class:"card rounded-0 border-start-0 border-bottom-0 bg-body-secondary",style:{height:"400px",overflow:"scroll"}},q={class:"card-body"},z={key:0,class:"alert alert-danger rounded-3"},G={class:"font-monospace"},F={key:0},K=["innerText"],Q={__name:"peerShareWithEmailBodyPreview",props:["email","selectedPeer"],async setup(s){let t,v;const p=s,d=y(""),b=y(!1),r=y(""),n=async()=>{p.email&&(b.value=!1,await P("/api/email/preview",{Subject:p.email.Subject,Body:p.email.Body,ConfigurationName:p.selectedPeer.configuration.Name,Peer:p.selectedPeer.id},i=>{i.status?d.value=i.data:(d.value="",r.value=i.message),b.value=!i.status}))};[t,v]=N(()=>n()),await t,v();let c;return W(()=>p.email,async()=>{c===void 0?c=setTimeout(async()=>{await n()},500):(clearTimeout(c),c=setTimeout(async()=>{await n()},500))},{deep:!0}),(i,f)=>(o(),u("div",O,[e("div",q,[b.value&&s.email.Body?(o(),u("div",z,[f[0]||(f[0]=e("i",{class:"bi bi-exclamation-triangle-fill me-2"},null,-1)),e("span",G,M(r.value),1)])):k("",!0),e("div",null,[d.value?(o(),u("div",F,[e("strong",null,[l(h,{t:"Subject"}),f[1]||(f[1]=L(": ",-1))]),L(M(d.value.Subject),1)])):k("",!0),f[2]||(f[2]=e("hr",null,null,-1)),e("div",{class:w({"opacity-50":b.value}),innerText:d.value.Body},null,10,K)])])]))}},X=H(Q,[["__scopeId","data-v-1a7765d4"]]),Z={key:0},ee={class:"d-flex mb-3 align-items-center"},te={class:"mb-0 ms-auto"},se={class:"position-relative"},ae=["disabled","placeholder"],ie={class:"position-relative"},oe=["placeholder","disabled"],le={class:"row g-0"},re=["disabled","placeholder"],ne={key:0,class:"col-6"},de={class:"card border-top-0 rounded-top-0 rounded-bottom-3 bg-body-tertiary",style:{border:"var(--bs-border-width) solid var(--bs-border-color)"}},ce={class:"card-body d-flex flex-column gap-2"},ue={class:"form-check form-switch ms-auto"},me={class:"form-check-label",for:"livePreview"},pe={class:"form-check form-switch"},he={class:"form-check-label",for:"includeAttachment"},be=["disabled"],fe={key:0},ve={key:1},ye={key:1},ge={__name:"peerShareWithEmail",props:["dataCopy","selectedPeer"],emits:["fullscreen","hide"],async setup(s,{emit:t}){let v,p;const d=s,b=y(!1);[v,p]=N(()=>Y("/api/email/ready",{},g=>{b.value=g.status})),await v,p();const r=j(),n=U({Receiver:"",Body:r.Configuration.Email.email_template,Subject:"",IncludeAttachment:!1,ConfigurationName:d.selectedPeer.configuration.Name,Peer:d.selectedPeer.id}),c=y(!1),i=y(!1),f=async()=>{i.value=!0,await P("/api/email/send",n,g=>{g.status?r.newMessage("Server","Email sent successfully!","success"):r.newMessage("Server",`Email sent failed! Reason: ${g.message}`,"danger"),i.value=!1})},T=t;return W(c,()=>{T("fullscreen",c.value)}),(g,a)=>{const I=S("RouterLink");return b.value?(o(),u("div",Z,[e("div",ee,[e("a",{role:"button",class:"d-flex text-decoration-none text-body text-muted",onClick:a[0]||(a[0]=m=>T("hide"))},[...a[7]||(a[7]=[e("i",{class:"bi bi-chevron-left me-2"},null,-1),L(" Back ",-1)])]),e("h6",te,[l(h,{t:"Share with Email"})])]),e("form",{class:"d-flex gap-3 flex-column",onSubmit:a[6]||(a[6]=m=>{m.preventDefault(),f()})},[e("div",null,[e("div",se,[a[8]||(a[8]=e("i",{class:"bi bi-person-circle",style:{position:"absolute",top:"0.4rem",left:"0.75rem"}},null,-1)),_(e("input",{type:"email",class:"form-control rounded-top-3 rounded-bottom-0",style:{"padding-left":"calc( 0.75rem + 24px )"},"onUpdate:modelValue":a[1]||(a[1]=m=>n.Receiver=m),disabled:i.value,placeholder:$(D)("Who are you sending to?"),required:"",id:"email_receiver","aria-describedby":"emailHelp"},null,8,ae),[[C,n.Receiver]])]),e("div",ie,[a[9]||(a[9]=e("i",{class:"bi bi-hash",style:{position:"absolute",top:"0.4rem",left:"0.75rem"}},null,-1)),_(e("input",{type:"text",class:"form-control rounded-0 border-top-0 border-bottom-0",style:{"padding-left":"calc( 0.75rem + 24px )"},placeholder:$(D)("What's the subject?"),disabled:i.value,"onUpdate:modelValue":a[2]||(a[2]=m=>n.Subject=m),id:"email_subject","aria-describedby":"emailHelp"},null,8,oe),[[C,n.Subject]])]),e("div",le,[e("div",{class:w([c.value?"col-6":"col-12"])},[_(e("textarea",{class:"form-control rounded-top-0 rounded-bottom-0 font-monospace border-bottom-0","onUpdate:modelValue":a[3]||(a[3]=m=>n.Body=m),disabled:i.value,placeholder:$(D)("What's the body?"),style:{height:"400px","max-height":"400px"}},null,8,re),[[C,n.Body]])],2),c.value?(o(),u("div",ne,[l(X,{email:n,selectedPeer:s.selectedPeer},null,8,["email","selectedPeer"])])):k("",!0)]),e("div",de,[e("div",ce,[e("div",ue,[_(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":a[4]||(a[4]=m=>c.value=m),role:"switch",id:"livePreview"},null,512),[[V,c.value]]),e("label",me,[l(h,{t:"Live Preview"})])])])])]),e("div",pe,[_(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":a[5]||(a[5]=m=>n.IncludeAttachment=m),role:"switch",id:"includeAttachment"},null,512),[[V,n.IncludeAttachment]]),e("label",he,[l(h,{t:"Include configuration file as an attachment"})])]),e("button",{disabled:i.value,class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3"},[i.value?(o(),u("span",ve,[a[11]||(a[11]=e("span",{class:"spinner-border spinner-border-sm me-2"},null,-1)),l(h,{t:"Sending..."})])):(o(),u("span",fe,[a[10]||(a[10]=e("i",{class:"bi bi-send me-2"},null,-1)),l(h,{t:"Send"})]))],8,be)],32)])):(o(),u("div",ye,[e("small",null,[l(h,{t:"SMTP is not configured, please navigate to "}),l(I,{to:"/settings"},{default:B(()=>[l(h,{t:"Settings"})]),_:1}),l(h,{t:" to finish setup"})])]))}}},_e=H(ge,[["__scopeId","data-v-01e380d2"]]),xe={name:"peerShareLinkModal",props:{selectedPeer:Object},components:{PeerShareWithEmail:_e,LocaleText:h,VueDatePicker:J},data(){return{dataCopy:void 0,loading:!1,fullscreen:!1,shareWithEmail:!1}},setup(){return{store:j()}},mounted(){this.dataCopy=JSON.parse(JSON.stringify(this.selectedPeer.ShareLink)).at(0)},watch:{"selectedPeer.ShareLink":{deep:!0,handler(s,t){t.length!==s.length&&(this.dataCopy=JSON.parse(JSON.stringify(this.selectedPeer.ShareLink)).at(0))}}},methods:{startSharing(){this.loading=!0,P("/api/sharePeer/create",{Configuration:this.selectedPeer.configuration.Name,Peer:this.selectedPeer.id,ExpireDate:E().add(7,"d").format("YYYY-MM-DD HH:mm:ss")},s=>{s.status?(this.selectedPeer.ShareLink=s.data,this.dataCopy=s.data.at(0)):this.store.newMessage("Server","Share link failed to create. Reason: "+s.message,"danger"),this.loading=!1})},updateLinkExpireDate(){P("/api/sharePeer/update",this.dataCopy,s=>{s.status?(this.dataCopy=s.data.at(0),this.selectedPeer.ShareLink=s.data,this.store.newMessage("Server","Link expire date updated","success")):this.store.newMessage("Server","Link expire date failed to update. Reason: "+s.message,"danger"),this.loading=!1})},stopSharing(){this.loading=!0,this.dataCopy.ExpireDate=E().format("YYYY-MM-DD HH:mm:ss"),this.updateLinkExpireDate()},parseTime(s){s?this.dataCopy.ExpireDate=E(s).format("YYYY-MM-DD HH:mm:ss"):this.dataCopy.ExpireDate=void 0,this.updateLinkExpireDate()}},computed:{getUrl(){const s=this.store.getActiveCrossServer();return s?`${s.host}/${this.$router.resolve({path:"/share",query:{ShareID:this.dataCopy.ShareID}}).href}`:window.location.origin+window.location.pathname+this.$router.resolve({path:"/share",query:{ShareID:this.dataCopy.ShareID}}).href}}},Se={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},ke={class:"container d-flex h-100 w-100"},we={class:"card rounded-3 shadow flex-grow-1"},Pe={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},Ce={class:"mb-0"},$e={key:0,class:"card-body px-4 pb-4"},De={key:0},Ee={class:"mb-3 text-muted"},Me=["disabled"],Le={key:1},Be={key:0},He={class:"d-flex gap-2 mb-4"},Te=["href"],Ve={class:"d-flex flex-column gap-2 mb-3"},Ne={class:"d-flex gap-2 flex-column flex-sm-row"},We=["disabled"],je={class:"text-muted"};function Ie(s,t,v,p,d,b){const r=S("LocaleText"),n=S("VueDatePicker"),c=S("PeerShareWithEmail");return o(),u("div",Se,[e("div",ke,[e("div",{class:"m-auto modal-dialog-centered dashboardModal",style:R([this.fullscreen?"width: 100%":"width: 700px"])},[e("div",we,[e("div",Pe,[e("h4",Ce,[l(r,{t:"Share Peer"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=i=>this.$emit("close"))})]),this.selectedPeer.ShareLink?(o(),u("div",$e,[this.dataCopy?(o(),u("div",Le,[d.shareWithEmail?(o(),x(A,{key:1},{fallback:B(()=>[e("h6",je,[t[11]||(t[11]=e("span",{class:"spinner-border me-2 spinner-border-sm",role:"status"},null,-1)),l(r,{t:"Checking SMTP Configuration..."})])]),default:B(()=>[l(c,{onHide:t[4]||(t[4]=i=>d.shareWithEmail=!1),onFullscreen:t[5]||(t[5]=i=>{this.fullscreen=i}),selectedPeer:v.selectedPeer,dataCopy:d.dataCopy},null,8,["selectedPeer","dataCopy"])]),_:1})):(o(),u("div",Be,[e("div",He,[t[7]||(t[7]=e("i",{class:"bi bi-link-45deg"},null,-1)),e("a",{href:this.getUrl,class:"text-decoration-none",target:"_blank"},M(b.getUrl),9,Te)]),e("div",Ve,[e("small",null,[t[8]||(t[8]=e("i",{class:"bi bi-calendar me-2"},null,-1)),l(r,{t:"Expire At"})]),l(n,{is24:!0,"min-date":new Date,"model-value":this.dataCopy.ExpireDate,"onUpdate:modelValue":this.parseTime,"time-picker-inline":"",format:"yyyy-MM-dd HH:mm:ss","preview-format":"yyyy-MM-dd HH:mm:ss",dark:this.store.Configuration.Server.dashboard_theme==="dark"},null,8,["min-date","model-value","onUpdate:modelValue","dark"])]),e("div",Ne,[e("button",{style:{flex:"1 1 0"},onClick:t[2]||(t[2]=i=>this.stopSharing()),disabled:this.loading,class:"w-100 btn bg-danger-subtle text-danger-emphasis border-1 border-danger-subtle rounded-3 shadow-sm"},[e("span",{class:w({"animate__animated animate__flash animate__infinite animate__slower":this.loading})},[...t[9]||(t[9]=[e("i",{class:"bi bi-send-slash-fill me-2"},null,-1)])],2),this.loading?(o(),x(r,{key:0,t:"Stop Sharing..."})):(o(),x(r,{key:1,t:"Stop Sharing"}))],8,We),e("button",{style:{flex:"1 1 0"},onClick:t[3]||(t[3]=i=>d.shareWithEmail=!0),class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3"},[t[10]||(t[10]=e("i",{class:"bi bi-envelope me-2"},null,-1)),l(r,{t:"Share with Email"})])])]))])):(o(),u("div",De,[e("h6",Ee,[l(r,{t:"Currently the peer is not sharing"})]),e("button",{onClick:t[1]||(t[1]=i=>this.startSharing()),disabled:this.loading,class:"w-100 btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm"},[e("span",{class:w({"animate__animated animate__flash animate__infinite animate__slower":this.loading})},[...t[6]||(t[6]=[e("i",{class:"bi bi-send-fill me-2"},null,-1)])],2),this.loading?(o(),x(r,{key:0,t:"Sharing..."})):(o(),x(r,{key:1,t:"Start Sharing"}))],8,Me)]))])):k("",!0)])],4)])])}const Oe=H(xe,[["render",Ie]]);export{Oe as default};