mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
We're not using them.
This commit is contained in:
parent
0241423f67
commit
690d8eb507
3 changed files with 7 additions and 56 deletions
|
@ -27,7 +27,6 @@ import { ApmPluginContext } from '../context/ApmPluginContext';
|
|||
import { LicenseProvider } from '../context/LicenseContext';
|
||||
import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext';
|
||||
import { LocationProvider } from '../context/LocationContext';
|
||||
import { MatchedRouteProvider } from '../context/MatchedRouteContext';
|
||||
import { UrlParamsProvider } from '../context/UrlParamsContext';
|
||||
import { ApmPluginSetupDeps } from '../plugin';
|
||||
import { createCallApmApi } from '../services/rest/createCallApmApi';
|
||||
|
@ -100,15 +99,13 @@ export function ApmAppRoot({
|
|||
<i18nCore.Context>
|
||||
<Router history={history}>
|
||||
<LocationProvider>
|
||||
<MatchedRouteProvider routes={routes}>
|
||||
<UrlParamsProvider>
|
||||
<LoadingIndicatorProvider>
|
||||
<LicenseProvider>
|
||||
<App />
|
||||
</LicenseProvider>
|
||||
</LoadingIndicatorProvider>
|
||||
</UrlParamsProvider>
|
||||
</MatchedRouteProvider>
|
||||
<UrlParamsProvider>
|
||||
<LoadingIndicatorProvider>
|
||||
<LicenseProvider>
|
||||
<App />
|
||||
</LicenseProvider>
|
||||
</LoadingIndicatorProvider>
|
||||
</UrlParamsProvider>
|
||||
</LocationProvider>
|
||||
</Router>
|
||||
</i18nCore.Context>
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import React, { useMemo, ReactChild } from 'react';
|
||||
import { matchPath } from 'react-router-dom';
|
||||
import { useLocation } from '../hooks/useLocation';
|
||||
import { BreadcrumbRoute } from '../components/app/Main/ProvideBreadcrumbs';
|
||||
|
||||
export const MatchedRouteContext = React.createContext<BreadcrumbRoute[]>([]);
|
||||
|
||||
interface MatchedRouteProviderProps {
|
||||
children: ReactChild;
|
||||
routes: BreadcrumbRoute[];
|
||||
}
|
||||
export function MatchedRouteProvider({
|
||||
children,
|
||||
routes,
|
||||
}: MatchedRouteProviderProps) {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
const contextValue = useMemo(() => {
|
||||
return routes.filter((route) => {
|
||||
return matchPath(pathname, {
|
||||
path: route.path,
|
||||
});
|
||||
});
|
||||
}, [pathname, routes]);
|
||||
|
||||
return (
|
||||
<MatchedRouteContext.Provider value={contextValue} children={children} />
|
||||
);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { useContext } from 'react';
|
||||
import { MatchedRouteContext } from '../context/MatchedRouteContext';
|
||||
|
||||
export function useMatchedRoutes() {
|
||||
return useContext(MatchedRouteContext);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue