-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[SIEM][Exceptions] - ExceptionsViewer cleanup #68739
Conversation
…to exceptions-viewer-2
… due to be refactored but dont want to make this PR bigger
Pinging @elastic/siem (Team:SIEM) |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
expect(wrapper.find('[data-test-subj="exceptionsEndpointMessage"]').exists()).toBeTruthy(); | ||
expect(wrapper.find('[data-test-subj="exceptionsDetectionsMessage"]').exists()).toBeFalsy(); | ||
}); | ||
}); |
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.
Lots of nice tests 👍
@@ -78,26 +82,34 @@ export const allExceptionItemsReducer = () => (state: State, action: Action): St | |||
}; | |||
|
|||
if (action.filterOptions.showEndpointList) { | |||
const exceptions = state.allExceptions.filter((t) => t._tags.includes('endpoint')); | |||
const list = action.allLists.filter((t) => t.type === 'endpoint'); |
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.
tip: People usually use destructoring when they don't care about a variable name like so:
.filter(({ type }) => type === 'endpoint');
No changes needed, just a tip.
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.
Ah, nice. I have an upcoming PR, will link to it with changes for this. Thanks!
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.
Looked it over, looks really clean easy to read. So LGTM for ya!
### Summary - Adds missing unit tests for relevant files missing them - Changes filter search to fire request on 'Enter' - Breaks out the main ExceptionViewer component into smaller components to make more readable and better tested - Updates utility bar to have the specific list description text next to it as proposed by @spong in elastic#68294 (comment) - Adds loading state any time async request occurs - Now fetches list on list type toggle (if user selects to view either only detections or endpoint items), before was simply filtering already fetched items
### Summary - Adds missing unit tests for relevant files missing them - Changes filter search to fire request on 'Enter' - Breaks out the main ExceptionViewer component into smaller components to make more readable and better tested - Updates utility bar to have the specific list description text next to it as proposed by @spong in #68294 (comment) - Adds loading state any time async request occurs - Now fetches list on list type toggle (if user selects to view either only detections or endpoint items), before was simply filtering already fetched items
* master: (38 commits) Support migrating from reserved feature privileges (elastic#68504) add `preference` field to SavedObjectsFindOptions (elastic#68620) [ILM] Add "wait for snapshot" policy field to Delete phase (elastic#68505) Cleanup old license overwrites (elastic#68744) Bump TypeScript to v3.9 (elastic#67666) [APM] Service maps - adds new storybook stories to test out various data sets (elastic#68727) Fix vega specification parsing (elastic#67963) docs: add more api information (elastic#68717) [APM] Don't show annotations on charts with no data (elastic#68829) [Metrics UI] Fix Inventory View sorting by handling null values (elastic#67889) skip flaky suite (elastic#68836) [SIEM][Detections Engine] - Fix reference rule url overflow (elastic#68640) Index pattern public api => common (elastic#68289) [APM] Lazy-load alert triggers (elastic#68806) [DOCS] Fix table formatting in ingest manager settings (elastic#68824) [Endpoint] Functional Tests cleanup (elastic#68756) revert previous commit which was unintentional Use Github token instead for project assignments [SIEM][Exceptions] - ExceptionsViewer cleanup (elastic#68739) move @kbn/storybook to devDeps (elastic#68791) ...
Pinging @elastic/security-solution (Team: SecuritySolution) |
Summary
ExceptionViewer
component into smaller components to make more readable and better testedTo do
moment
to use theFormattedDate
insteadScreenshots & Gifs
Empty state
Only one type of list allowed
List toggles hidden, no popover for add exception.
Exceptions search
Exceptions list toggle
Delete exception
Testing
To turn on lists plugin - in kibana.dev.yml
Use the scripts in
x-pack/plugins/lists/server/scripts
to create some sample exception lists and items. You can use the following:./post_exception_list.sh ./exception_lists/new/exception_list_detection.json
./post_exception_list_item.sh ./exception_lists/new/exception_list_item_detection_auto_id.json
- this script auto generates the item_id so you can run it as many times as you like to create multiple items associated with the list generated in step 1./post_exception_list.sh
./post_exception_list_item.sh ./exception_lists/new/exception_list_item_auto_id.json
- this script auto generates the item_id so you can run it as many times as you like to create multiple items associated with the list generated in step 3./find_exception_lists.sh
to get the id of the two lists you createdExceptionsViewer
component inx-pack/plugins/security_solution/public/alerts/pages/detection_engine/rules/details/index.tsx
to something like the following:Navigate to the rules details page and click on the 'Exceptions' tab. Voila!
To check storybook elements, run
yarn storybook security_solution
from./kibana/
.Checklist
Delete any items that are not applicable to this PR.