diff --git a/.changeset/tricky-pens-camp.md b/.changeset/tricky-pens-camp.md
new file mode 100644
index 0000000000..dc47274351
--- /dev/null
+++ b/.changeset/tricky-pens-camp.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-catalog': patch
+---
+
+Update AboutCard to only render refresh button if the entity is managed by an url location.
diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx
index 1dbf849a2d..3b64ee6b73 100644
--- a/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx
+++ b/plugins/catalog/src/components/AboutCard/AboutCard.test.tsx
@@ -220,6 +220,10 @@ describe('', () => {
apiVersion: 'v1',
kind: 'Component',
metadata: {
+ annotations: {
+ 'backstage.io/managed-by-location':
+ 'url:https://backstage.io/catalog-info.yaml',
+ },
name: 'software',
},
spec: {
@@ -252,6 +256,35 @@ describe('', () => {
);
});
+ it('should not render refresh button if the location is not an url', async () => {
+ const entity = {
+ apiVersion: 'v1',
+ kind: 'Component',
+ metadata: {
+ name: 'software',
+ },
+ spec: {
+ owner: 'guest',
+ type: 'service',
+ lifecycle: 'production',
+ },
+ };
+ const apis = ApiRegistry.with(
+ scmIntegrationsApiRef,
+ ScmIntegrationsApi.fromConfig(new ConfigReader({})),
+ ).with(catalogApiRef, catalogApi);
+
+ const { queryByTitle } = await renderInTestApp(
+
+
+
+
+ ,
+ );
+
+ expect(queryByTitle('Schedule entity refresh')).not.toBeInTheDocument();
+ });
+
it('renders techdocs link', async () => {
const entity = {
apiVersion: 'v1',
diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx
index ec3d47a204..68777d4109 100644
--- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx
+++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx
@@ -17,6 +17,7 @@
import {
Entity,
ENTITY_DEFAULT_NAMESPACE,
+ LOCATION_ANNOTATION,
RELATION_CONSUMES_API,
RELATION_PROVIDES_API,
stringifyEntityRef,
@@ -147,6 +148,8 @@ export function AboutCard({ variant }: AboutCardProps) {
cardContentClass = classes.fullHeightCardContent;
}
+ const isUrl =
+ entity.metadata.annotations?.[LOCATION_ANNOTATION]?.startsWith('url:');
const refreshEntity = useCallback(async () => {
await catalogApi.refreshEntity(stringifyEntityRef(entity));
alertApi.post({ message: 'Refresh scheduled', severity: 'info' });
@@ -158,13 +161,15 @@ export function AboutCard({ variant }: AboutCardProps) {
title="About"
action={
<>
-
-
-
+ {isUrl && (
+
+
+
+ )}