Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [APM] Fix deprecated usage of license plugin (#201964) #202189

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const renderApp = ({
observabilityAIAssistant: pluginsStart.observabilityAIAssistant,
share: pluginsSetup.share,
kibanaEnvironment,
licensing: pluginsStart.licensing,
};

// render APM feedback link in global help menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { UiActionsStart } from '@kbn/ui-actions-plugin/public';
import type { ObservabilityAIAssistantPublicStart } from '@kbn/observability-ai-assistant-plugin/public';
import { SharePluginSetup } from '@kbn/share-plugin/public';
import type { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import type { ApmPluginSetupDeps } from '../../plugin';
import type { ConfigSchema } from '../..';
import type { KibanaEnvContext } from '../kibana_environment_context/kibana_environment_context';
Expand All @@ -40,6 +41,7 @@ export interface ApmPluginContextValue {
share: SharePluginSetup;
kibanaEnvironment: KibanaEnvContext;
lens: LensPublicStart;
licensing: LicensingPluginStart;
}

export const ApmPluginContext = createContext({} as ApmPluginContextValue);
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { InvalidLicenseNotification } from './invalid_license_notification';
export const LicenseContext = React.createContext<ILicense | undefined>(undefined);

export function LicenseProvider({ children }: { children: React.ReactChild }) {
const { plugins } = useApmPluginContext();
const { licensing } = plugins;
const { licensing } = useApmPluginContext();
const license = useObservable(licensing.license$);
// if license is not loaded yet, consider it valid
const hasInvalidLicense = license?.isActive === false;
Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/observability_solution/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { Start as InspectorPluginStart } from '@kbn/inspector-plugin/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { LicenseManagementUIPluginSetup } from '@kbn/license-management-plugin/public';
import type { LicensingPluginSetup } from '@kbn/licensing-plugin/public';
import type { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import type { MapsStartApi } from '@kbn/maps-plugin/public';
import type { MlPluginSetup, MlPluginStart } from '@kbn/ml-plugin/public';
import type {
Expand Down Expand Up @@ -96,7 +96,6 @@ export interface ApmPluginSetupDeps {
unifiedSearch: UnifiedSearchPublicPluginStart;
features: FeaturesPluginSetup;
home?: HomePublicPluginSetup;
licensing: LicensingPluginSetup;
licenseManagement?: LicenseManagementUIPluginSetup;
ml?: MlPluginSetup;
observability: ObservabilityPublicSetup;
Expand All @@ -122,7 +121,7 @@ export interface ApmPluginStartDeps {
embeddable: EmbeddableStart;
home: void;
inspector: InspectorPluginStart;
licensing: void;
licensing: LicensingPluginStart;
maps?: MapsStartApi;
ml?: MlPluginStart;
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
Expand Down