Skip to content

Commit

Permalink
[8.16] [SecuritySolution] Fix dashboard page when the entity store st…
Browse files Browse the repository at this point in the history
…ate is stopped (#198645) (#198659)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[SecuritySolution] Fix dashboard page when the entity store state is
stopped (#198645)](#198645)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-01T11:58:01Z","message":"[SecuritySolution]
Fix dashboard page when the entity store state is stopped
(#198645)\n\n## Summary\r\n\r\nFix the dashboard page when the entity
store state is stopped\r\nPreviously, the EntityStoreDashboardPanels
component didn't account for\r\nthe installed but disabled state
(stopped).\r\n\r\nI made the minimum changes necessary to fix the bug,
but this component\r\nneeds to be refactored, unit-tested, and written
in a storybook with all\r\npossible states. Technical debt
Issue:\r\nhttps://github.com/elastic/security-team/issues/11035","sha":"34aab05595115289ed7b7f8c1fad7f282292a25b","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","v9.0.0","Team:
SecuritySolution","Theme: entity_analytics","Feature:Entity
Analytics","Team:Entity
Analytics","v8.16.0","backport:version","v8.17.0"],"title":"[SecuritySolution]
Fix dashboard page when the entity store state is
stopped","number":198645,"url":"https://github.com/elastic/kibana/pull/198645","mergeCommit":{"message":"[SecuritySolution]
Fix dashboard page when the entity store state is stopped
(#198645)\n\n## Summary\r\n\r\nFix the dashboard page when the entity
store state is stopped\r\nPreviously, the EntityStoreDashboardPanels
component didn't account for\r\nthe installed but disabled state
(stopped).\r\n\r\nI made the minimum changes necessary to fix the bug,
but this component\r\nneeds to be refactored, unit-tested, and written
in a storybook with all\r\npossible states. Technical debt
Issue:\r\nhttps://github.com/elastic/security-team/issues/11035","sha":"34aab05595115289ed7b7f8c1fad7f282292a25b"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198645","number":198645,"mergeCommit":{"message":"[SecuritySolution]
Fix dashboard page when the entity store state is stopped
(#198645)\n\n## Summary\r\n\r\nFix the dashboard page when the entity
store state is stopped\r\nPreviously, the EntityStoreDashboardPanels
component didn't account for\r\nthe installed but disabled state
(stopped).\r\n\r\nI made the minimum changes necessary to fix the bug,
but this component\r\nneeds to be refactored, unit-tested, and written
in a storybook with all\r\npossible states. Technical debt
Issue:\r\nhttps://github.com/elastic/security-team/issues/11035","sha":"34aab05595115289ed7b7f8c1fad7f282292a25b"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Pablo Machado <[email protected]>
  • Loading branch information
kibanamachine and machadoum authored Nov 1, 2024
1 parent 62f11d0 commit 8a52c06
Showing 1 changed file with 31 additions and 28 deletions.
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

0 comments on commit 8a52c06

Please sign in to comment.