-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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][Exceptions] - Updates exception hooks and viewer #73588
Conversation
…into exceptions_ui_find
…display more than two lists associated to rule
? filterOptions.tags.map((t) => `${namespace}.attributes.tags:${t}`) | ||
: []), | ||
]; | ||
const filters: string = filterOptions |
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.
What happens if listIds.length !== namespaceTypes.length
? Maybe could use some extra validation around that...
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.
👍 The backend has validation for it x-pack/plugins/lists/server/routes/find_exception_list_item_route.ts
(line 50)
); | ||
|
||
try { | ||
if (ids.length > 0 && namespaces.length > 0) { |
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.
What happens if they are not > 0?
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.
Just doesn't make the call here since there would be no lists to search.
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.
Updated so if ids are not > 0 then it still calls onSuccess but with defaults.
x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/common/components/exceptions/viewer/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lists/public/exceptions/hooks/use_exception_list.ts
Outdated
Show resolved
Hide resolved
const abortCtrl = new AbortController(); | ||
const { ids, namespaces } = lists | ||
.filter((list) => { | ||
if (showDetectionsListsOnly) { |
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.
This logic of filter and reduce looks like is duplicated elsewhere. Just mentioning in case you want to make it into a utility, but am fine if it needs to be duplicated here and later on but would be prone to possible changes/bug fixes in one vs. the other later.
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.
Moved to util and added test!
}) | ||
); | ||
await waitForNextUpdate(); | ||
await waitForNextUpdate(); |
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.
Interesting there has to be two updates before the expect. I trust it, but that is interesting to me. Is there a comment of why two are needed we can add here? Otherwise I always will be like 🤔 when I read this or work with it later.
Optional change of a comment. Not required.
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.
So did a bit of digging. The first one is initialization. I added a note to them all.
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.
Read through it, a few optionals and I might not be the best person to trust giving a front end 👍 but I appreciate the extra conversations about your experience with the react reducer for my education of later when I make front end changes.
Everything looks clean enough and the demo of it looked great. Can't wait to see it in the product.
Pinging @elastic/siem (Team:SIEM) |
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.
Pulled down the branch and did some testing on the feature. Looks to be functioning well. Thanks!
💚 Build SucceededBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
…lastic#73588) ## Summary This PR focuses on addressing issues around the pagination and functionality of rules with numerous (2+) exception lists. - Updated the `use_exception_list.ts` hook to make use of the new multi list find API - Updated the viewer to make use of the new multi list find API - Previously was doing a lot of the filtering and paging manually (and badly) in the UI, now the _find takes care of all that - Added logic for showing `No results` text if user filter/search returns no items - Previously would show the `This rule has not exceptions` text
…lastic#73588) ## Summary This PR focuses on addressing issues around the pagination and functionality of rules with numerous (2+) exception lists. - Updated the `use_exception_list.ts` hook to make use of the new multi list find API - Updated the viewer to make use of the new multi list find API - Previously was doing a lot of the filtering and paging manually (and badly) in the UI, now the _find takes care of all that - Added logic for showing `No results` text if user filter/search returns no items - Previously would show the `This rule has not exceptions` text
…73588) (#73747) ## Summary This PR focuses on addressing issues around the pagination and functionality of rules with numerous (2+) exception lists. - Updated the `use_exception_list.ts` hook to make use of the new multi list find API - Updated the viewer to make use of the new multi list find API - Previously was doing a lot of the filtering and paging manually (and badly) in the UI, now the _find takes care of all that - Added logic for showing `No results` text if user filter/search returns no items - Previously would show the `This rule has not exceptions` text
…73588) (#73748) ## Summary This PR focuses on addressing issues around the pagination and functionality of rules with numerous (2+) exception lists. - Updated the `use_exception_list.ts` hook to make use of the new multi list find API - Updated the viewer to make use of the new multi list find API - Previously was doing a lot of the filtering and paging manually (and badly) in the UI, now the _find takes care of all that - Added logic for showing `No results` text if user filter/search returns no items - Previously would show the `This rule has not exceptions` text
* master: [Vega][Inspector] Request panel should show correct names for requests (elastic#73655) [Security Solution] Update filter (elastic#73350) TSVB Inaccurate Group By (elastic#73683) [Vega][Inspect panel] Write tutorials and reference (elastic#73262) [ML] Removing node info check for file data viz import (elastic#73717) check that pathname has been updated. ignore other parts (elastic#73689) [build] rewrite source as transpiled JS later in the process (elastic#73749) Fix Snapshot Restore /policies/indices API endpoint on Cloud (elastic#73734) skip flaky suite (elastic#69783) (elastic#70043) [Security Solution][Exceptions] - Updates exception hooks and viewer (elastic#73588) skip failing suite (elastic#58815) [Canvas][fatal bug] Fix props confusion in TextStylePicker (elastic#73732) [DOCS] Changes level offset of monitoring pages (elastic#73573) Added close button to toast notifications by migrating to different API that is more widely used in Kibana and Security solution in particular. (elastic#73662) [ML] Transforms/DFA: Change action button size back to 'xs'. [Metrics UI] Fix evaluating rate-aggregated alerts when there's no normalized value (elastic#73545) [Metrics UI] Fix formatting of values in inventory context.reason (elastic#73155) [maps] rename GisMap to MapContainer and convert to TS (elastic#73690) [APM] docs: remove watcher documentation (elastic#73485)
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
This PR focuses on addressing issues around the pagination and functionality of rules with numerous (2+) exception lists.
use_exception_list.ts
hook to make use of the new multi list find APINo results
text if user filter/search returns no itemsThis rule has not exceptions
textSamples 🤤
Empty exception lists
No search results found
Successful search 🔍
Checklist