Skip to content

Commit

Permalink
[APM] Fix deprecated usage of license plugin (elastic#201964)
Browse files Browse the repository at this point in the history
Closes elastic#200709

## Summary

This PR replaces deprecated usage of licensing plugin (remove plugin
from setup in favor of start up).
  • Loading branch information
miloszmarcinkowski authored Nov 28, 2024
1 parent 0419606 commit 0b77cbe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
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

0 comments on commit 0b77cbe

Please sign in to comment.