Skip to content

Commit

Permalink
feat(catalog): remove 'View Api' link from AboutCard
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Schwank <dominik.schwank@sda.se>
  • Loading branch information
dschwank committed Nov 10, 2021
1 parent 4a0b969 commit 38d6df6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .changeset/big-months-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@backstage/plugin-catalog': patch
---

Remove the "View Api" icon in the AboutCard, as the information is misleading for some users and is
duplicated in the tabs above.
25 changes: 1 addition & 24 deletions plugins/catalog/src/components/AboutCard/AboutCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {
Entity,
ENTITY_DEFAULT_NAMESPACE,
LOCATION_ANNOTATION,
RELATION_CONSUMES_API,
RELATION_PROVIDES_API,
stringifyEntityRef,
} from '@backstage/catalog-model';
import {
Expand All @@ -36,7 +34,6 @@ import {
import {
catalogApiRef,
getEntityMetadataEditUrl,
getEntityRelations,
getEntitySourceLocation,
useEntity,
} from '@backstage/plugin-catalog-react';
Expand All @@ -51,7 +48,6 @@ import {
import CachedIcon from '@material-ui/icons/Cached';
import DocsIcon from '@material-ui/icons/Description';
import EditIcon from '@material-ui/icons/Edit';
import ExtensionIcon from '@material-ui/icons/Extension';
import React, { useCallback } from 'react';
import { viewTechDocRouteRef } from '../../routes';
import { AboutContent } from './AboutContent';
Expand Down Expand Up @@ -95,16 +91,6 @@ export function AboutCard({ variant }: AboutCardProps) {
scmIntegrationsApi,
);
const entityMetadataEditUrl = getEntityMetadataEditUrl(entity);
const providesApiRelations = getEntityRelations(
entity,
RELATION_PROVIDES_API,
);
const consumesApiRelations = getEntityRelations(
entity,
RELATION_CONSUMES_API,
);
const hasApis =
providesApiRelations.length > 0 || consumesApiRelations.length > 0;

const viewInSource: IconLinkVerticalProps = {
label: 'View Source',
Expand All @@ -126,13 +112,6 @@ export function AboutCard({ variant }: AboutCardProps) {
name: entity.metadata.name,
}),
};
const viewApi: IconLinkVerticalProps = {
title: hasApis ? '' : 'No APIs available',
label: 'View API',
disabled: !hasApis,
icon: <ExtensionIcon />,
href: 'api',
};

let cardClass = '';
if (variant === 'gridItem') {
Expand Down Expand Up @@ -181,9 +160,7 @@ export function AboutCard({ variant }: AboutCardProps) {
</IconButton>
</>
}
subheader={
<HeaderIconLinkRow links={[viewInSource, viewInTechDocs, viewApi]} />
}
subheader={<HeaderIconLinkRow links={[viewInSource, viewInTechDocs]} />}
/>
<Divider />
<CardContent className={cardContentClass}>
Expand Down

0 comments on commit 38d6df6

Please sign in to comment.