-
Notifications
You must be signed in to change notification settings - Fork 8k
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] [Attack discovery] Fixes Attack discovery loading popover issues #183675
[Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues #183675
Conversation
…ing popover issues ### Summary This PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state ### Desk testing 1) Configure at least two generative AI connectors 2) Clear local storage 3) Close all open browser tabs with sessions to Kibana 4) Navigate to Security > Attack discovery 5) Select the first connector 6) Click Generate **Expected results** - While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the selected connector - Attack discoveries are generated for the selected connector 7) Once again, click Generate **Expected result** - While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage 8) Click the information (i) icon **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover includes the time of the last generation 9) Click anywhere outside the popover **Expected results** - The popover closes 10) Keep opening and closing the popover while the selected connector is loading **Expected results** - The popover continues to open and close as expected - Attack discoveries are once again generated for the currently selected connector 11) Select the other (2nd) connector **Expected results** - The `Up to 20 alerts will be analyzed` empty state is displayed 12) Click Generate for the newly-selected connector **Expected results** - While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the newly selected connector - Attack discoveries are generated for the newly selected connector 13) Once again, click Generate **Expected result** - While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage for the selected (2nd) connector 14) Click on the information (i) icon (popover anchor) **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover contains one date (for the previous generation) 15) Click anywhere outside the popover **Expected results** - The popover closes 16) While the 2nd connector is STILL loading, select the first connector **Expected result** - The cached attack discovery results for the first connector are displayed - The loading callout is hidden - The Generate button is disabled, and instead displays the text `Loading...` 17) While the 2nd connector is STILL loading, re-select the 2nd connector **Expected result** - The countdown timer is once again displayed, because the 2nd connector's was still loading - Attack discoveries are generated for the 2nd connector 18) Close the browser 19) Open the browser 20) Navigate to Security > Attack discovery **Expected result** - The 2nd connector is still selected 21) Click Generate **Expected result** - While loading, the information (i) icon (popover anchor) will be displayed, because it's using the results from local storage 22) Click on the information (i) icon (popover anchor) **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover contains two datetimes, for the two previous runs of the 2nd connector 23) Click anywhere outside the popover **Expected results** - The popover closes
Pinging @elastic/security-solution (Team: SecuritySolution) |
In our testing we noticed that if there exists multiple connectors having Expected result here would be that no timer or info callout is shown for any connector except the one currently generating. |
@@ -87,7 +97,7 @@ export const getLocalStorageGenerationIntervals = ( | |||
key: string | |||
): Record<string, GenerationInterval[]> | null => { | |||
if (!isEmpty(key)) { | |||
return decodeGenerationIntervals(sessionStorage.getItem(key) ?? ''); | |||
return decodeGenerationIntervals(localStorage.getItem(key) ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -76,8 +76,18 @@ export const encodeGenerationIntervals = ( | |||
export const decodeGenerationIntervals = ( | |||
generationIntervals: string | |||
): Record<string, GenerationInterval[]> | null => { | |||
const parseDate = (key: string, value: unknown) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find on the extra guarding here
describe('encodeGenerationIntervals', () => { | ||
it('returns null when generationIntervals is invalid', () => { | ||
const invalidGenerationIntervals: Record<string, GenerationInterval[]> = | ||
1n as unknown as Record<string, GenerationInterval[]>; // <-- invalid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a BigInt
! Nice way of exercising JSON.stringify()
here, didn't know about this one 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reproduced issue on main
, then checked out, tested fix locally, and code reviewed. LGTM! 👍
In pair-testing we noticed the one minor issue documented above, but it is minor and not necessary to fix here and now.
💚 Build Succeeded
Metrics [docs]Async chunks
To update your PR or re-run it, just comment with: |
… popover issues (elastic#183675) ## [Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues ### Summary This PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state ### Desk testing 1) Configure at least two generative AI connectors 2) Clear local storage 3) Close all open browser tabs with sessions to Kibana 4) Navigate to Security > Attack discovery 5) Select the first connector 6) Click Generate **Expected results** - While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the selected connector - Attack discoveries are generated for the selected connector 7) Once again, click Generate **Expected result** - While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage 8) Click the information (i) icon **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover includes the time of the last generation 9) Click anywhere outside the popover **Expected results** - The popover closes 10) Keep opening and closing the popover while the selected connector is loading **Expected results** - The popover continues to open and close as expected - Attack discoveries are once again generated for the currently selected connector 11) Select the other (2nd) connector **Expected results** - The `Up to 20 alerts will be analyzed` empty state is displayed 12) Click Generate for the newly-selected connector **Expected results** - While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the newly selected connector - Attack discoveries are generated for the newly selected connector 13) Once again, click Generate **Expected result** - While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage for the selected (2nd) connector 14) Click on the information (i) icon (popover anchor) **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover contains one date (for the previous generation) 15) Click anywhere outside the popover **Expected results** - The popover closes 16) While the 2nd connector is STILL loading, select the first connector **Expected result** - The cached attack discovery results for the first connector are displayed - The loading callout is hidden - The Generate button is disabled, and instead displays the text `Loading...` 17) While the 2nd connector is STILL loading, re-select the 2nd connector **Expected result** - The countdown timer is once again displayed, because the 2nd connector's was still loading - Attack discoveries are generated for the 2nd connector 18) Close the browser 19) Open the browser 20) Navigate to Security > Attack discovery **Expected result** - The 2nd connector is still selected 21) Click Generate **Expected result** - While loading, the information (i) icon (popover anchor) will be displayed, because it's using the results from local storage 22) Click on the information (i) icon (popover anchor) **Expected result** - The popover containing the text `Remaining time is based on the average speed...` is displayed - The popover contains two datetimes, for the two previous runs of the 2nd connector 23) Click anywhere outside the popover **Expected results** - The popover closes (cherry picked from commit fd4de54)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…loading popover issues (#183675) (#183680) # Backport This will backport the following commits from `main` to `8.14`: - [[Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues (#183675)](#183675) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Andrew Macri","email":"andrew.macri@elastic.co"},"sourceCommit":{"committedDate":"2024-05-16T20:14:48Z","message":"[Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues (#183675)\n\n## [Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues\r\n\r\n### Summary\r\n\r\nThis PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state\r\n\r\n### Desk testing\r\n\r\n1) Configure at least two generative AI connectors\r\n\r\n2) Clear local storage\r\n\r\n3) Close all open browser tabs with sessions to Kibana\r\n\r\n4) Navigate to Security > Attack discovery\r\n\r\n5) Select the first connector\r\n\r\n6) Click Generate\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the selected connector\r\n- Attack discoveries are generated for the selected connector\r\n\r\n7) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage\r\n\r\n8) Click the information (i) icon\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover includes the time of the last generation\r\n\r\n9) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n10) Keep opening and closing the popover while the selected connector is loading\r\n\r\n**Expected results**\r\n\r\n- The popover continues to open and close as expected\r\n- Attack discoveries are once again generated for the currently selected connector\r\n\r\n11) Select the other (2nd) connector\r\n\r\n**Expected results**\r\n\r\n- The `Up to 20 alerts will be analyzed` empty state is displayed\r\n\r\n12) Click Generate for the newly-selected connector\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the newly selected connector\r\n- Attack discoveries are generated for the newly selected connector\r\n\r\n13) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage for the selected (2nd) connector\r\n\r\n14) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains one date (for the previous generation)\r\n\r\n15) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n16) While the 2nd connector is STILL loading, select the first connector\r\n\r\n**Expected result**\r\n\r\n- The cached attack discovery results for the first connector are displayed\r\n- The loading callout is hidden\r\n- The Generate button is disabled, and instead displays the text `Loading...`\r\n\r\n17) While the 2nd connector is STILL loading, re-select the 2nd connector\r\n\r\n**Expected result**\r\n\r\n- The countdown timer is once again displayed, because the 2nd connector's was still loading\r\n- Attack discoveries are generated for the 2nd connector\r\n\r\n18) Close the browser\r\n\r\n19) Open the browser\r\n\r\n20) Navigate to Security > Attack discovery\r\n\r\n**Expected result**\r\n\r\n- The 2nd connector is still selected\r\n\r\n21) Click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) will be displayed, because it's using the results from local storage\r\n\r\n22) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains two datetimes, for the two previous runs of the 2nd connector\r\n\r\n23) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes","sha":"fd4de545caf796a87de8472df96d1f1e47c068be","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team: SecuritySolution","Team:Security Generative AI","v8.14.0","v8.15.0","Feature:Attack Discovery"],"title":"[Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues","number":183675,"url":"#183675 Solution] [Attack discovery] Fixes Attack discovery loading popover issues (#183675)\n\n## [Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues\r\n\r\n### Summary\r\n\r\nThis PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state\r\n\r\n### Desk testing\r\n\r\n1) Configure at least two generative AI connectors\r\n\r\n2) Clear local storage\r\n\r\n3) Close all open browser tabs with sessions to Kibana\r\n\r\n4) Navigate to Security > Attack discovery\r\n\r\n5) Select the first connector\r\n\r\n6) Click Generate\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the selected connector\r\n- Attack discoveries are generated for the selected connector\r\n\r\n7) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage\r\n\r\n8) Click the information (i) icon\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover includes the time of the last generation\r\n\r\n9) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n10) Keep opening and closing the popover while the selected connector is loading\r\n\r\n**Expected results**\r\n\r\n- The popover continues to open and close as expected\r\n- Attack discoveries are once again generated for the currently selected connector\r\n\r\n11) Select the other (2nd) connector\r\n\r\n**Expected results**\r\n\r\n- The `Up to 20 alerts will be analyzed` empty state is displayed\r\n\r\n12) Click Generate for the newly-selected connector\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the newly selected connector\r\n- Attack discoveries are generated for the newly selected connector\r\n\r\n13) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage for the selected (2nd) connector\r\n\r\n14) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains one date (for the previous generation)\r\n\r\n15) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n16) While the 2nd connector is STILL loading, select the first connector\r\n\r\n**Expected result**\r\n\r\n- The cached attack discovery results for the first connector are displayed\r\n- The loading callout is hidden\r\n- The Generate button is disabled, and instead displays the text `Loading...`\r\n\r\n17) While the 2nd connector is STILL loading, re-select the 2nd connector\r\n\r\n**Expected result**\r\n\r\n- The countdown timer is once again displayed, because the 2nd connector's was still loading\r\n- Attack discoveries are generated for the 2nd connector\r\n\r\n18) Close the browser\r\n\r\n19) Open the browser\r\n\r\n20) Navigate to Security > Attack discovery\r\n\r\n**Expected result**\r\n\r\n- The 2nd connector is still selected\r\n\r\n21) Click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) will be displayed, because it's using the results from local storage\r\n\r\n22) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains two datetimes, for the two previous runs of the 2nd connector\r\n\r\n23) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes","sha":"fd4de545caf796a87de8472df96d1f1e47c068be"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#183675 Solution] [Attack discovery] Fixes Attack discovery loading popover issues (#183675)\n\n## [Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues\r\n\r\n### Summary\r\n\r\nThis PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state\r\n\r\n### Desk testing\r\n\r\n1) Configure at least two generative AI connectors\r\n\r\n2) Clear local storage\r\n\r\n3) Close all open browser tabs with sessions to Kibana\r\n\r\n4) Navigate to Security > Attack discovery\r\n\r\n5) Select the first connector\r\n\r\n6) Click Generate\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the selected connector\r\n- Attack discoveries are generated for the selected connector\r\n\r\n7) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage\r\n\r\n8) Click the information (i) icon\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover includes the time of the last generation\r\n\r\n9) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n10) Keep opening and closing the popover while the selected connector is loading\r\n\r\n**Expected results**\r\n\r\n- The popover continues to open and close as expected\r\n- Attack discoveries are once again generated for the currently selected connector\r\n\r\n11) Select the other (2nd) connector\r\n\r\n**Expected results**\r\n\r\n- The `Up to 20 alerts will be analyzed` empty state is displayed\r\n\r\n12) Click Generate for the newly-selected connector\r\n\r\n**Expected results**\r\n\r\n- While loading, the information (i) icon (popover anchor) will NOT be displayed, because it's the first generation interval for the newly selected connector\r\n- Attack discoveries are generated for the newly selected connector\r\n\r\n13) Once again, click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) IS displayed, because there's now at least one generation interval available in local storage for the selected (2nd) connector\r\n\r\n14) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains one date (for the previous generation)\r\n\r\n15) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes\r\n\r\n16) While the 2nd connector is STILL loading, select the first connector\r\n\r\n**Expected result**\r\n\r\n- The cached attack discovery results for the first connector are displayed\r\n- The loading callout is hidden\r\n- The Generate button is disabled, and instead displays the text `Loading...`\r\n\r\n17) While the 2nd connector is STILL loading, re-select the 2nd connector\r\n\r\n**Expected result**\r\n\r\n- The countdown timer is once again displayed, because the 2nd connector's was still loading\r\n- Attack discoveries are generated for the 2nd connector\r\n\r\n18) Close the browser\r\n\r\n19) Open the browser\r\n\r\n20) Navigate to Security > Attack discovery\r\n\r\n**Expected result**\r\n\r\n- The 2nd connector is still selected\r\n\r\n21) Click Generate\r\n\r\n**Expected result**\r\n\r\n- While loading, the information (i) icon (popover anchor) will be displayed, because it's using the results from local storage\r\n\r\n22) Click on the information (i) icon (popover anchor)\r\n\r\n**Expected result**\r\n\r\n- The popover containing the text `Remaining time is based on the average speed...` is displayed\r\n- The popover contains two datetimes, for the two previous runs of the 2nd connector\r\n\r\n23) Click anywhere outside the popover\r\n\r\n**Expected results**\r\n\r\n- The popover closes","sha":"fd4de545caf796a87de8472df96d1f1e47c068be"}}]}] BACKPORT--> Co-authored-by: Andrew Macri <andrew.macri@elastic.co>
[Security Solution] [Attack discovery] Fixes Attack discovery loading popover issues
Summary
This PR fixes issues related to the Attack discovery loading popover, where it may not be displayed, or get stuck in an open state
Desk testing
Configure at least two generative AI connectors
Clear local storage
Close all open browser tabs with sessions to Kibana
Navigate to Security > Attack discovery
Select the first connector
Click Generate
Expected results
Expected result
Expected result
Remaining time is based on the average speed...
is displayedExpected results
Expected results
Expected results
Up to 20 alerts will be analyzed
empty state is displayedExpected results
Expected result
Expected result
Remaining time is based on the average speed...
is displayedExpected results
Expected result
Loading...
Expected result
Close the browser
Open the browser
Navigate to Security > Attack discovery
Expected result
Expected result
Expected result
Remaining time is based on the average speed...
is displayedExpected results