diff --git a/x-pack/plugins/apm/kibana.jsonc b/x-pack/plugins/apm/kibana.jsonc index c03cbf6174ff8..391f8481e59c7 100644 --- a/x-pack/plugins/apm/kibana.jsonc +++ b/x-pack/plugins/apm/kibana.jsonc @@ -44,7 +44,8 @@ "security", "spaces", "taskManager", - "usageCollection" + "usageCollection", + "licenseManagement" ], "requiredBundles": [ "fleet", diff --git a/x-pack/plugins/apm/public/components/shared/license_prompt/index.tsx b/x-pack/plugins/apm/public/components/shared/license_prompt/index.tsx index 38f348dab53d4..c7a85339f3028 100644 --- a/x-pack/plugins/apm/public/components/shared/license_prompt/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/license_prompt/index.tsx @@ -8,41 +8,29 @@ import { EuiButton, EuiCard, EuiTextColor } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; +import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { useKibanaUrl } from '../../../hooks/use_kibana_url'; export interface LicensePromptProps { text: string; - showBetaBadge?: boolean; } -export function LicensePrompt({ - text, - showBetaBadge = false, -}: LicensePromptProps) { +export function LicensePrompt({ text }: LicensePromptProps) { + const { + plugins: { licenseManagement }, + } = useApmPluginContext(); const licensePageUrl = useKibanaUrl( '/app/management/stack/license_management' ); - + const manageLicenseURL = licenseManagement?.locator + ? licenseManagement?.locator?.useUrl({ + page: 'dashboard', + }) + : licensePageUrl; return ( {i18n.translate('xpack.apm.license.button', { defaultMessage: 'Start trial', diff --git a/x-pack/plugins/apm/public/components/shared/license_prompt/license_prompt.stories.tsx b/x-pack/plugins/apm/public/components/shared/license_prompt/license_prompt.stories.tsx index 654083616fdf7..3ab6cfd69888a 100644 --- a/x-pack/plugins/apm/public/components/shared/license_prompt/license_prompt.stories.tsx +++ b/x-pack/plugins/apm/public/components/shared/license_prompt/license_prompt.stories.tsx @@ -28,11 +28,8 @@ export default { ], }; -export function Example({ - showBetaBadge, - text, -}: ComponentProps) { - return ; +export function Example({ text }: ComponentProps) { + return ; } Example.args = { showBetaBadge: false, diff --git a/x-pack/plugins/apm/public/context/license/invalid_license_notification.tsx b/x-pack/plugins/apm/public/context/license/invalid_license_notification.tsx index b6b9a41e5c084..867c9d3b080ec 100644 --- a/x-pack/plugins/apm/public/context/license/invalid_license_notification.tsx +++ b/x-pack/plugins/apm/public/context/license/invalid_license_notification.tsx @@ -9,11 +9,20 @@ import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { useKibanaUrl } from '../../hooks/use_kibana_url'; +import { useApmPluginContext } from '../apm_plugin/use_apm_plugin_context'; export function InvalidLicenseNotification() { - const manageLicenseURL = useKibanaUrl( + const { + plugins: { licenseManagement }, + } = useApmPluginContext(); + const licensePageUrl = useKibanaUrl( '/app/management/stack/license_management' ); + const manageLicenseURL = licenseManagement?.locator + ? licenseManagement?.locator?.useUrl({ + page: 'dashboard', + }) + : licensePageUrl; return ( ( ); export function LicenseProvider({ children }: { children: React.ReactChild }) { - const { license$ } = useApmPluginContext().plugins.licensing; - const license = useObservable(license$); + const { plugins } = useApmPluginContext(); + const { licensing } = plugins; + const license = useObservable(licensing.license$); // if license is not loaded yet, consider it valid const hasInvalidLicense = license?.isActive === false; diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index f59f0b89e1773..71aceed2b92dd 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -60,6 +60,7 @@ import { ChartsPluginStart } from '@kbn/charts-plugin/public'; import { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/public'; import { ObservabilityTriggerId } from '@kbn/observability-shared-plugin/common'; +import { LicenseManagementUIPluginSetup } from '@kbn/license-management-plugin/public'; import { registerApmRuleTypes } from './components/alerting/rule_types/register_apm_rule_types'; import { getApmEnrollmentFlyoutData, @@ -84,6 +85,7 @@ export interface ApmPluginSetupDeps { features: FeaturesPluginSetup; home?: HomePublicPluginSetup; licensing: LicensingPluginSetup; + licenseManagement?: LicenseManagementUIPluginSetup; ml?: MlPluginSetup; observability: ObservabilityPublicSetup; observabilityShared: ObservabilitySharedPluginSetup; diff --git a/x-pack/plugins/apm/tsconfig.json b/x-pack/plugins/apm/tsconfig.json index d4fe88fb64ae3..9ffebb4dbbc1f 100644 --- a/x-pack/plugins/apm/tsconfig.json +++ b/x-pack/plugins/apm/tsconfig.json @@ -30,6 +30,7 @@ "@kbn/features-plugin", "@kbn/infra-plugin", "@kbn/licensing-plugin", + "@kbn/license-management-plugin", "@kbn/maps-plugin", "@kbn/ml-plugin", "@kbn/observability-plugin", diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index f38e6310626eb..01d044cdf654a 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -8212,8 +8212,6 @@ "xpack.apm.latencyChartHistory.chartTitle": " historique des alertes de latence", "xpack.apm.latencyChartHistory.last30days": "30 derniers jours", "xpack.apm.latencyCorrelations.licenseCheckText": "Pour utiliser les corrélations de latence, vous devez disposer d'une licence Elastic Platinum. Elle vous permettra de découvrir quels champs sont corrélés à de faibles performances.", - "xpack.apm.license.betaBadge": "Version bêta", - "xpack.apm.license.betaTooltipMessage": "Cette fonctionnalité est actuellement en version bêta. Si vous rencontrez des bugs ou si vous souhaitez apporter des commentaires, ouvrez un ticket de problème ou visitez notre forum de discussion.", "xpack.apm.license.button": "Commencer l'essai", "xpack.apm.license.title": "Commencer un essai gratuit de 30 jours", "xpack.apm.managedTable.errorMessage": "Impossible de récupérer", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 82aebe0112589..7c74c278b42dc 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -8213,8 +8213,6 @@ "xpack.apm.latencyChartHistory.chartTitle": " レイテンシアラート履歴", "xpack.apm.latencyChartHistory.last30days": "過去30日間", "xpack.apm.latencyCorrelations.licenseCheckText": "遅延の相関関係を使用するには、Elastic Platinumライセンスのサブスクリプションが必要です。使用すると、パフォーマンスの低下に関連しているフィールドを検出できます。", - "xpack.apm.license.betaBadge": "ベータ", - "xpack.apm.license.betaTooltipMessage": "現在、この機能はベータです。不具合を見つけた場合やご意見がある場合、サポートに問い合わせるか、またはディスカッションフォーラムにご報告ください。", "xpack.apm.license.button": "トライアルを開始", "xpack.apm.license.title": "無料の 30 日トライアルを開始", "xpack.apm.managedTable.errorMessage": "取得できませんでした", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 1e4bec4f2bdd9..dde08589a3dd8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -8212,8 +8212,6 @@ "xpack.apm.latencyChartHistory.chartTitle": " 延迟告警历史记录", "xpack.apm.latencyChartHistory.last30days": "过去 30 天", "xpack.apm.latencyCorrelations.licenseCheckText": "要使用延迟相关性,必须订阅 Elastic 白金级许可证。使用相关性,将能够发现哪些字段与性能差相关。", - "xpack.apm.license.betaBadge": "公测版", - "xpack.apm.license.betaTooltipMessage": "此功能当前为公测版。如果遇到任何错误或有任何反馈,请报告问题或访问我们的论坛。", "xpack.apm.license.button": "开始试用", "xpack.apm.license.title": "开始为期 30 天的免费试用", "xpack.apm.managedTable.errorMessage": "无法提取",