From 5ba8f0f32f527ace05eb6a197679a48baf0f0c1c Mon Sep 17 00:00:00 2001 From: machadoum Date: Fri, 1 Nov 2024 10:42:33 +0100 Subject: [PATCH] Fix dashboard page when risk engine and entity store are installed but disabled --- .../components/dashboard_panels.tsx | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx index 99e2475f95a78..dda65a9ee8122 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx @@ -141,13 +141,14 @@ const EntityStoreDashboardPanelsComponent = () => { ); } - const isRiskScoreAvailable = + // Risk score could be installed but disabled + const isRiskScoreInstalled = riskEngineStatus.data && riskEngineStatus.data.risk_engine_status !== RiskEngineStatusEnum.NOT_INSTALLED; return ( - {entityStore.status === 'error' && isRiskScoreAvailable && ( + {entityStore.status === 'stopped' && isRiskScoreInstalled && ( <> {callouts} @@ -158,7 +159,19 @@ const EntityStoreDashboardPanelsComponent = () => { )} - {entityStore.status === 'error' && !isRiskScoreAvailable && ( + + {entityStore.status === 'error' && isRiskScoreInstalled && ( + <> + {callouts} + + + + + + + + )} + {entityStore.status === 'error' && !isRiskScoreInstalled && ( <> {callouts} @@ -170,7 +183,7 @@ const EntityStoreDashboardPanelsComponent = () => { )} - {entityStore.status === 'enabled' && isRiskScoreAvailable && ( + {entityStore.status === 'enabled' && isRiskScoreInstalled && ( <> @@ -183,7 +196,7 @@ const EntityStoreDashboardPanelsComponent = () => { )} - {entityStore.status === 'enabled' && !isRiskScoreAvailable && ( + {entityStore.status === 'enabled' && !isRiskScoreInstalled && ( <> { )} - {entityStore.status === 'not_installed' && !isRiskScoreAvailable && ( + {entityStore.status === 'not_installed' && !isRiskScoreInstalled && ( // TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status { /> )} - {entityStore.status === 'not_installed' && isRiskScoreAvailable && ( + {entityStore.status === 'not_installed' && isRiskScoreInstalled && ( <> { visible={modal.visible} toggle={(visible) => setModalState({ visible })} enableStore={enableEntityStore} - riskScore={{ disabled: isRiskScoreAvailable, checked: !isRiskScoreAvailable }} + riskScore={{ disabled: isRiskScoreInstalled, checked: !isRiskScoreInstalled }} entityStore={{ disabled: entityStore.status === 'enabled', checked: entityStore.status !== 'enabled',