grafana/public/app/core/navigation/RouterDebugger.tsx
Josh Hunt 3c6e0e8ef8
Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00

48 lines
1.2 KiB
TypeScript

import React from 'react';
import { Link } from 'react-router-dom';
import { getAppRoutes } from '../../routes/routes';
import { PageContents } from '../components/Page/PageContents';
import { RouteDescriptor } from './types';
export const RouterDebugger: React.FC<any> = () => {
const manualRoutes: RouteDescriptor[] = [];
return (
<PageContents>
<h1>Static routes</h1>
<ul>
{getAppRoutes().map((r, i) => {
if (r.path.indexOf(':') > -1 || r.path.indexOf('test') > -1) {
if (r.path.indexOf('test') === -1) {
manualRoutes.push(r);
}
return null;
}
return (
<li key={i}>
<Link target="_blank" to={r.path}>
{r.path}
</Link>
</li>
);
})}
</ul>
<h1>Dynamic routes - check those manually</h1>
<ul>
{manualRoutes.map((r, i) => {
return (
<li key={i}>
<Link key={`${i}-${r.path}`} target="_blank" to={r.path}>
{r.path}
</Link>
</li>
);
})}
</ul>
</PageContents>
);
};