-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solutions] Update new user details flyout to be consistent …
…with Expandable Alerts Flyout (#169514) ## Summary Update new user details flyout to be consistent with Expandable Alerts Flyout. The previous user details flyout implementation was hidden behind a flag and never went live. ![Screenshot 2023-11-09 at 15 42 59](https://github.com/elastic/kibana/assets/1490444/0e4dee8a-0319-4531-8dcf-81cd88526aeb) ### What is included * Update new user details flyout to use the expandable flyout component * Update UI components according to the new design * Keep the feature hidden behind newUserDetailsFlyout flag * Supporting alert risk inputs ### What is NOT included * Supporting multiple categories of risk inputs * Host details flyout * User and host pages * Asset integrations (okta and azure) * Update the flyout on the timeline (It is currently a technical restriction of the expandable flyout, but the team is working to fix it) ### How to test it? * Enable experimental flag `newUserDetailsFlyout` `xpack.securitySolution.enableExperimental: ['newUserDetailsFlyout']` * Create alerts and open alerts page * Click on a username - [x] Test edge cases - [x] No cases permissions (it hides cases actions) - [x] Basic license (it hides the risk score summary) - [x] No risk score data for a user (It hides the risk score summary) <img width="434" alt="Screenshot 2023-11-13 at 15 56 33" src="https://github.com/elastic/kibana/assets/1490444/4fc13042-cd3d-487b-9982-bfbf02f003b4"> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- Loading branch information
Showing
86 changed files
with
2,540 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
180 changes: 180 additions & 0 deletions
180
..._actions/lens_attributes/common/risk_scores/__snapshots__/risk_score_summary.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
...nents/visualization_actions/lens_attributes/common/risk_scores/risk_score_summary.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { RiskScoreEntity } from '../../../../../../../common/risk_engine'; | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import { wrapper } from '../../../mocks'; | ||
import { useLensAttributes } from '../../../use_lens_attributes'; | ||
import { getRiskScoreSummaryAttributes } from './risk_score_summary'; | ||
import { RiskSeverity } from '../../../../../../../common/search_strategy'; | ||
import type { MetricVisualizationState } from '@kbn/lens-plugin/public'; | ||
|
||
jest.mock('../../../../../containers/sourcerer', () => ({ | ||
useSourcererDataView: jest.fn().mockReturnValue({ | ||
selectedPatterns: ['auditbeat-mytest-*'], | ||
dataViewId: 'security-solution-my-test', | ||
indicesExist: true, | ||
}), | ||
})); | ||
|
||
jest.mock('uuid', () => ({ | ||
v4: jest.fn().mockReturnValue('2cc5663b-f062-43f8-8688-fc8166c2ca8e'), | ||
})); | ||
|
||
describe('getRiskScoreSummaryAttributes', () => { | ||
it('should render', () => { | ||
const { result } = renderHook( | ||
() => | ||
useLensAttributes({ | ||
lensAttributes: getRiskScoreSummaryAttributes({ | ||
severity: RiskSeverity.low, | ||
query: `user.name: test.user`, | ||
spaceId: 'default', | ||
riskEntity: RiskScoreEntity.user, | ||
}), | ||
}), | ||
{ wrapper } | ||
); | ||
|
||
expect(result?.current).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders the subtitle', () => { | ||
const { result } = renderHook( | ||
() => | ||
useLensAttributes({ | ||
lensAttributes: getRiskScoreSummaryAttributes({ | ||
severity: RiskSeverity.low, | ||
query: `user.name: test.user`, | ||
spaceId: 'default', | ||
riskEntity: RiskScoreEntity.user, | ||
}), | ||
}), | ||
{ wrapper } | ||
); | ||
|
||
expect((result?.current?.state.visualization as MetricVisualizationState).subtitle).toBe('Low'); | ||
}); | ||
|
||
it('renders the query when applyGlobalQueriesAndFilters is false', () => { | ||
const query = `test.field: test.user`; | ||
|
||
const { result } = renderHook( | ||
() => | ||
useLensAttributes({ | ||
lensAttributes: getRiskScoreSummaryAttributes({ | ||
severity: RiskSeverity.low, | ||
query, | ||
spaceId: 'default', | ||
riskEntity: RiskScoreEntity.user, | ||
}), | ||
applyGlobalQueriesAndFilters: false, | ||
}), | ||
{ wrapper } | ||
); | ||
|
||
expect(result?.current?.state.query.query).toBe(query); | ||
}); | ||
}); |
Oops, something went wrong.