From 6abff5aea2cccd5a3524e9e5b08080bf46e3c66f Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 24 Sep 2024 09:11:20 -0300 Subject: [PATCH] wip --- core/frontend/src/store/wifi.ts | 1 - core/frontend/src/types/shims-general.ts | 2 -- core/frontend/src/types/shims-vue.d.ts | 5 ----- core/frontend/src/views/Autopilot.vue | 14 +++++++++----- core/frontend/src/views/ExtensionView.vue | 12 ++++++++---- core/frontend/src/views/FileBrowserView.vue | 8 ++++++-- core/frontend/src/views/VehicleSetupView.vue | 9 +++++++-- core/frontend/tsconfig.json | 1 + 8 files changed, 31 insertions(+), 21 deletions(-) delete mode 100644 core/frontend/src/types/shims-vue.d.ts diff --git a/core/frontend/src/store/wifi.ts b/core/frontend/src/store/wifi.ts index 1d0d2277de..ae0ab341b3 100644 --- a/core/frontend/src/store/wifi.ts +++ b/core/frontend/src/store/wifi.ts @@ -13,7 +13,6 @@ import { sorted_networks } from '@/utils/wifi' store, name: 'wifi', }) - class WifiStore extends VuexModule { API_URL = '/wifi-manager/v1.0' diff --git a/core/frontend/src/types/shims-general.ts b/core/frontend/src/types/shims-general.ts index 94d6cc10ce..b369ad3346 100644 --- a/core/frontend/src/types/shims-general.ts +++ b/core/frontend/src/types/shims-general.ts @@ -9,5 +9,3 @@ declare module '*.jpg' { declare module '*.png' { const value: string } - -declare module 'vue-tooltip-directive' \ No newline at end of file diff --git a/core/frontend/src/types/shims-vue.d.ts b/core/frontend/src/types/shims-vue.d.ts deleted file mode 100644 index 5596f90ef3..0000000000 --- a/core/frontend/src/types/shims-vue.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module '*.vue' { - import Vue from 'vue' - - export default Vue -} diff --git a/core/frontend/src/views/Autopilot.vue b/core/frontend/src/views/Autopilot.vue index 7aa4bd8eaf..f0ac760c39 100644 --- a/core/frontend/src/views/Autopilot.vue +++ b/core/frontend/src/views/Autopilot.vue @@ -55,7 +55,7 @@ @@ -122,6 +122,7 @@ import autopilot from '@/store/autopilot_manager' import { FirmwareInfo, FlightController } from '@/types/autopilot' import { autopilot_service } from '@/types/frontend_services' import back_axios from '@/utils/api' +import Vuetify from 'vuetify/lib' const notifier = new Notifier(autopilot_service) @@ -144,6 +145,9 @@ export default Vue.extend({ } }, computed: { + vuetify(): any { + return (this as any).$route as any + }, autopilot_info(): Record { let version = 'Unknown' if (this.firmware_info) { @@ -164,7 +168,7 @@ export default Vue.extend({ return record }, - banner(): string { + banner(): string | undefined { switch (autopilot_data.autopilot_type) { case MavAutopilot.MAV_AUTOPILOT_ARDUPILOTMEGA: return ArduPilotBanner diff --git a/core/frontend/src/views/ExtensionView.vue b/core/frontend/src/views/ExtensionView.vue index f95e3fd559..2876fe6602 100644 --- a/core/frontend/src/views/ExtensionView.vue +++ b/core/frontend/src/views/ExtensionView.vue @@ -17,6 +17,7 @@ import helper from '@/store/helper' import { Service } from '@/types/helper' import PageNotFound from './PageNotFound.vue' +import { Route } from 'vue-router' export default Vue.extend({ name: 'ExtensionView', @@ -33,12 +34,15 @@ export default Vue.extend({ } }, computed: { + route(): Route { + return (this as any).$route as Route + }, fullpage(): boolean { - return this.$route.query.full_page === 'true' + return this.route.query.full_page === 'true' }, service(): Service | undefined { return helper.services.filter( - (service) => service?.metadata?.sanitized_name === this.$route.params.name, + (service) => service?.metadata?.sanitized_name === this.route.params.name, )[0] ?? undefined }, port(): number | undefined | null { @@ -46,7 +50,7 @@ export default Vue.extend({ return undefined } return helper.services.filter( - (service) => service?.metadata?.sanitized_name === this.$route.params.name, + (service) => service?.metadata?.sanitized_name === this.route.params.name, )[0]?.port ?? null }, service_path(): string { @@ -73,7 +77,7 @@ export default Vue.extend({ this.detected_port = this.port } // eslint-disable-next-line - this.remaining_path = this.$route.params.pathMatch + this.remaining_path = this.route.params.pathMatch }, }) diff --git a/core/frontend/src/views/FileBrowserView.vue b/core/frontend/src/views/FileBrowserView.vue index 4d90d5b9ad..cf5f390209 100644 --- a/core/frontend/src/views/FileBrowserView.vue +++ b/core/frontend/src/views/FileBrowserView.vue @@ -8,6 +8,7 @@ import Vue from 'vue' import BrIframe from '@/components/utils/BrIframe.vue' +import { Route } from 'vue-router'; export default Vue.extend({ name: 'FileBrowserView', @@ -20,8 +21,11 @@ export default Vue.extend({ } }, computed: { - full_path() { - return `${this.service_path}${this.$route.params.path ?? ''}` + route(): Route { + return (this as any).$route as Route + }, + full_path() : string { + return `${this.service_path}${this.route.params.path ?? ''}` }, }, }) diff --git a/core/frontend/src/views/VehicleSetupView.vue b/core/frontend/src/views/VehicleSetupView.vue index f5a15f9f38..c080388359 100644 --- a/core/frontend/src/views/VehicleSetupView.vue +++ b/core/frontend/src/views/VehicleSetupView.vue @@ -23,7 +23,7 @@ :value="page.value" > - + @@ -39,6 +39,8 @@ import Configure from '@/components/vehiclesetup/Configure.vue' import PwmSetup from '@/components/vehiclesetup/PwmSetup.vue' import setupOverview from '@/components/vehiclesetup/SetupOverview.vue' import { OneMoreTime } from '@/one-more-time' +import router from '@/router' +import VueRouter, { Route } from 'vue-router' export interface Item { title: string, @@ -73,8 +75,11 @@ export default Vue.extend({ } }, computed: { + route(): Route { + return (this as any).$route as Route + }, currentTab(): string { - return this.$route.params.tab || 'overview' + return this.route.params.tab || 'overview' }, }, mounted() { diff --git a/core/frontend/tsconfig.json b/core/frontend/tsconfig.json index 10cf69c0c4..0221bf3f31 100644 --- a/core/frontend/tsconfig.json +++ b/core/frontend/tsconfig.json @@ -14,6 +14,7 @@ "sourceMap": true, "baseUrl": ".", "experimentalDecorators": true, + "emitDecoratorMetadata": true, "types": [ "vite/client" ],