2025-09-16 02:29:21 +08:00
|
|
|
import{B as D,q as V,r as h,c as i,a as e,d as _,t as x,F as C,i as N,b as o,w as B,h as M,n as L,u as w,f as l,e as I,m as O,y as U,j as A,D as z,z as E,L as G,J as T,H as q,I as H,K as J,g as K,_ as W}from"./index-B_FN5WmC.js";import{D as j}from"./DashboardClientAssignmentStore-B1hEb4Vg.js";import{L as r}from"./localeText-B3I6AP1L.js";const Y={class:"card rounded-0 border-0"},Q={role:"button",class:"ms-auto text-white"},X={key:0,class:"bi bi-chevron-compact-down"},Z={key:1,class:"bi bi-chevron-compact-up"},ee={key:0,class:"card-body p-0"},se={class:"list-group list-group-flush"},te={key:0},le={class:"text-body"},ne={class:"text-muted"},ie={key:1},ae={class:"text-body"},oe={class:"text-muted"},re=["onClick"],de=["onClick"],R=D({__name:"availablePeersGroup",props:["configuration","peers","clientAssignedPeers","availablePeerSearchString"],emits:["assign","unassign"],setup(c,{emit:k}){const a=c,f=k,d=j(),b=V(()=>a.clientAssignedPeers&&Object.keys(a.clientAssignedPeers).includes(a.configuration)?a.peers.filter(n=>!a.clientAssignedPeers[a.configuration].map(t=>t.id).includes(n.id)&&(!a.availablePeerSearchString||a.availablePeerSearchString&&(n.id.includes(a.availablePeerSearchString)||n.name.includes(a.availablePeerSearchString)))):a.availablePeerSearchString?a.peers.filter(n=>n.id.includes(a.availablePeerSearchString)||n.name.includes(a.availablePeerSearchString)):a.peers),p=h(!1),v=h(!1);return(n,t)=>{const g=M("RouterLink");return l(),i("div",Y,[e("div",{onClick:t[0]||(t[0]=s=>v.value=!v.value),role:"button",class:"card-header rounded-0 sticky-top z-5 bg-body-secondary border-0 border-bottom text-white d-flex"},[e("small",null,[e("samp",null,x(c.configuration),1)]),e("a",Q,[v.value?(l(),i("i",X)):(l(),i("i",Z))])]),v.value?_("",!0):(l(),i("div",ee,[e("div",se,[(l(!0),i(C,null,N(b.value,s=>(l(),i("div",{class:"list-group-item d-flex border-bottom list-group-item-action d-flex align-items-center gap-3",key:s.id},[p.value?(l(),i("div",ie,[e("small",ae,[o(r,{t:"Are you sure to remove this peer?"})]),t[2]||(t[2]=e("br",null,null,-1)),e("small",oe,[e("samp",null,x(s.id),1)])])):(l(),i("div",te,[e("small",le,[o(g,{class:"text-decoration-none",target:"_blank",to:"/configuration/"+c.configuration+"/peers?id="+encodeURIComponent(s.id)},{default:B(()=>[e("samp",null,x(s.id),1)]),_:2},1032,["to"])]),t[1]||(t[1]=e("br",null,null,-1)),e("small",ne,x(s.name?s.name:"Untitled Peer"),1)])),c.clientAssignedPeers?(l(),i("button",{key:2,onClick:m=>f("assign",s.id),class:L([{disabled:w(d).assigning},"btn bg-success-subtle text-success-emphasis ms-auto"])},t[3]||(t[3]=[e("i",{class:"bi bi-plus-circle-fill"},null,-1)]),10,re)):(l(),i("button",{key:3,onClick:m=>f("unassign",s.assignment_id),class:L([{disabled:w(d).unassigning},"btn bg-danger-subtle text-danger-emphasis ms-auto"]),"aria-label":"Delete Assignment"},t[4]||(t[4]=[e("i",{class:"bi bi-trash-fill"},null,-1)]),10,de))]))),128))])]))])}}}),ce={key:0,class:"d-flex rounded-0 border-0 flex-column d-flex flex-column border-bottom pb-1"},ue={class:"d-flex flex-column p-3 gap-3"},me={class:"d-flex align-items-center"},be={class:"mb-0"},ge={class:"text-bg-primary badge ms-2"},ve={class:"text-bg-info badge ms-2"},fe={class:"rounded-3 availablePeers border h-100 overflow-scroll flex-grow-1 d-flex flex-column"},pe={key:0,class:"text-muted m-auto p-3"},he={key:0,style:{height:"500px"},class:"d-flex flex-column p-3"},xe={class:"availablePeers border h-100 card rounded-3"},ye={class:"card-header sticky-top p-3"},_e={class:"mb-0 d-flex align-items-center"},ke={class:"card-body p-0 overflow-scroll"},Ce={key:0,class:"text-muted m-auto"},Pe={class:"card-footer d-flex gap-2 p-3 align-items-center justify-content-end"},Se={key:1},$e=D({__name:"clientAssignedPeers",props:["client","clientAssignedPeers"],emits:["refresh"],setup(c,{emit:k}){const a=c,f=h(!1),d=j(),b=h(!1),p=k,v=async(g,s,m)=>{await d.assignClient(g,s,m,!1),p("refresh")},n=async g=>{await d.unassignClient(void 0,void 0,g),p("refresh")},t=h("");return(g,s)=>(l(),i("div",null,[f.value?(l(),i("div",Se,s[6]||(s[6]=[e("div",{class:"p-3 placeholder-
|