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][EventFilters] Port Event Filters to use ArtifactListPage component #130995

Conversation

ashokaditya
Copy link
Member

@ashokaditya ashokaditya commented Apr 26, 2022

Summary

Refactors endpoint event filters page to use ArtifactListPage

Checklist

Delete any items that are not applicable to this PR.

@ashokaditya ashokaditya self-assigned this Apr 26, 2022
@ashokaditya ashokaditya added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.3.0 labels Apr 26, 2022
@ashokaditya ashokaditya force-pushed the task/olm-3093-move-event-filters-to-artifactsListPage branch 4 times, most recently from ca3b209 to 8a83f20 Compare April 28, 2022 14:42
@ashokaditya ashokaditya changed the title [SecuritySolution][Endpoint][EventFilters] Port Event Filters to use ArtifactListPage component [Security Solution][Endpoint][EventFilters] Port Event Filters to use ArtifactListPage component Apr 29, 2022
@ashokaditya ashokaditya force-pushed the task/olm-3093-move-event-filters-to-artifactsListPage branch 13 times, most recently from 6577bff to e5bc6e8 Compare May 5, 2022 14:26
@ashokaditya ashokaditya force-pushed the task/olm-3093-move-event-filters-to-artifactsListPage branch 7 times, most recently from 2800a4c to a1a6b21 Compare May 10, 2022 15:48
@kevinlog
Copy link
Contributor

checked it out and tried it and everything looks to be working!

I can add Event Filters from both the page in Management and in the Events list:
image

image

I can perform management actions in the Policy page and Management page
image

image

Manifests are still building correctly and policies are updated

image

image

Copy link
Contributor

@kevinlog kevinlog left a comment

Choose a reason for hiding this comment

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

this approval is for functionality upon checking out the PR and running it. Will leave the code comments to the other devs

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.

This looks awesome! A lot of new awesome code and very good cleaning stuff! Thanks for doing all of this. I let you some comments/questions/suggestions, let me know what do you think 🙂

});
});

describe('Policy section with downgraded license', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move these tests to the effect scope ones here?

Copy link
Member Author

@ashokaditya ashokaditya May 16, 2022

Choose a reason for hiding this comment

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

Good idea. Although, there are a similar set of tests also in TA form. I think let's leave it here for now and refactor the tests when we extract common form elements into one component.

!!exception.entries.length || false
);
// compute this for initial render only
const existingComments = useMemo<ExceptionListItemSchema['comments']>(
Copy link
Contributor

Choose a reason for hiding this comment

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

What about having this as a default value of the exception? For example, having the eventFilter as state instead of being a useMemo, so you can define the default value when creating it with the existing comments:

const [eventFilter, setEventFilter] = useState(exception);

Copy link
Member Author

@ashokaditya ashokaditya May 17, 2022

Choose a reason for hiding this comment

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

Yeah, I tried that earlier when I got started with the form but that doesn't work . The AddExceptionComments expects the exception item comments to also have updated_by, created_by keys that the form added comments do not have.

Thus, I went with this approach where we pick out the saved comments once on the initial render and do not update it until the event filter is created with new comments.

);
}, [hasNameError, exception.entries]);

const processChanged = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

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

this function name got me confused, why processChanged? Can we change it by something with event or exception?

Also, if you decide to have the exception in a state, you could just setException({...changes}) and then have a useEffect to call onChange every time exception change.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. I went with this particular name cause I want to process/compute any changes that happened with the exception. This is also named notifyOfChange in other forms I think. We can agree on a single name and keep it consistent in all the forms.

@ashokaditya ashokaditya requested a review from dasansol92 May 17, 2022 07:20
Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Investigations code owner file changes. LGTM!

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.

Awesome! Thanks for all the effort here 🚢
Would you mind adding a FTR here for event filters? It can be done in another pr if you want 🙂

@ashokaditya ashokaditya force-pushed the task/olm-3093-move-event-filters-to-artifactsListPage branch from 4dd3828 to 6717ae9 Compare May 19, 2022 09:37
@ashokaditya ashokaditya enabled auto-merge (squash) May 19, 2022 10:37
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2936 2926 -10

Async chunks

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

id before after diff
securitySolution 5.0MB 5.0MB -14.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 247.1KB 247.1KB -6.0B

History

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

cc @ashokaditya

@ashokaditya ashokaditya merged commit e282735 into elastic:main May 19, 2022
@ashokaditya ashokaditya deleted the task/olm-3093-move-event-filters-to-artifactsListPage branch November 29, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting OLM Sprint release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants