mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[APM][Fleet] deprecation warning is not showing up (#119381)
* fixing deprecation warning * fixing test
This commit is contained in:
parent
718f191099
commit
51f7986242
2 changed files with 13 additions and 4 deletions
|
@ -57,7 +57,13 @@ describe('getDeprecations', () => {
|
||||||
cloudSetup: { isCloudEnabled: true } as unknown as CloudSetup,
|
cloudSetup: { isCloudEnabled: true } as unknown as CloudSetup,
|
||||||
fleet: {
|
fleet: {
|
||||||
start: () => ({
|
start: () => ({
|
||||||
agentPolicyService: { get: () => ({ id: 'foo' } as AgentPolicy) },
|
agentPolicyService: {
|
||||||
|
get: () =>
|
||||||
|
({
|
||||||
|
id: 'foo',
|
||||||
|
package_policies: [{ package: { name: 'apm' } }],
|
||||||
|
} as AgentPolicy),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
} as unknown as APMRouteHandlerResources['plugins']['fleet'],
|
} as unknown as APMRouteHandlerResources['plugins']['fleet'],
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,10 @@ import { GetDeprecationsContext, DeprecationsDetails } from 'src/core/server';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import { CloudSetup } from '../../../cloud/server';
|
import { CloudSetup } from '../../../cloud/server';
|
||||||
import { getCloudAgentPolicy } from '../routes/fleet/get_cloud_apm_package_policy';
|
import {
|
||||||
|
getCloudAgentPolicy,
|
||||||
|
getApmPackagePolicy,
|
||||||
|
} from '../routes/fleet/get_cloud_apm_package_policy';
|
||||||
import { APMRouteHandlerResources } from '../';
|
import { APMRouteHandlerResources } from '../';
|
||||||
|
|
||||||
export function getDeprecations({
|
export function getDeprecations({
|
||||||
|
@ -36,12 +39,12 @@ export function getDeprecations({
|
||||||
});
|
});
|
||||||
|
|
||||||
const isCloudEnabled = !!cloudSetup?.isCloudEnabled;
|
const isCloudEnabled = !!cloudSetup?.isCloudEnabled;
|
||||||
|
const hasAPMPackagePolicy = !isEmpty(getApmPackagePolicy(cloudAgentPolicy));
|
||||||
|
|
||||||
const hasCloudAgentPolicy = !isEmpty(cloudAgentPolicy);
|
|
||||||
// TODO: remove when docs support "main"
|
// TODO: remove when docs support "main"
|
||||||
const docBranch = branch === 'main' ? 'master' : branch;
|
const docBranch = branch === 'main' ? 'master' : branch;
|
||||||
|
|
||||||
if (isCloudEnabled && !hasCloudAgentPolicy) {
|
if (isCloudEnabled && !hasAPMPackagePolicy) {
|
||||||
deprecations.push({
|
deprecations.push({
|
||||||
title: i18n.translate('xpack.apm.deprecations.legacyModeTitle', {
|
title: i18n.translate('xpack.apm.deprecations.legacyModeTitle', {
|
||||||
defaultMessage: 'APM Server running in legacy mode',
|
defaultMessage: 'APM Server running in legacy mode',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue