From bc207ff2da2ad9a415979a61695f2a0edb453b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Wed, 17 Feb 2021 10:01:55 +0000 Subject: [PATCH] [Application Usage] Remove deprecated & unused legacy.appChanged API (#91464) --- src/plugins/usage_collection/public/mocks.tsx | 3 --- .../usage_collection/public/plugin.tsx | 25 +++++-------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/plugins/usage_collection/public/mocks.tsx b/src/plugins/usage_collection/public/mocks.tsx index ff8740ea48f7b..72cefaf026490 100644 --- a/src/plugins/usage_collection/public/mocks.tsx +++ b/src/plugins/usage_collection/public/mocks.tsx @@ -36,9 +36,6 @@ const createSetupContract = (): Setup => { allowTrackUserAgent: jest.fn(), reportUiCounter: jest.fn(), METRIC_TYPE, - __LEGACY: { - appChanged: jest.fn(), - }, }; return setupContract; diff --git a/src/plugins/usage_collection/public/plugin.tsx b/src/plugins/usage_collection/public/plugin.tsx index ac566c6a0d044..6d1eb751d907a 100644 --- a/src/plugins/usage_collection/public/plugin.tsx +++ b/src/plugins/usage_collection/public/plugin.tsx @@ -7,17 +7,17 @@ */ import { Reporter, METRIC_TYPE, ApplicationUsageTracker } from '@kbn/analytics'; -import { Subject, merge, Subscription } from 'rxjs'; +import type { Subscription } from 'rxjs'; import React from 'react'; -import { Storage } from '../../kibana_utils/public'; -import { createReporter, trackApplicationUsageChange } from './services'; -import { +import type { PluginInitializerContext, Plugin, CoreSetup, CoreStart, HttpSetup, -} from '../../../core/public'; +} from 'src/core/public'; +import { Storage } from '../../kibana_utils/public'; +import { createReporter, trackApplicationUsageChange } from './services'; import { ApplicationUsageContext } from './components/track_application_view'; export interface PublicConfigType { @@ -39,15 +39,6 @@ export interface UsageCollectionSetup { applicationUsageTracker: IApplicationUsageTracker; reportUiCounter: Reporter['reportUiCounter']; METRIC_TYPE: typeof METRIC_TYPE; - __LEGACY: { - /** - * Legacy handler so we can report the actual app being used inside "kibana#/{appId}". - * To be removed when we get rid of the legacy world - * - * @deprecated - */ - appChanged: (appId: string) => void; - }; } export interface UsageCollectionStart { @@ -65,7 +56,6 @@ export function isUnauthenticated(http: HttpSetup) { } export class UsageCollectionPlugin implements Plugin { - private readonly legacyAppId$ = new Subject(); private applicationUsageTracker?: ApplicationUsageTracker; private trackUserAgent: boolean = true; private subscriptions: Subscription[] = []; @@ -103,9 +93,6 @@ export class UsageCollectionPlugin implements Plugin this.legacyAppId$.next(appId), - }, }; } @@ -118,7 +105,7 @@ export class UsageCollectionPlugin implements Plugin