From 92b97196d2a1c95c53b9fae32856d8a653c7bfb8 Mon Sep 17 00:00:00 2001 From: machadoum Date: Tue, 12 Nov 2024 13:55:52 +0100 Subject: [PATCH] Add Risk score missing privileges callout to enablement flyout --- .../components/dashboard_panels.tsx | 58 +++++++++---------- .../components/enablement_modal.tsx | 24 ++++++-- 2 files changed, 46 insertions(+), 36 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 d70eb9fe34b51..cdc947512aee0 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 @@ -200,37 +200,35 @@ const EntityStoreDashboardPanelsComponent = () => { )} - {(entityStore.status === 'not_installed' || entityStore.status === 'stopped') && - !isRiskScoreAvailable && ( - // TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status - setModalState({ visible: true })} - loadingRiskEngine={riskEngineInitializing} - /> - )} + {entityStore.status === 'not_installed' && !isRiskScoreAvailable && ( + // TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status + setModalState({ visible: true })} + loadingRiskEngine={riskEngineInitializing} + /> + )} - {(entityStore.status === 'not_installed' || entityStore.status === 'stopped') && - isRiskScoreAvailable && ( - <> - - - setModalState({ - visible: true, - }) - } - /> - - - - - - - - - )} + {entityStore.status === 'not_installed' && isRiskScoreAvailable && ( + <> + + + setModalState({ + visible: true, + }) + } + /> + + + + + + + + + )} } checked={enablements.riskScore} - disabled={riskScore.disabled || false} + disabled={ + riskScore.disabled || + (!riskEnginePrivileges.isLoading && !riskEnginePrivileges?.hasAllRequiredPrivileges) + } onChange={() => setEnablements((prev) => ({ ...prev, riskScore: !prev.riskScore }))} /> + {!riskEnginePrivileges.isLoading && !riskEnginePrivileges.hasAllRequiredPrivileges && ( + + + + )} {ENABLEMENT_DESCRIPTION_RISK_ENGINE_ONLY} - setEnablements((prev) => ({ ...prev, entityStore: !prev.entityStore })) @@ -119,9 +131,9 @@ export const EntityStoreEnablementModal: React.FC - {!privileges || privileges.has_all_required ? null : ( + {!entityEnginePrivileges || entityEnginePrivileges.has_all_required ? null : ( - + )}