Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.16] [SecuritySolution] Fix dashboard page when the entity store state is stopped (#198645) #198659

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const EntityStoreDashboardPanelsComponent = () => {
);
}

// TODO Rename variable because the Risk score could be installed but disabled
const isRiskScoreAvailable =
riskEngineStatus.data &&
riskEngineStatus.data.risk_engine_status !== RiskEngineStatusEnum.NOT_INSTALLED;
Expand Down Expand Up @@ -199,35 +200,37 @@ const EntityStoreDashboardPanelsComponent = () => {
</>
)}

{entityStore.status === 'not_installed' && !isRiskScoreAvailable && (
// TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status
<EnableEntityStore
enablements="both"
onEnable={() => setModalState({ visible: true })}
loadingRiskEngine={riskEngineInitializing}
/>
)}
{(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
<EnableEntityStore
enablements="both"
onEnable={() => setModalState({ visible: true })}
loadingRiskEngine={riskEngineInitializing}
/>
)}

{entityStore.status === 'not_installed' && isRiskScoreAvailable && (
<>
<EuiFlexItem>
<EnableEntityStore
enablements="store"
onEnable={() =>
setModalState({
visible: true,
})
}
/>
</EuiFlexItem>
<EuiFlexItem>
<EntityAnalyticsRiskScores riskEntity={RiskScoreEntity.user} />
</EuiFlexItem>
<EuiFlexItem>
<EntityAnalyticsRiskScores riskEntity={RiskScoreEntity.host} />
</EuiFlexItem>
</>
)}
{(entityStore.status === 'not_installed' || entityStore.status === 'stopped') &&
isRiskScoreAvailable && (
<>
<EuiFlexItem>
<EnableEntityStore
enablements="store"
onEnable={() =>
setModalState({
visible: true,
})
}
/>
</EuiFlexItem>
<EuiFlexItem>
<EntityAnalyticsRiskScores riskEntity={RiskScoreEntity.user} />
</EuiFlexItem>
<EuiFlexItem>
<EntityAnalyticsRiskScores riskEntity={RiskScoreEntity.host} />
</EuiFlexItem>
</>
)}

<EntityStoreEnablementModal
visible={modal.visible}
Expand Down