mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-06-28 09:16:55 +00:00
Still trying
This commit is contained in:
parent
cca5fd859c
commit
31e7f02b8d
@ -22,13 +22,21 @@ const PeerSettingsModal = defineAsyncComponent(() => import("@/components/config
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Transition name="zoom">
|
<Transition name="zoom">
|
||||||
<PeerSettingsModal v-if="configurationModals.peerSetting.modalOpen"
|
<PeerSettingsModal
|
||||||
key="settings"
|
v-if="configurationModals.peerSetting.modalOpen"
|
||||||
:selectedPeer="configurationModalSelectedPeer"
|
key="settings"
|
||||||
@refresh="emits('refresh')"
|
:selectedPeer="configurationModalSelectedPeer"
|
||||||
@close="configurationModals.peerSetting.modalOpen = false">
|
@refresh="emits('refresh')"
|
||||||
|
@close="configurationModals.peerSetting.modalOpen = false">
|
||||||
</PeerSettingsModal>
|
</PeerSettingsModal>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
<Transition name="zoom">
|
||||||
|
<PeerQRCodeModal
|
||||||
|
v-if="configurationModals.peerQRCode.modalOpen"
|
||||||
|
:selectedPeer="configurationModalSelectedPeer"
|
||||||
|
@close="configurationModals.peerQRCode.modalOpen = false">
|
||||||
|
</PeerQRCodeModal>
|
||||||
|
</Transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -20,7 +20,7 @@ const route = useRoute()
|
|||||||
const configurationInfo = ref({})
|
const configurationInfo = ref({})
|
||||||
const configurationPeers = ref([])
|
const configurationPeers = ref([])
|
||||||
const configurationToggling = ref(false)
|
const configurationToggling = ref(false)
|
||||||
const configurationModalSelectedPeer = ref("")
|
const configurationModalSelectedPeer = ref({})
|
||||||
const configurationModals = ref({
|
const configurationModals = ref({
|
||||||
peerSetting: {
|
peerSetting: {
|
||||||
modalOpen: false,
|
modalOpen: false,
|
||||||
@ -345,7 +345,7 @@ const searchPeers = computed(() => {
|
|||||||
@refresh="fetchPeerList()"
|
@refresh="fetchPeerList()"
|
||||||
@jobs="configurationModals.peerScheduleJobs.modalOpen = true; configurationModals.peerScheduleJobs.selectedPeer = this.configurationPeers.find(x => x.id === peer.id)"
|
@jobs="configurationModals.peerScheduleJobs.modalOpen = true; configurationModals.peerScheduleJobs.selectedPeer = this.configurationPeers.find(x => x.id === peer.id)"
|
||||||
@setting="configurationModals.peerSetting.modalOpen = true; configurationModalSelectedPeer = peer"
|
@setting="configurationModals.peerSetting.modalOpen = true; configurationModalSelectedPeer = peer"
|
||||||
@qrcode="(file) => {configurationModals.peerQRCode.peerConfigData = file; configurationModals.peerQRCode.modalOpen = true;}"
|
@qrcode="(file) => {configurationModalSelectedPeer = peer; configurationModals.peerQRCode.modalOpen = true;}"
|
||||||
@configurationFile="(file) => {configurationModals.peerConfigurationFile.peerConfigData = file; configurationModals.peerConfigurationFile.modalOpen = true;}"
|
@configurationFile="(file) => {configurationModals.peerConfigurationFile.peerConfigData = file; configurationModals.peerConfigurationFile.modalOpen = true;}"
|
||||||
></Peer>
|
></Peer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
import QRCode from "qrcode";
|
import QRCode from "qrcode";
|
||||||
import LocaleText from "@/components/text/localeText.vue";
|
import LocaleText from "@/components/text/localeText.vue";
|
||||||
|
import {fetchGet} from "@/utilities/fetch.js";
|
||||||
|
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
|
||||||
export default {
|
export default {
|
||||||
name: "peerQRCode",
|
name: "peerQRCode",
|
||||||
components: {LocaleText},
|
components: {LocaleText},
|
||||||
props: {
|
props: {
|
||||||
peerConfigData: String
|
selectedPeer: Object
|
||||||
|
},
|
||||||
|
setup(){
|
||||||
|
const dashboardStore = DashboardConfigurationStore();
|
||||||
|
return {dashboardStore}
|
||||||
|
},
|
||||||
|
data(){
|
||||||
|
return{
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
QRCode.toCanvas(document.querySelector("#qrcode"), this.peerConfigData , (error) => {
|
fetchGet("/api/downloadPeer/"+this.$route.params.id, {
|
||||||
if (error) console.error(error)
|
id: this.selectedPeer.id
|
||||||
|
}, (res) => {
|
||||||
|
this.loading = false;
|
||||||
|
if (res.status){
|
||||||
|
QRCode.toCanvas(document.querySelector("#qrcode"), res.data.file, (error) => {
|
||||||
|
if (error) console.error(error)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.dashboardStore.newMessage("Server", res.message, "danger")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,8 +46,13 @@ export default {
|
|||||||
</h4>
|
</h4>
|
||||||
<button type="button" class="btn-close ms-auto" @click="this.$emit('close')"></button>
|
<button type="button" class="btn-close ms-auto" @click="this.$emit('close')"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body p-4">
|
||||||
<canvas id="qrcode" class="rounded-3 shadow" ref="qrcode"></canvas>
|
<div style="width: 292px; height: 292px;" class="d-flex">
|
||||||
|
<canvas id="qrcode" class="rounded-3 shadow animate__animated animate__fadeIn animate__faster" :class="{'d-none': loading}"></canvas>
|
||||||
|
<div class="spinner-border m-auto" role="status" v-if="loading">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user