Merge pull request #2321 from spotify/shmidt-i/plugin-explore-migration-to-new-routing-api
Plugin explore: migrate to new routing api
This commit is contained in:
@@ -56,6 +56,7 @@ const deprecatedAppRoutes = app.getRoutes();
|
||||
|
||||
const AppRoutes = () => (
|
||||
<Routes>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
<Route
|
||||
path="/catalog/*"
|
||||
element={<CatalogRouter EntityPage={EntityPage} />}
|
||||
@@ -65,7 +66,6 @@ const AppRoutes = () => (
|
||||
path="/tech-radar"
|
||||
element={<TechRadarRouter width={1500} height={800} />}
|
||||
/>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
{...deprecatedAppRoutes}
|
||||
</Routes>
|
||||
);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { AppSidebar } from './sidebar';
|
||||
import { Route, Routes, Navigate } from 'react-router';
|
||||
import { Router as CatalogRouter } from '@backstage/plugin-catalog';
|
||||
import { Router as DocsRouter } from '@backstage/plugin-techdocs';
|
||||
|
||||
import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar';
|
||||
import { EntityPage } from './components/catalog/EntityPage';
|
||||
|
||||
@@ -31,6 +32,7 @@ const App: FC<{}> = () => (
|
||||
<SidebarPage>
|
||||
<AppSidebar />
|
||||
<Routes>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
<Route
|
||||
path="/catalog/*"
|
||||
element={<CatalogRouter EntityPage={EntityPage} />}
|
||||
@@ -40,7 +42,6 @@ const App: FC<{}> = () => (
|
||||
path="/tech-radar"
|
||||
element={<TechRadarRouter width={1500} height={800} />}
|
||||
/>
|
||||
<Navigate key="/" to="/catalog" />
|
||||
{deprecatedAppRoutes}
|
||||
</Routes>
|
||||
</SidebarPage>
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-use": "^15.3.3"
|
||||
"react-use": "^15.3.3",
|
||||
"react-router": "6.0.0-beta.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.1.1-alpha.21",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { FC } from 'react';
|
||||
import React from 'react';
|
||||
import { makeStyles, Typography } from '@material-ui/core';
|
||||
import {
|
||||
Content,
|
||||
@@ -107,7 +107,7 @@ const toolsCards = [
|
||||
},
|
||||
];
|
||||
|
||||
const ExplorePluginPage: FC<{}> = () => {
|
||||
export const ExplorePluginPage = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Page theme={pageTheme.home}>
|
||||
@@ -130,5 +130,3 @@ const ExplorePluginPage: FC<{}> = () => {
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
export default ExplorePluginPage;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Route, Routes } from 'react-router';
|
||||
import { ExplorePluginPage } from './ExplorePluginPage';
|
||||
import { rootRouteRef } from '../plugin';
|
||||
|
||||
export const Router = () => (
|
||||
<Routes>
|
||||
<Route path={`/${rootRouteRef.path}`} element={<ExplorePluginPage />} />
|
||||
</Routes>
|
||||
);
|
||||
@@ -15,3 +15,4 @@
|
||||
*/
|
||||
|
||||
export { plugin } from './plugin';
|
||||
export { Router } from './components/Router';
|
||||
|
||||
@@ -14,12 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createPlugin } from '@backstage/core';
|
||||
import ExplorePluginPage from './components/ExplorePluginPage';
|
||||
import { createPlugin, createRouteRef } from '@backstage/core';
|
||||
|
||||
export const rootRouteRef = createRouteRef({ path: '', title: 'Explore' });
|
||||
export const plugin = createPlugin({
|
||||
id: 'explore',
|
||||
register({ router }) {
|
||||
router.registerRoute('/explore', ExplorePluginPage);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user