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][Endpoint] Delete Event Filter from the List #99686

Merged

Conversation

paul-tavares
Copy link
Contributor

@paul-tavares paul-tavares commented May 10, 2021

Summary

  • Enables the Delete button on the Event Filter cards, which will show the user an confirmation modal before proceeding to delete the event filter entry

olm-956-event-filter-delete

Checklist

@paul-tavares paul-tavares added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed labels May 10, 2021
@paul-tavares paul-tavares self-assigned this May 10, 2021
…t-filter-delete

# Conflicts:
#	x-pack/plugins/security_solution/public/management/pages/event_filters/state/index.ts
#	x-pack/plugins/security_solution/public/management/pages/event_filters/store/builders.ts
#	x-pack/plugins/security_solution/public/management/pages/event_filters/store/middleware.ts
@paul-tavares paul-tavares marked this pull request as ready for review May 11, 2021 18:22
@paul-tavares paul-tavares requested a review from a team as a code owner May 11, 2021 18:22
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)


dispatch({
type: 'eventFilterDeleteStatusChanged',
// Ignore will be fixed with when AsyncResourceState is refactored (#830)
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@dasansol92 dasansol92 left a comment

Choose a reason for hiding this comment

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

Just a few comments (mostly questions) but it looks great!!! 🔥 🔥
Could you add some tests for the middleware and the new reducers?

// Show toast for success
useEffect(() => {
if (wasDeleted) {
toasts.addSuccess(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can manage this with the useEventFiltersNotification hook adding the new conditions for delete action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel that having the notifications closer to the code that generates them makes the component (in this case the delete modal) clearer to understand. Someone looking at this component would not be able to understand how errors/success are presented back to the UI - they would have to go look elsewhere. I think it also overloads that hook in that it starts to have too broad of concerns. I remember having that same feedback when that Trusted Apps approach was done - several new approaches were trialed during that implementation, this being one of them.

Give this background, let me know if you still feel this should be moved over to the hook - I can do that if feels like the better approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. Yeah it make sense.
Idea - Maybe we could move this logic to the middleware (not now) just to keep the component itself as clean as we can. What I'm thinking is have an entry on our redux store for notifications and have a component that listens it to display the toast or not.
Doing this we could move all of this logic (this and the ones in the hook) to the middleware and let components more clean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dasansol92 yeah, that could work. Maybe we add this as a topic of discussion for our weekly eng. office hours.

useEffect(() => {
if (deleteError) {
toasts.addDanger(
i18n.translate('xpack.securitySolution.eventFilters.deletionDialog.deleteFailure', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above

@paul-tavares paul-tavares requested a review from dasansol92 May 12, 2021 12:59
…t-filter-delete

# Conflicts:
#	x-pack/plugins/security_solution/public/management/pages/event_filters/view/event_filters_list_page.tsx
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 6.7MB 6.7MB +8.5KB
Unknown metric groups

References to deprecated APIs

id before after diff
canvas 29 25 -4
crossClusterReplication 8 6 -2
fleet 4 2 -2
globalSearch 4 2 -2
indexManagement 12 7 -5
infra 5 3 -2
licensing 18 15 -3
monitoring 109 56 -53
total -73

History

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

cc @paul-tavares

Copy link
Contributor

@dasansol92 dasansol92 left a comment

Choose a reason for hiding this comment

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

🔥 🔥 🚢

@paul-tavares paul-tavares merged commit 6319544 into elastic:master May 13, 2021
@paul-tavares paul-tavares deleted the task/olm-956-event-filter-delete branch May 13, 2021 12:03
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 13, 2021
…tic#99686)

* modal for delete of event filter
* Add total count of items to the List view
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request May 13, 2021
…) (#100024)

* modal for delete of event filter
* Add total count of items to the List view

Co-authored-by: Paul Tavares <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants