[Endpoint] Common PageView and LinkToApp components#60819
[Endpoint] Common PageView and LinkToApp components#60819paul-tavares merged 21 commits intoelastic:masterfrom
Conversation
- For details - see elastic#56705
|
Pinging @elastic/endpoint-management (Team:Endpoint Management) |
|
Pinging @elastic/endpoint-app-team (Feature:Endpoint) |
|
Once I get some feedback on this PR, I will add test cases on to this PR :) |
| defaultMessage: 'Policies', | ||
| })} | ||
| bodyHeader={ | ||
| <EuiText color="subdued" data-test-subj="policyTotalCount"> |
There was a problem hiding this comment.
I think you need to adjust tests for checking for another data-test-subj, it checks for policyViewTitle now. We need to readjust
There was a problem hiding this comment.
Yes, agreed. They are actually currently failing, but I wanted to hold off on fixing them until I got feedback that these changes look good to go in. :)
There was a problem hiding this comment.
the PageView component certainly lgtm, might have questions about the router and hook changes still
| <KibanaContextProvider services={{ http, notifications, application, data }}> | ||
| <EuiThemeProvider darkMode={isDarkMode}> | ||
| <BrowserRouter basename={basename}> | ||
| <Router history={history}> |
There was a problem hiding this comment.
why did we stop using <BrowserRouter> ?
There was a problem hiding this comment.
It was a change request pushed down from the Kibana Platform - see #56705
There was a problem hiding this comment.
from the ticket, looks like they still use <BrowserRouter> in the after:
core.application.register({
id: 'myApp',
mount({ element, history }) {
ReactDOM.render(
<BrowserRouter history={history}>
<App />
</BrowserRouter>,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
}
});
There was a problem hiding this comment.
@kevinlog Thats a mistake. BrowserRouter does not accept the history prop 😃
|
@paul-tavares - Is there a link to the main issue this PR is related to or is this the issue? It looks like this is the issue and the PR. If so, could we add the AC? So I can help with adding test cases for our team :) |
|
Hi @aisantos . I did not open an issue specifically for this, but I think I did have one on our backlog for misc. items. I'll find it and let you know. |
kevinlog
left a comment
There was a problem hiding this comment.
LGTM based on past conversations surrounding unifying some of these navigation actions in the links. Would want another 👍 from another dev on another team - @kqualters-elastic @oatkiller etc
kqualters-elastic
left a comment
There was a problem hiding this comment.
component stuff lgtm, and can't think of any problems off the top of my head with the nav hook. 👍 lgtm
…n-components # Conflicts: # x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* a common PageView component * Policy List cleanup + improvements to PageView * Policy details refactored to use PageView layout * Fix bug: header nav - ensure section sub-routes set nav to `isSelected` * Added useNavigateToAppEventHandler hook * Remove use of `appBasePath` and use `history` for initializing router - For details - see #56705 * Removed `hello-world` API * Added `LinkToApp` component + refactor policy list to use it * Add icon to plugin registration
Summary
This PR contains the following:
PageViewlayout component.Ensure that all endpoint views are using a consistent layout. Currently, only the Policy List and Policy Details are using it.
LinkToAppcomponentIts a
EuiLinkthat utilizesservices.application.navigateTo()to send a user to another app's URL without triggering a full page refresh. Policy List refactored to use it.useNavigateToAppEventHandler()hook. Returns back an event handler callback that can be used withonClickevents when wanting to create a Link or button that navigates to another app. Currently in use by theLinkToAppcomponent.appBasePath(deprecated) in favor or usinghistoryto initialize react router (see Add ScopedHistory to AppMountParams #56705 for details)HeaderNavwhere section sub-routes would not show nav item as selected (seen currently when navigating to the Policy details)hello-worldAPI that was initially part of the first NP plugin commitChecklist
Delete any items that are not applicable to this PR.