From 7e7585baca59c123cee10d3ae9a9325af82f0ee6 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Mon, 18 Dec 2023 12:49:40 +0100 Subject: [PATCH] reverted change to allow apm with remote es as data output --- .../fleet/common/services/output_helpers.test.ts | 4 ++-- .../fleet/common/services/output_helpers.ts | 12 +++--------- .../agent_policy_advanced_fields/hooks.test.tsx | 16 ++++++++-------- .../agent_policy_advanced_fields/hooks.tsx | 4 ++-- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/fleet/common/services/output_helpers.test.ts b/x-pack/plugins/fleet/common/services/output_helpers.test.ts index 57756dd699494e..cba42f1b6c233f 100644 --- a/x-pack/plugins/fleet/common/services/output_helpers.test.ts +++ b/x-pack/plugins/fleet/common/services/output_helpers.test.ts @@ -26,7 +26,7 @@ describe('getAllowedOutputTypeForPolicy', () => { expect(res).toContain('logstash'); }); - it('should return only elasticsearch types for an agent policy with APM', () => { + it('should return only elasticsearch for an agent policy with APM', () => { const res = getAllowedOutputTypeForPolicy({ package_policies: [ { @@ -35,7 +35,7 @@ describe('getAllowedOutputTypeForPolicy', () => { ], } as any); - expect(res).toEqual(['elasticsearch', 'remote_elasticsearch']); + expect(res).toEqual(['elasticsearch']); }); it('should return only elasticsearch for an agent policy with Fleet Server', () => { diff --git a/x-pack/plugins/fleet/common/services/output_helpers.ts b/x-pack/plugins/fleet/common/services/output_helpers.ts index 5802765c23999b..988be3bc277f7f 100644 --- a/x-pack/plugins/fleet/common/services/output_helpers.ts +++ b/x-pack/plugins/fleet/common/services/output_helpers.ts @@ -28,21 +28,15 @@ export function getAllowedOutputTypeForPolicy(agentPolicy: AgentPolicy) { agentPolicy.package_policies && agentPolicy.package_policies.some( (p) => - p.package?.name === FLEET_SERVER_PACKAGE || p.package?.name === FLEET_SYNTHETICS_PACKAGE + p.package?.name === FLEET_SERVER_PACKAGE || + p.package?.name === FLEET_SYNTHETICS_PACKAGE || + p.package?.name === FLEET_APM_PACKAGE ); if (isRestrictedToSameClusterES) { return [outputType.Elasticsearch]; } - const isRestrictedToESType = - agentPolicy.package_policies && - agentPolicy.package_policies.some((p) => p.package?.name === FLEET_APM_PACKAGE); - - if (isRestrictedToESType) { - return [outputType.Elasticsearch, outputType.RemoteElasticsearch]; - } - return Object.values(outputType); } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx index 45594c95499361..8c2983ee9fd83a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx @@ -155,7 +155,7 @@ describe('useOutputOptions', () => { size="s" > { size="s" > { size="s" > { size="s" > { size="s" > { size="s" > { size="s" > { size="s" >