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

[Security Solution] [Detection & Response] 131827 Update Detections Response view with pagination and opening numbers in timeline #131828

Conversation

jamster10
Copy link
Contributor

@jamster10 jamster10 commented May 9, 2022

#131827

To test this PR locally: add xpack.securitySolution.enableExperimental: [‘detectionResponseEnabled’] to your kibana.dev.yml

@elastic/security-threat-hunting-investigations:
The change is exporting getDataProvider, to allow for navigating to the Timeline flyout.

Figma: https://www.figma.com/file/yGGkXDuUQzoR7faSVu6F9p/OOTB-Dashboard-for-analysts?node-id=1080%3A113129

Recording 2022-05-17 at 16 31 29

Bugs fixed in this ticket:

  • header font size of alerts chart needs to be uniform with other headers

Enhancements:

  • Update headers of vulnerable tables to new name "hosts/users by alert severity" & add tooltip for max results

  • Add ability for clicking on numbers to link to a timeline

  • Change alert colour scheme to match current alert colours

  • Implement pagination for vulnerable host/user tables and remove buttons.

  • Add cypress tests for testing navigation to timeline

  • Remove feature flag?

Background Conversations:

QA:

Information about the view:

For 8.3 We are only building the sections noted in this document by the thumbs up (with green circle) further work is slated potentially for 8.4.

Please refer to that document for more information about this project, but find some things noted below:

  • Open/Acknowledged/Closed hyperlinks in alerts chart are not clickable as the app does not have the ability to route to those specific sections in Alerts page. (we can for open, but not closed or acknowledged, so we have opted to make none of them clickable

  • Same as above with hyperlinks in cases chart

  • Alert / Alert counts for each table have been requested to link to timelines. For eg:

image

clicking 7 would link to a timeline filtered by alerts by host.name: "Win 8"

Permissions
If a user does not have case permissions, no case chart or tables will be seen.
If a user does not have alerts permissions, no alert chart or tables will be seen.
If a user has not pertinent permissions, they will see a no permissioned view.

Checklist

@jamster10 jamster10 requested a review from a team as a code owner May 9, 2022 17:40
@jamster10 jamster10 marked this pull request as draft May 9, 2022 17:40
@jamster10 jamster10 added backport:skip This commit does not require backporting Team:Threat Hunting Security Solution Threat Hunting Team release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Explore v8.3.0 labels May 17, 2022
@jamster10 jamster10 self-assigned this May 17, 2022
@jamster10 jamster10 marked this pull request as ready for review May 17, 2022 21:43
@jamster10 jamster10 requested a review from a team as a code owner May 17, 2022 21:43
@jamster10 jamster10 force-pushed the 131827-Detection-response-product-and-design-changes branch from cd0582b to 90414d6 Compare May 17, 2022 21:51
@@ -76,7 +76,7 @@ describe('CasesTable', () => {
mockUseCaseItemsReturn({ isLoading: false });
const { getByText } = renderComponent();

expect(getByText('Updated now')).toBeInTheDocument();
expect(getByText(/Updated/)).toBeInTheDocument();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are async, and caused flaky tests with 'now' not being in the doc as time passed before the check. So instead we're just checking that this part of the text is there.

@jamster10 jamster10 requested a review from semd May 17, 2022 22:01
@jamster10 jamster10 force-pushed the 131827-Detection-response-product-and-design-changes branch from 90414d6 to 170df13 Compare May 17, 2022 22:19
expect(queryByTestId('hostTablePaginator')).toBeInTheDocument();

fireEvent.click(page3);
expect(mockSetPage).toHaveBeenCalledWith(2);
Copy link
Contributor Author

@jamster10 jamster10 May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paginator uses 0 based index, so 3rd page is at index 2

@jamster10 jamster10 requested a review from angorayc May 18, 2022 02:56
@jamster10 jamster10 changed the title Update Detections Response view based on dialogue with design and product [Security Solution] [Detection & Response] 131827 Update Detections Response view with pagination and opening numbers in timeline May 18, 2022
@jamster10
Copy link
Contributor Author

@elasticmachine merge upstream

<EuiTablePagination
data-test-subj="hostTablePaginator"
activePage={pagination.currentPage}
itemsPerPage={4}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want the user to be able to configure the per page count?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, hard coded to 4. I'll make it a const variable instead.

@@ -117,41 +108,53 @@ const getTableColumns: GetTableColumns = ({ getAppUrl, navigateTo }) => [
field: 'totalAlerts',
name: i18n.ALERTS_TEXT,
'data-test-subj': 'hostSeverityAlertsTable-totalAlerts',
render: (totalAlerts: number) => <FormattedCount count={totalAlerts} />,
render: (totalAlerts: number, { hostName }) => (
<EuiLink onClick={() => handleClick({ hostName })}>
Copy link
Contributor

@michaelolo24 michaelolo24 May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you store this anonymous function and the others in this file in a useCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :D. Thank you!

@@ -79,7 +81,11 @@ export const getTableColumns: GetTableColumns = ({ getAppUrl, navigateTo }) => [
field: 'alert_count',
name: i18n.RULE_ALERTS_COLUMN_ALERT_COUNT,
'data-test-subj': 'severityRuleAlertsTable-alertCount',
render: (alertCount: number) => <FormattedCount count={alertCount} />,
render: (alertCount: number, { name }) => (
<EuiLink onClick={() => openRuleInTimeline(name)}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here regarding the anonymous function in a useCallback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!


setPaginationData((p) => ({
...p,
pageCount: Math.ceil(
Copy link
Contributor

@michaelolo24 michaelolo24 May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, but you might be able to surface this to a util getPageCount which can be used here and in the hosts one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :D

import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline';
import { updateProviders } from '../../../../timelines/store/timeline/actions';

export const useNavigateToTimeline = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just quick reminder to sync with @kqualters-elastic on this

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few nits, but pulled down and tested and it works well! Thanks!

@jamster10
Copy link
Contributor Author

@elasticmachine merge upstream

@jamster10 jamster10 enabled auto-merge (squash) May 23, 2022 16:14
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
timelines 331 332 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 5.0MB 5.0MB +2.6KB
Unknown metric groups

API count

id before after diff
timelines 435 436 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jamster10

@jamster10 jamster10 merged commit f540c5e into elastic:main May 23, 2022
j-bennet pushed a commit to j-bennet/kibana that referenced this pull request Jun 2, 2022
…esponse view with pagination and opening numbers in timeline (elastic#131828)

* Fix alert colour pallete & alerts chart header size

* Add pagination and navigation to timeline capability

* fix translation name conflict

* Rename hook file to snake case to match elastic formatting

* Change name scheme oof navigateToTimeline to OpenInTimeline & remove styled components

Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.3.0
Projects
None yet
6 participants