From 908e6d720bb77805eca99785fe5d3fb17771f0ff Mon Sep 17 00:00:00 2001 From: quyentonndbs Date: Wed, 1 Jul 2026 00:04:05 +0800 Subject: [PATCH] chore: improve openobserve maintenance path (#12508) Summary: - Add or tighten focused edge-case tests or type assertions in web/src/main.ts, web/src/App.spec.ts related to TypeScript, frontend tooling, test stability, build fixes; avoid docs-only changes and broad refactors. - Keep the change narrow so it is straightforward to review. Notes: - I kept this scoped to the relevant implementation and tests. Co-authored-by: Kai Tanaka <275430420+quyentonndbs@users.noreply.github.com> --- web/src/App.spec.ts | 4 ++-- web/src/main.ts | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/web/src/App.spec.ts b/web/src/App.spec.ts index 0258636624..4f65338bcb 100644 --- a/web/src/App.spec.ts +++ b/web/src/App.spec.ts @@ -26,8 +26,8 @@ describe('App.vue', () => { let wrapper: VueWrapper; let store: any; let router: any; - let mockDispatch: any; - let mockPush: any; + let mockDispatch: ReturnType; + let mockPush: ReturnType; beforeEach(() => { // Reset mocks diff --git a/web/src/main.ts b/web/src/main.ts index 9035877d14..055f1fbaa2 100644 --- a/web/src/main.ts +++ b/web/src/main.ts @@ -55,16 +55,37 @@ reoInit(); // app.use(SearchPlugin); +interface ConfigResponse { + data?: { + telemetry_enabled?: boolean; + commit_hash?: string; + rum?: { + enabled: boolean; + client_token: string; + application_id: string; + site: string; + service: string; + env: string; + version?: string; + organization_identifier: string; + insecure_http?: boolean; + api_version?: string; + }; + }; +} + const getConfig = async () => { - await configService.get_config().then((res: any) => { + await configService.get_config().then((res: ConfigResponse) => { + if (!res.data) return; + store.dispatch("setConfig", res.data); - config.enableAnalytics = res.data.telemetry_enabled.toString(); + config.enableAnalytics = res.data.telemetry_enabled?.toString() ?? "false"; // Store initial commit hash for version checking if (res.data.commit_hash) { buildVersionChecker.setInitialVersion(res.data.commit_hash); } - if (res.data.rum.enabled) { + if (res.data.rum?.enabled) { const options = { clientToken: res.data.rum.client_token, applicationId: res.data.rum.application_id,