-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[SECURITY_SOLUTION][ENDPOINT] Grid view for trusted apps. #79485
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
Conversation
… would be easy to introduce a new view type parameter.
…bala/grid-view
…bala/grid-view-1
…bala/grid-view-1
...curity_solution/public/management/pages/trusted_apps/view/components/control_panel/index.tsx
Outdated
Show resolved
Hide resolved
...curity_solution/public/management/pages/trusted_apps/view/components/control_panel/index.tsx
Outdated
Show resolved
Hide resolved
| const isLoading = useTrustedAppsSelector(isListLoading); | ||
| const error = useTrustedAppsSelector(getListErrorMessage); | ||
|
|
||
| const handleTrustedAppDelete = useTrustedAppsStoreActionCallback((trustedApp) => ({ |
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.
Why did we need custom hooks for these? why not just use useCallback()?
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.
I resolved all other conversations and let's keep one thread here.
Cause my feeling is that code using pure useCallback to do history navigation and redux action dispatch becomes unnecessarily bulky (prettier is not making it prettier :) )
I would appreciate if we try this out. The whole goal is to write concise code that is not hard to navigate. Currently one single callback that doesn't do much more than navigating url by changing parameters, occupies more than 6 lines.
I also don't like the idea of having to disable the eslint rules, but I've googled for this quite a bit and there are similar stories like this on the git hub page for this rule. In the end we disable eslint rules for even more minor cases which cost almost no effort to do correctly.
If you are worried about memoization of variables from lexical scope then it's true that you can use those in memoization and I could add dependencies list, but I don't think that's the goal of this hook to depend on scope - all that could come from scope is abstracted away (I mean current location) so that you are not supposed to worry about that. It should only get params from event and use those.
In the end this is like ~10 lines of code using this hook? and only in trusted apps (which is pretty small codebase). If it doesn't work out it's an half an hour job (if not less) to replace them.
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.
@efreeti my preference leans towards using useCallback() since it's an established pattern and a built in hook, so there's some familiarity as well. Unless there's a strong reason to do otherwise, I don't see a need to break from the pattern just yet.
Also, since we're right on the line and we'd like to ship this in 7.10, I'd suggest we save the conversation for later. You've built a great view here - let's get it in!
@paul-tavares what are your thoughts?
...ty_solution/public/management/pages/trusted_apps/view/components/trsuted_apps_grid/index.tsx
Outdated
Show resolved
Hide resolved
...ty_solution/public/management/pages/trusted_apps/view/components/trsuted_apps_grid/index.tsx
Show resolved
Hide resolved
...ity_solution/public/management/pages/trusted_apps/view/components/view_type_toggle/index.tsx
Outdated
Show resolved
Hide resolved
...ck/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/hooks.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/hooks.ts
Outdated
Show resolved
Hide resolved
...ck/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.tsx
Show resolved
Hide resolved
…bala/grid-view-1 � Conflicts: � x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.stories.tsx
|
Pinging @elastic/endpoint-app-team (Feature:Endpoint) |
|
Pinging @elastic/endpoint-management (Team:Endpoint Management) |
…bala/grid-view-1 � Conflicts: � x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_page.test.tsx
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
| import { render } from '@testing-library/react'; | ||
| import { shallow } from 'enzyme'; |
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.
Maybe consider using only one testing library per test module and not have a mix of the two.
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.
I will see how to resolve this. Enzyme has shallow, render doesn't. But with shallow you can't do the clicking. I will follow up next on this. Will create Debt issue.
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
History
To update your PR or re-run it, just comment with: |
) * Refactored store code to group properties related to location so that would be easy to introduce a new view type parameter. * Added view type to the location and routing. * Added a simple hook to make navigation easier. * Improved the navigation hook to get params. * Some fix for double notification after creating trusted app. * Added a hook to perform trusted app store actions. * Fixed trusted app card delete callback. * Added grid view. * Fixed the stories structuring. * Shared more logic between grid and list. * Finalized the grid view. * Flattened the props. * Improved memoization. * Moved the flex item elements inside conditions. * Fixed broken stories. * Updated the snapshot. * Updated the snapshot.
…79704) * Refactored store code to group properties related to location so that would be easy to introduce a new view type parameter. * Added view type to the location and routing. * Added a simple hook to make navigation easier. * Improved the navigation hook to get params. * Some fix for double notification after creating trusted app. * Added a hook to perform trusted app store actions. * Fixed trusted app card delete callback. * Added grid view. * Fixed the stories structuring. * Shared more logic between grid and list. * Finalized the grid view. * Flattened the props. * Improved memoization. * Moved the flex item elements inside conditions. * Fixed broken stories. * Updated the snapshot. * Updated the snapshot.
Summary
Implemented grid view for trusted apps and toggling between views.
Checklist
Delete any items that are not applicable to this PR.