From 00a01da21762bc704653a7e2a536f297d12a196f Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Thu, 9 Jan 2025 22:44:39 -0300 Subject: [PATCH] frontend: disable wifi-updater and let user know if wifi service is disabled --- core/frontend/src/App.vue | 3 - .../src/components/wifi/WifiTrayMenu.vue | 78 ++++++++++++++----- core/frontend/src/store/commander.ts | 10 ++- 3 files changed, 68 insertions(+), 23 deletions(-) diff --git a/core/frontend/src/App.vue b/core/frontend/src/App.vue index 46c09c6831..c0ffd178b9 100644 --- a/core/frontend/src/App.vue +++ b/core/frontend/src/App.vue @@ -369,7 +369,6 @@
- @@ -419,7 +418,6 @@ import HealthTrayMenu from './components/health/HealthTrayMenu.vue' import MavlinkUpdater from './components/mavlink/MavlinkUpdater.vue' import NotificationTrayButton from './components/notifications/TrayButton.vue' import WifiTrayMenu from './components/wifi/WifiTrayMenu.vue' -import WifiUpdater from './components/wifi/WifiUpdater.vue' import menus, { menuItem } from './menus' import autopilot_data from './store/autopilot' import Cpu from './widgets/Cpu.vue' @@ -436,7 +434,6 @@ export default Vue.extend({ 'pirate-mode-tray-menu': PiradeModeTrayMenu, 'theme-tray-menu': ThemeTrayMenu, 'wifi-tray-menu': WifiTrayMenu, - 'wifi-updater': WifiUpdater, 'ethernet-tray-menu': EthernetTrayMenu, 'cloud-tray-menu': CloudTrayMenu, 'ethernet-updater': EthernetUpdater, diff --git a/core/frontend/src/components/wifi/WifiTrayMenu.vue b/core/frontend/src/components/wifi/WifiTrayMenu.vue index 4dbd3e4da4..823214d995 100644 --- a/core/frontend/src/components/wifi/WifiTrayMenu.vue +++ b/core/frontend/src/components/wifi/WifiTrayMenu.vue @@ -1,44 +1,79 @@ diff --git a/core/frontend/src/store/commander.ts b/core/frontend/src/store/commander.ts index 795555a2cd..4a61ee95b6 100644 --- a/core/frontend/src/store/commander.ts +++ b/core/frontend/src/store/commander.ts @@ -9,6 +9,8 @@ class CommanderStore { API_URL = '/commander/v1.0' private static instance: CommanderStore + // environment variables need a full reboot to take effect, so we should be able to cache them + private environmentVariables: Record | undefined public static getInstance(): CommanderStore { if (!CommanderStore.instance) { @@ -145,12 +147,18 @@ class CommanderStore { } async getEnvironmentVariables(): Promise | undefined> { + if (this.environmentVariables) { + return this.environmentVariables + } return back_axios({ method: 'get', url: `${this.API_URL}/environment_variables`, timeout: 5000, }) - .then((response) => response.data) + .then((response) => { + this.environmentVariables = response.data + return response.data + }) .catch((error) => { if (error === backend_offline_error) { return undefined