[Security Solution][Investigations] - fix opening flyout, and clear filters#156702
[Security Solution][Investigations] - fix opening flyout, and clear filters#156702michaelolo24 merged 7 commits intoelastic:mainfrom
Conversation
d90d2da to
7f20d1d
Compare
7f20d1d to
094b677
Compare
|
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
| it('should remove the flyout details from local storage when closed', () => { | ||
| cy.get(OVERVIEW_RULE).should('be.visible'); | ||
| closeAlertFlyout(); | ||
| cy.wait(500); // Wait for the localStorage update to take place |
There was a problem hiding this comment.
Did the tests show that it needs 500ms before the localstorage write has finished? I would expect that 100ms should be enough, plus a little buffer.
There was a problem hiding this comment.
No, it's because of how we handle the localStorage updates:
There was a problem hiding this comment.
should add timeout/pipe on assertion instead of delay. Because if someone changes the delay, test will start failing.
| it('should not remove the flyout state from localstorage when navigating away without closing the flyout', () => { | ||
| cy.get(OVERVIEW_RULE).should('be.visible'); | ||
| goToRuleDetails(); | ||
| cy.wait(500); // Wait for the localStorage update to take place |
There was a problem hiding this comment.
There was a problem hiding this comment.
Was able to get help from Jatin to refactor this to not explicitly rely on specific timerange 💪🏾 Thanks for the review!
| export const getClassSelector = (className: string) => `.${className}`; | ||
|
|
||
| export const getLocalstorageEntryAsObject = (storage: Cypress.StorageByOrigin, field: string) => { | ||
| const envLocalstorage = storage?.['http://localhost:5620']; |
There was a problem hiding this comment.
Is the test env url always 'http://localhost:5620 ?
There was a problem hiding this comment.
There was a problem hiding this comment.
Gotcha. Somehow I feel like this should be a const, though :D
|
|
||
| const url = `${ALERTS_PATH}?${URL_PARAM_KEY.appQuery}=${kqlAppQuery}&${URL_PARAM_KEY.timerange}=${timerange}&${URL_PARAM_KEY.eventFlyout}=${flyoutString}`; | ||
| const statusPageFilter: FilterItemObj = { | ||
| fieldName: 'kibana.alert.workflow_status', |
There was a problem hiding this comment.
Wdyt about using this const instead?
import { ALERT_WORKFLOW_STATUS } from '@kbn/rule-data-utils';
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
banderror
left a comment
There was a problem hiding this comment.
Rules area changes LGTM!
e40pud
left a comment
There was a problem hiding this comment.
Alerts area changes LGTM!
…ilters (elastic#156702) ## Summary This PR fixes the following issue elastic#156590 where a users configuration for their alert page filters can prevent them from seeing the alert in the table. In this PR we clear the filters to only show the required status filter, with no selection, to rely primarily on the kql query filter for the alert id. Demo: https://user-images.githubusercontent.com/17211684/236332095-ac5583ec-6b5f-4ee2-9c23-9391b54263ba.mov It also fixes a bug where the flyout when opened wasn't unmounted when navigating away from a page and back to it as seen here: The bug: https://user-images.githubusercontent.com/17211684/236333550-b41925f9-a06c-4aa9-931b-beecf4c9ae9b.mov With the fix: https://user-images.githubusercontent.com/17211684/236334123-a0e3169e-2ec8-4754-92d2-65f2f369fa4f.mov ### Checklist Delete any items that are not applicable to this PR. - [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 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 1b40216)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…lear filters (#156702) (#156984) # Backport This will backport the following commits from `main` to `8.8`: - [[Security Solution][Investigations] - fix opening flyout, and clear filters (#156702)](#156702) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Michael Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2023-05-08T12:29:20Z","message":"[Security Solution][Investigations] - fix opening flyout, and clear filters (#156702)\n\n## Summary\r\n\r\nThis PR fixes the following issue\r\nhttps://github.com//issues/156590 where a users\r\nconfiguration for their alert page filters can prevent them from seeing\r\nthe alert in the table. In this PR we clear the filters to only show the\r\nrequired status filter, with no selection, to rely primarily on the kql\r\nquery filter for the alert id.\r\n\r\nDemo: \r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236332095-ac5583ec-6b5f-4ee2-9c23-9391b54263ba.mov\r\n\r\n\r\nIt also fixes a bug where the flyout when opened wasn't unmounted when\r\nnavigating away from a page and back to it as seen here:\r\n\r\nThe bug:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236333550-b41925f9-a06c-4aa9-931b-beecf4c9ae9b.mov\r\n\r\nWith the fix:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236334123-a0e3169e-2ec8-4754-92d2-65f2f369fa4f.mov\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1b40216e781b4bcd4d1bf5180aa505c266b29082","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","impact:medium","Team:Threat Hunting","Team: SecuritySolution","Team:Threat Hunting:Investigations","v8.8.0","v8.9.0"],"number":156702,"url":"https://github.com/elastic/kibana/pull/156702","mergeCommit":{"message":"[Security Solution][Investigations] - fix opening flyout, and clear filters (#156702)\n\n## Summary\r\n\r\nThis PR fixes the following issue\r\nhttps://github.com//issues/156590 where a users\r\nconfiguration for their alert page filters can prevent them from seeing\r\nthe alert in the table. In this PR we clear the filters to only show the\r\nrequired status filter, with no selection, to rely primarily on the kql\r\nquery filter for the alert id.\r\n\r\nDemo: \r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236332095-ac5583ec-6b5f-4ee2-9c23-9391b54263ba.mov\r\n\r\n\r\nIt also fixes a bug where the flyout when opened wasn't unmounted when\r\nnavigating away from a page and back to it as seen here:\r\n\r\nThe bug:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236333550-b41925f9-a06c-4aa9-931b-beecf4c9ae9b.mov\r\n\r\nWith the fix:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236334123-a0e3169e-2ec8-4754-92d2-65f2f369fa4f.mov\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1b40216e781b4bcd4d1bf5180aa505c266b29082"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156702","number":156702,"mergeCommit":{"message":"[Security Solution][Investigations] - fix opening flyout, and clear filters (#156702)\n\n## Summary\r\n\r\nThis PR fixes the following issue\r\nhttps://github.com//issues/156590 where a users\r\nconfiguration for their alert page filters can prevent them from seeing\r\nthe alert in the table. In this PR we clear the filters to only show the\r\nrequired status filter, with no selection, to rely primarily on the kql\r\nquery filter for the alert id.\r\n\r\nDemo: \r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236332095-ac5583ec-6b5f-4ee2-9c23-9391b54263ba.mov\r\n\r\n\r\nIt also fixes a bug where the flyout when opened wasn't unmounted when\r\nnavigating away from a page and back to it as seen here:\r\n\r\nThe bug:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236333550-b41925f9-a06c-4aa9-931b-beecf4c9ae9b.mov\r\n\r\nWith the fix:\r\n\r\n\r\nhttps://user-images.githubusercontent.com/17211684/236334123-a0e3169e-2ec8-4754-92d2-65f2f369fa4f.mov\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"1b40216e781b4bcd4d1bf5180aa505c266b29082"}}]}] BACKPORT--> Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
Summary
This PR fixes the following issue #156590 where a users configuration for their alert page filters can prevent them from seeing the alert in the table. In this PR we clear the filters to only show the required status filter, with no selection, to rely primarily on the kql query filter for the alert id.
Demo:
Screen.Recording.2023-05-04.at.5.13.43.PM.mov
It also fixes a bug where the flyout when opened wasn't unmounted when navigating away from a page and back to it as seen here:
The bug:
Screen.Recording.2023-05-04.at.5.25.05.PM.mov
With the fix:
Screen.Recording.2023-05-04.at.5.28.04.PM.mov
Checklist
Delete any items that are not applicable to this PR.