From 4970d5088f5faef41d46c7d18c3dde3f09be9076 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 15 Dec 2024 20:59:52 +1300 Subject: [PATCH] discover ble rnodes when adding or editing an interface --- .../interfaces/AddInterfacePage.vue | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/frontend/components/interfaces/AddInterfacePage.vue b/src/frontend/components/interfaces/AddInterfacePage.vue index 51afc03..ef1ec91 100644 --- a/src/frontend/components/interfaces/AddInterfacePage.vue +++ b/src/frontend/components/interfaces/AddInterfacePage.vue @@ -118,7 +118,12 @@ +
+ Discovering Bluetooth RNodes... + Discover Bluetooth RNodes +
@@ -184,6 +189,9 @@ export default { config: null, comports: [], + rnodes: [], + + isLoadingRnodes: false, newInterfaceName: null, newInterfaceType: null, @@ -243,6 +251,7 @@ export default { this.getConfig(); this.loadComports(); + this.loadRnodes(); // check if we are editing an interface const interfaceName = this.$route.query.interface_name; @@ -276,9 +285,30 @@ export default { const response = await window.axios.get(`/api/v1/comports`); this.comports = response.data.comports; } catch(e) { - // do nothing if failed to load interfaces + // do nothing if failed to load comports } }, + async loadRnodes() { + + // do nothing if already loading + if(this.isLoadingRnodes){ + return; + } + + // show loading + this.isLoadingRnodes = true; + + try { + const response = await window.axios.get(`/api/v1/rnodes/ble-scan`); + this.rnodes = response.data.rnodes; + } catch(e) { + // do nothing if failed to load rnodes + } finally { + // no longer loading + this.isLoadingRnodes = false; + } + + }, async loadInterfaceToEdit(interfaceName) { try {