From 4e7f9460e506aa54ea28384f844bd453883c7183 Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Mon, 19 Jul 2021 16:36:13 +0100 Subject: [PATCH] bugfix: default to null when agentPolicy not loaded (#106092) --- .../agent_details/agent_details_overview.tsx | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx index fb80611e5295..9567fc3f372c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx @@ -133,33 +133,37 @@ export const AgentDetailsOverviewSection: React.FunctionComponent<{ title: i18n.translate('xpack.fleet.agentDetails.monitorLogsLabel', { defaultMessage: 'Monitor logs', }), - description: agentPolicy?.monitoring_enabled?.includes('logs') ? ( - - ) : ( - - ), + description: Array.isArray(agentPolicy?.monitoring_enabled) ? ( + agentPolicy?.monitoring_enabled?.includes('logs') ? ( + + ) : ( + + ) + ) : null, }, { title: i18n.translate('xpack.fleet.agentDetails.monitorMetricsLabel', { defaultMessage: 'Monitor metrics', }), - description: agentPolicy?.monitoring_enabled?.includes('metrics') ? ( - - ) : ( - - ), + description: Array.isArray(agentPolicy?.monitoring_enabled) ? ( + agentPolicy?.monitoring_enabled?.includes('metrics') ? ( + + ) : ( + + ) + ) : null, }, ].map(({ title, description }) => { return (