From 83053943a951bc5d414e08e0df520a5d9b05e92f Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Tue, 16 Jul 2024 09:54:56 -0300 Subject: [PATCH] settings-sync: Remove view index and global address from auto sync The global address does not make sense to sync, since when the user is connected, changing the address can only disconnect it. The widgets profile and view index also does not make much sense since it may be something the user is messing around with before connection and will receive a conflict unnecessarily. Those are not trully settings, but states that we want to keep between sessions. --- src/stores/mainVehicle.ts | 4 ++-- src/stores/widgetManager.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stores/mainVehicle.ts b/src/stores/mainVehicle.ts index ee8e6af49..bfbaa3a5c 100644 --- a/src/stores/mainVehicle.ts +++ b/src/stores/mainVehicle.ts @@ -1,4 +1,4 @@ -import { useTimestamp, watchThrottled } from '@vueuse/core' +import { useStorage, useTimestamp, watchThrottled } from '@vueuse/core' import { defineStore } from 'pinia' import { computed, reactive, ref, watch } from 'vue' @@ -64,7 +64,7 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => { const ws_protocol = location?.protocol === 'https:' ? 'wss' : 'ws' const cpuLoad = ref() - const globalAddress = useBlueOsStorage('cockpit-vehicle-address', defaultGlobalAddress) + const globalAddress = useStorage('cockpit-vehicle-address', defaultGlobalAddress) const defaultMainConnectionURI = ref(`${ws_protocol}://${globalAddress.value}/mavlink2rest/ws/mavlink`) const defaultWebRTCSignallingURI = ref(`${ws_protocol}://${globalAddress.value}:6021/`) diff --git a/src/stores/widgetManager.ts b/src/stores/widgetManager.ts index 3d9b5a48e..10d3063a7 100644 --- a/src/stores/widgetManager.ts +++ b/src/stores/widgetManager.ts @@ -1,6 +1,6 @@ import '@/libs/cosmos' -import { useDebounceFn, useWindowSize } from '@vueuse/core' +import { useDebounceFn, useStorage, useWindowSize } from '@vueuse/core' import { saveAs } from 'file-saver' import { defineStore } from 'pinia' import Swal from 'sweetalert2' @@ -50,8 +50,8 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => { const gridInterval = ref(0.01) const currentMiniWidgetsProfile = useBlueOsStorage('cockpit-mini-widgets-profile-v4', miniWidgetsProfile) const savedProfiles = useBlueOsStorage(savedProfilesKey, []) - const currentViewIndex = useBlueOsStorage('cockpit-current-view-index', 0) - const currentProfileIndex = useBlueOsStorage('cockpit-current-profile-index', 0) + const currentViewIndex = useStorage('cockpit-current-view-index', 0) + const currentProfileIndex = useStorage('cockpit-current-profile-index', 0) const desiredTopBarHeightPixels = ref(48) const desiredBottomBarHeightPixels = ref(48) const visibleAreaMinClearancePixels = ref(20)