mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Closes https://github.com/elastic/kibana/issues/170236.
### Changes
This PR focuses on adding an action per dataset + namespace to navigate
to Observability log explorer. At the same time I took the opportunity
to update `Open in discover` link to include the controls present in
`Observability Log Explorer` state (atm just `namespace`)
1. Extracted `getRouterLinkProps` to a new package for reusability.
2. New `Actions` column was added to table.
3. `LogExplorerLink ` component was introduced, to reuse the navigation
logic between the table and the flyout.
4. `getDiscoverFiltersFromState` was added to combine state filters and
controls into discover state when navigating to discover
#### Demo
|
||
---|---|---|
.. | ||
src/get_router_link_props | ||
index.ts | ||
jest.config.js | ||
kibana.jsonc | ||
package.json | ||
README.md | ||
tsconfig.json |
@kbn/router-utils
This package provides util functions when working with the router.
getRouterLinkProps
Useful to generate link component properties for HTML elements, this link properties will allow them to behave as native links and handle events such as open in a new tab, or client-side navigation without refreshing the whole page.
Example
We want a button to both navigate to Discover client-side or open on a new window.
const DiscoverLink = (discoverLinkParams) => {
const discoverUrl = discover.locator?.getRedirectUrl(discoverLinkParams);
const navigateToDiscover = () => {
discover.locator?.navigate(discoverLinkParams);
};
const linkProps = getRouterLinkProps({
href: discoverUrl,
onClick: navigateToDiscover,
});
return (
<>
<EuiButton {...linkProps}>
{discoverLinkTitle}
</EuiButton>
</>
);
};