Skip to content

Commit 2df3551

Browse files
Updated entity handling
1 parent ebb15c4 commit 2df3551

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/Router.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
import { Entity } from "@backstage/catalog-model";
1+
import React from 'react';
2+
import { Entity } from '@backstage/catalog-model';
3+
import { useEntity } from '@backstage/plugin-catalog-react';
4+
import { Route } from 'react-router';
5+
import { FlatRoutes } from '@backstage/core-app-api';
26
import { MissingAnnotationEmptyState } from "@backstage/core-components";
3-
import React from "react";
4-
import { Route, Routes } from "react-router";
57
import { HarborDashboardPage } from "./components/HarborDashboardPage";
68
import { HARBOR_ANNOTATION_REPOSITORY } from "./components/useHarborAppData";
79
import { isHarborAvailable } from "./plugin";
810

9-
export const Router = ({ entity }: { entity: Entity }) => {
11+
type Props = {
12+
/** @deprecated The entity is now grabbed from context instead */
13+
entity?: Entity;
14+
};
15+
export const Router = (_props: Props) => {
16+
const { entity } = useEntity();
1017
return !isHarborAvailable(entity) ? (
1118
<MissingAnnotationEmptyState annotation={HARBOR_ANNOTATION_REPOSITORY} />
1219
) : (
13-
<Routes>
20+
<FlatRoutes>
1421
<Route path="/" element={<HarborDashboardPage entity={entity} />} />
15-
</Routes>
22+
</FlatRoutes>
1623
);
1724
};

0 commit comments

Comments
 (0)