diff --git a/.changeset/dull-badgers-pull.md b/.changeset/dull-badgers-pull.md
new file mode 100644
index 0000000000..ddbdeb55ca
--- /dev/null
+++ b/.changeset/dull-badgers-pull.md
@@ -0,0 +1,6 @@
+---
+'@backstage/plugin-search-backend': patch
+'@backstage/plugin-search-backend-node': patch
+---
+
+Bump to use the in-repo latest `backend-common`, and the correct version of `express-promise-router`
diff --git a/.changeset/eight-poems-camp.md b/.changeset/eight-poems-camp.md
new file mode 100644
index 0000000000..62ee6810c9
--- /dev/null
+++ b/.changeset/eight-poems-camp.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-badges': patch
+---
+
+Get the current entity using `useEntity` from `@backstage/plugin-catalog-react`
diff --git a/.changeset/famous-knives-cough.md b/.changeset/famous-knives-cough.md
new file mode 100644
index 0000000000..28869ddf33
--- /dev/null
+++ b/.changeset/famous-knives-cough.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-catalog': patch
+---
+
+Temporarily add `UNSTABLE_extraContextMenuItems` to the entity layout, so that we could detach the catalog plugin from the dependency on the badges plugin
diff --git a/.changeset/selfish-apples-fly.md b/.changeset/selfish-apples-fly.md
new file mode 100644
index 0000000000..b0be4f0423
--- /dev/null
+++ b/.changeset/selfish-apples-fly.md
@@ -0,0 +1,7 @@
+---
+'@backstage/create-app': patch
+---
+
+Update the create-app template to use the correct latest version of `express-promise-router`.
+
+To apply the same change in your own repository, update all of your repo's dependencies on `express-promise-router` to `"^4.1.0"`.
diff --git a/.changeset/twelve-rings-sip.md b/.changeset/twelve-rings-sip.md
new file mode 100644
index 0000000000..1fc2f88ec1
--- /dev/null
+++ b/.changeset/twelve-rings-sip.md
@@ -0,0 +1,5 @@
+---
+'@backstage/cli': patch
+---
+
+Make the backend plugin template use the correct latest version of `express-promise-router`
diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx
index cacd2458b1..0f9cc98f4b 100644
--- a/packages/app/src/components/catalog/EntityPage.tsx
+++ b/packages/app/src/components/catalog/EntityPage.tsx
@@ -31,6 +31,7 @@ import {
ProvidedApisCard,
ProvidingComponentsCard,
} from '@backstage/plugin-api-docs';
+import { EntityBadgesDialog } from '@backstage/plugin-badges';
import {
AboutCard,
EntityHasComponentsCard,
@@ -104,7 +105,8 @@ import {
RecentTravisCIBuildsWidget,
Router as TravisCIRouter,
} from '@roadiehq/backstage-plugin-travis-ci';
-import React, { ReactNode } from 'react';
+import React, { ReactNode, useMemo, useState } from 'react';
+import BadgeIcon from '@material-ui/icons/CallToAction';
export const CICDSwitcher = ({ entity }: { entity: Entity }) => {
// This component is just an example of how you can implement your company's logic in entity page.
@@ -178,6 +180,32 @@ export const ErrorsSwitcher = ({ entity }: { entity: Entity }) => {
}
};
+const EntityPageLayoutWrapper = (props: { children?: React.ReactNode }) => {
+ const [badgesDialogOpen, setBadgesDialogOpen] = useState(false);
+
+ const extraMenuItems = useMemo(() => {
+ return [
+ {
+ title: 'Badges',
+ Icon: BadgeIcon,
+ onClick: () => setBadgesDialogOpen(true),
+ },
+ ];
+ }, []);
+
+ return (
+ <>
+
+ {props.children}
+
+ setBadgesDialogOpen(false)}
+ />
+ >
+ );
+};
+
const ComponentOverviewContent = ({ entity }: { entity: Entity }) => (
@@ -233,7 +261,7 @@ const ComponentApisContent = ({ entity }: { entity: Entity }) => (
);
const ServiceEntityPage = ({ entity }: { entity: Entity }) => (
-
+
(
title="TODOs"
element={}
/>
-
+
);
const WebsiteEntityPage = ({ entity }: { entity: Entity }) => (
-
+
(
title="TODOs"
element={}
/>
-
+
);
const DefaultEntityPage = ({ entity }: { entity: Entity }) => (
-
+
(
title="TODOs"
element={}
/>
-
+
);
export const ComponentEntityPage = ({ entity }: { entity: Entity }) => {
@@ -393,7 +421,7 @@ const ApiDefinitionContent = ({ entity }: { entity: ApiEntity }) => (
);
const ApiEntityPage = ({ entity }: { entity: Entity }) => (
-
+
(
title="Definition"
element={}
/>
-
+
);
const UserOverviewContent = ({ entity }: { entity: UserEntity }) => (
@@ -419,13 +447,13 @@ const UserOverviewContent = ({ entity }: { entity: UserEntity }) => (
);
const UserEntityPage = ({ entity }: { entity: Entity }) => (
-
+
}
/>
-
+
);
const GroupOverviewContent = ({ entity }: { entity: GroupEntity }) => (
@@ -443,13 +471,13 @@ const GroupOverviewContent = ({ entity }: { entity: GroupEntity }) => (
);
const GroupEntityPage = ({ entity }: { entity: Entity }) => (
-
+
}
/>
-
+
);
const SystemOverviewContent = ({ entity }: { entity: SystemEntity }) => (
@@ -467,13 +495,13 @@ const SystemOverviewContent = ({ entity }: { entity: SystemEntity }) => (
);
const SystemEntityPage = ({ entity }: { entity: Entity }) => (
-
+
}
/>
-
+
);
const DomainOverviewContent = ({ entity }: { entity: DomainEntity }) => (
@@ -488,13 +516,13 @@ const DomainOverviewContent = ({ entity }: { entity: DomainEntity }) => (
);
const DomainEntityPage = ({ entity }: { entity: Entity }) => (
-
+
}
/>
-
+
);
export const EntityPage = () => {
diff --git a/packages/cli/templates/default-backend-plugin/package.json.hbs b/packages/cli/templates/default-backend-plugin/package.json.hbs
index b762bb9645..d041773d3c 100644
--- a/packages/cli/templates/default-backend-plugin/package.json.hbs
+++ b/packages/cli/templates/default-backend-plugin/package.json.hbs
@@ -27,7 +27,7 @@
"@backstage/config": "^{{version '@backstage/config'}}",
"@types/express": "^4.17.6",
"express": "^4.17.1",
- "express-promise-router": "^3.0.3",
+ "express-promise-router": "^4.1.0",
"winston": "^3.2.1",
"cross-fetch": "^3.0.6",
"yn": "^4.0.0"
diff --git a/packages/create-app/templates/default-app/packages/backend/package.json.hbs b/packages/create-app/templates/default-app/packages/backend/package.json.hbs
index 8c8cfae0b3..138bcaec8d 100644
--- a/packages/create-app/templates/default-app/packages/backend/package.json.hbs
+++ b/packages/create-app/templates/default-app/packages/backend/package.json.hbs
@@ -32,7 +32,7 @@
"@octokit/rest": "^18.0.12",
"dockerode": "^3.2.1",
"express": "^4.17.1",
- "express-promise-router": "^3.0.3",
+ "express-promise-router": "^4.1.0",
"knex": "^0.21.6",
{{#if dbTypePG}}
"pg": "^8.3.0",
diff --git a/plugins/badges/src/components/EntityBadgesDialog.test.tsx b/plugins/badges/src/components/EntityBadgesDialog.test.tsx
index 25a6f01c1a..62f2b55bc5 100644
--- a/plugins/badges/src/components/EntityBadgesDialog.test.tsx
+++ b/plugins/badges/src/components/EntityBadgesDialog.test.tsx
@@ -25,6 +25,7 @@ import {
import { renderWithEffects } from '@backstage/test-utils';
import { BadgesApi, badgesApiRef } from '../api';
import { EntityBadgesDialog } from './EntityBadgesDialog';
+import { EntityProvider } from '@backstage/plugin-catalog-react';
describe('EntityBadgesDialog', () => {
it('should render', async () => {
@@ -50,7 +51,9 @@ describe('EntityBadgesDialog', () => {
{} as ErrorApi,
)}
>
-
+
+
+
,
);
diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx
index f6ba9de9fe..c0cbd6b15c 100644
--- a/plugins/badges/src/components/EntityBadgesDialog.tsx
+++ b/plugins/badges/src/components/EntityBadgesDialog.tsx
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import { Entity } from '@backstage/catalog-model';
import {
CodeSnippet,
Progress,
ResponseErrorPanel,
useApi,
} from '@backstage/core';
+import { useEntity } from '@backstage/plugin-catalog-react';
import {
Box,
Button,
@@ -39,43 +39,44 @@ import { badgesApiRef } from '../api';
type Props = {
open: boolean;
onClose?: () => any;
- entity: Entity;
};
-export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => {
+export const EntityBadgesDialog = ({ open, onClose }: Props) => {
const theme = useTheme();
+ const { entity } = useEntity();
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
const badgesApi = useApi(badgesApiRef);
const { value: badges, loading, error } = useAsync(async () => {
- if (open) {
+ if (open && entity) {
return await badgesApi.getEntityBadgeSpecs(entity);
}
-
return [];
}, [badgesApi, entity, open]);
const content = (badges || []).map(
({ badge: { description }, id, url, markdown }) => (
-
-
-
-
-
+
+
+
+
+
+
),
);
return (