mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-03 07:46:18 +00:00
Fixed #644
This commit is contained in:
@@ -15,12 +15,10 @@ export default {
|
|||||||
PeerTagBadge, LocaleText, PeerSettingsDropdown
|
PeerTagBadge, LocaleText, PeerSettingsDropdown
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
Peer: Object, ConfigurationInfo: Object
|
Peer: Object, ConfigurationInfo: Object, order: Number, searchPeersLength: Number
|
||||||
},
|
},
|
||||||
data(){
|
mounted() {
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
setup(){
|
setup(){
|
||||||
const target = ref(null);
|
const target = ref(null);
|
||||||
@@ -37,6 +35,9 @@ export default {
|
|||||||
return this.Peer.latest_handshake.split(",")[0]
|
return this.Peer.latest_handshake.split(",")[0]
|
||||||
}
|
}
|
||||||
return this.Peer.latest_handshake;
|
return this.Peer.latest_handshake;
|
||||||
|
},
|
||||||
|
getDropup(){
|
||||||
|
return this.searchPeersLength - this.order <= 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,7 @@ export default {
|
|||||||
<PeerTagBadge :BackgroundColor="group.BackgroundColor" :GroupName="group.GroupName" :Icon="'bi-' + group.Icon"
|
<PeerTagBadge :BackgroundColor="group.BackgroundColor" :GroupName="group.GroupName" :Icon="'bi-' + group.Icon"
|
||||||
v-for="group in Object.values(ConfigurationInfo.Info.PeerGroups).filter(x => x.Peers.includes(Peer.id))"
|
v-for="group in Object.values(ConfigurationInfo.Info.PeerGroups).filter(x => x.Peers.includes(Peer.id))"
|
||||||
></PeerTagBadge>
|
></PeerTagBadge>
|
||||||
<div class="ms-auto px-2 rounded-3 subMenuBtn"
|
<div class="ms-auto px-2 rounded-3 subMenuBtn position-relative"
|
||||||
:class="{active: this.subMenuOpened}"
|
:class="{active: this.subMenuOpened}"
|
||||||
>
|
>
|
||||||
<a role="button" class="text-body"
|
<a role="button" class="text-body"
|
||||||
@@ -118,6 +119,7 @@ export default {
|
|||||||
</a>
|
</a>
|
||||||
<Transition name="slide-fade">
|
<Transition name="slide-fade">
|
||||||
<PeerSettingsDropdown
|
<PeerSettingsDropdown
|
||||||
|
:dropup="getDropup"
|
||||||
@qrcode="this.$emit('qrcode')"
|
@qrcode="this.$emit('qrcode')"
|
||||||
@configurationFile="this.$emit('configurationFile')"
|
@configurationFile="this.$emit('configurationFile')"
|
||||||
@setting="this.$emit('setting')"
|
@setting="this.$emit('setting')"
|
||||||
|
@@ -205,6 +205,10 @@ const searchPeers = computed(() => {
|
|||||||
}).slice(0, showPeersCount.value)
|
}).slice(0, showPeersCount.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const dropup = (index) => {
|
||||||
|
return searchPeers.value.length - (index + 1) <= 3
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => route.query.id, (newValue) => {
|
watch(() => route.query.id, (newValue) => {
|
||||||
if (newValue){
|
if (newValue){
|
||||||
wireguardConfigurationStore.searchString = newValue
|
wireguardConfigurationStore.searchString = newValue
|
||||||
@@ -384,8 +388,10 @@ watch(() => route.query.id, (newValue) => {
|
|||||||
<div class="col-12"
|
<div class="col-12"
|
||||||
:class="{'col-lg-6 col-xl-4': dashboardStore.Configuration.Server.dashboard_peer_list_display === 'grid'}"
|
:class="{'col-lg-6 col-xl-4': dashboardStore.Configuration.Server.dashboard_peer_list_display === 'grid'}"
|
||||||
:key="peer.id"
|
:key="peer.id"
|
||||||
v-for="peer in searchPeers">
|
v-for="(peer, order) in searchPeers">
|
||||||
<Peer :Peer="peer"
|
<Peer :Peer="peer"
|
||||||
|
:searchPeersLength="searchPeers.length"
|
||||||
|
:order="order"
|
||||||
:ConfigurationInfo="configurationInfo"
|
:ConfigurationInfo="configurationInfo"
|
||||||
@share="configurationModals.peerShare.modalOpen = true; configurationModalSelectedPeer = peer"
|
@share="configurationModals.peerShare.modalOpen = true; configurationModalSelectedPeer = peer"
|
||||||
@refresh="fetchPeerList()"
|
@refresh="fetchPeerList()"
|
||||||
|
@@ -6,6 +6,7 @@ import PeerSettingsDropdownTool
|
|||||||
from "@/components/configurationComponents/peerSettingsDropdownComponents/peerSettingsDropdownTool.vue";
|
from "@/components/configurationComponents/peerSettingsDropdownComponents/peerSettingsDropdownTool.vue";
|
||||||
import PeerTagSelectDropdown
|
import PeerTagSelectDropdown
|
||||||
from "@/components/configurationComponents/peerSettingsDropdownComponents/peerTagSelectDropdown.vue";
|
from "@/components/configurationComponents/peerSettingsDropdownComponents/peerTagSelectDropdown.vue";
|
||||||
|
import {onMounted} from "vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "peerSettingsDropdown",
|
name: "peerSettingsDropdown",
|
||||||
@@ -15,7 +16,7 @@ export default {
|
|||||||
return {dashboardStore}
|
return {dashboardStore}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
Peer: Object, ConfigurationInfo: Object
|
Peer: Object, ConfigurationInfo: Object, dropup: Boolean
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
@@ -23,8 +24,12 @@ export default {
|
|||||||
restrictBtnDisabled: false,
|
restrictBtnDisabled: false,
|
||||||
allowAccessBtnDisabled: false,
|
allowAccessBtnDisabled: false,
|
||||||
confirmDelete: false,
|
confirmDelete: false,
|
||||||
|
height: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.height = document.querySelector("#peerDropdown").clientHeight
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
downloadPeer(){
|
downloadPeer(){
|
||||||
fetchGet("/api/downloadPeer/"+this.$route.params.id, {
|
fetchGet("/api/downloadPeer/"+this.$route.params.id, {
|
||||||
@@ -84,14 +89,16 @@ export default {
|
|||||||
this.$emit("refresh")
|
this.$emit("refresh")
|
||||||
this.allowAccessBtnDisabled = false
|
this.allowAccessBtnDisabled = false
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ul class="dropdown-menu mt-2 shadow-lg d-block rounded-3" style="max-width: 200px">
|
<ul
|
||||||
|
:class="{'dropup': dropup}"
|
||||||
|
class="dropdown-menu mt-2 shadow-lg d-block rounded-3" id="peerDropdown" style="max-width: 200px">
|
||||||
<template v-if="!this.Peer.restricted">
|
<template v-if="!this.Peer.restricted">
|
||||||
<template v-if="!this.confirmDelete">
|
<template v-if="!this.confirmDelete">
|
||||||
<template v-if="this.Peer.status === 'running'">
|
<template v-if="this.Peer.status === 'running'">
|
||||||
@@ -217,6 +224,7 @@ export default {
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item d-flex text-warning"
|
<a class="dropdown-item d-flex text-warning"
|
||||||
|
|
||||||
@click="this.allowAccessPeer()"
|
@click="this.allowAccessPeer()"
|
||||||
:class="{disabled: this.allowAccessBtnDisabled}"
|
:class="{disabled: this.allowAccessBtnDisabled}"
|
||||||
role="button">
|
role="button">
|
||||||
@@ -231,10 +239,14 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dropdown-menu{
|
.dropdown-menu{
|
||||||
right: 1rem;
|
right: 0;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-menu.dropup{
|
||||||
|
bottom: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-item.disabled, .dropdown-item:disabled{
|
.dropdown-item.disabled, .dropdown-item:disabled{
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user