From 9644e6195c1aed822dabc627707f6504e16e7d6c Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Fri, 9 Aug 2024 17:30:44 -0400 Subject: [PATCH] Finished adding data usage on configuration list --- .../configurationComponents/peerList.vue | 14 ++++- .../app/src/components/configurationList.vue | 12 +++- .../configurationCard.vue | 59 ++++++++++++------- .../stores/WireguardConfigurationsStore.js | 1 + 4 files changed, 59 insertions(+), 27 deletions(-) diff --git a/src/static/app/src/components/configurationComponents/peerList.vue b/src/static/app/src/components/configurationComponents/peerList.vue index 8aa2aea..71b80c5 100644 --- a/src/static/app/src/components/configurationComponents/peerList.vue +++ b/src/static/app/src/components/configurationComponents/peerList.vue @@ -212,9 +212,10 @@ export default { { label: 'Data Sent', data: [...this.historySentData.datasets[0].data, - ((sent - this.historyDataSentDifference[this.historyDataSentDifference.length - 1])*1000).toFixed(4)], + ((sent - this.historyDataSentDifference[this.historyDataSentDifference.length - 1])*1000) + .toFixed(4)], fill: false, - borderColor: ' #198754', + borderColor: '#198754', tension: 0 } ], @@ -237,6 +238,15 @@ export default { fill: false, borderColor: '#0d6efd', tension: 0 + }, + { + label: 'Data Sent', + data: [...this.historySentData.datasets[0].data, + ((sent - this.historyDataSentDifference[this.historyDataSentDifference.length - 1])*1000) + .toFixed(4)], + fill: false, + borderColor: '#198754', + tension: 0 } ], } diff --git a/src/static/app/src/components/configurationList.vue b/src/static/app/src/components/configurationList.vue index eb50577..80dfd60 100644 --- a/src/static/app/src/components/configurationList.vue +++ b/src/static/app/src/components/configurationList.vue @@ -8,7 +8,6 @@ export default { components: {ConfigurationCard}, async setup(){ const wireguardConfigurationsStore = WireguardConfigurationsStore(); - return {wireguardConfigurationsStore} }, data(){ @@ -19,6 +18,13 @@ export default { async mounted() { await this.wireguardConfigurationsStore.getConfigurations(); this.configurationLoaded = true; + + this.wireguardConfigurationsStore.ConfigurationListInterval = setInterval(() => { + this.wireguardConfigurationsStore.getConfigurations() + }, 10000) + }, + beforeUnmount() { + clearInterval(this.wireguardConfigurationsStore.ConfigurationListInterval) } } @@ -40,8 +46,8 @@ export default {

You don't have any WireGuard configurations yet. Please check the configuration folder or change it in "Settings". By default the folder is "/etc/wireguard".

-
- +
+
diff --git a/src/static/app/src/components/configurationListComponents/configurationCard.vue b/src/static/app/src/components/configurationListComponents/configurationCard.vue index f3d3db7..5acdae2 100644 --- a/src/static/app/src/components/configurationListComponents/configurationCard.vue +++ b/src/static/app/src/components/configurationListComponents/configurationCard.vue @@ -10,7 +10,6 @@ export default { Status: Boolean, PublicKey: String, PrivateKey: String - } }, data(){ @@ -52,27 +51,43 @@ export default { -