Remove AboutCard changes
Signed-off-by: Jake Crews <jake.crews@daveramsey.com>
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Fix link for 'View TechDocs' button on entity's page: kind should be in lowercase by default, uppercase could be enabled
|
||||
if `techdocs.legacyUseCaseSensitiveTripletPaths` is set to `true`.
|
||||
@@ -44,7 +44,6 @@
|
||||
"@backstage/plugin-catalog-react": "^1.1.2-next.3",
|
||||
"@backstage/plugin-search-common": "^0.3.6-next.0",
|
||||
"@backstage/plugin-search-react": "^0.2.2-next.3",
|
||||
"@backstage/plugin-techdocs-react": "1.0.2-next.2",
|
||||
"@backstage/theme": "^0.2.16-next.1",
|
||||
"@backstage/types": "^1.0.0",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
CatalogApi,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { ConfigApi, configApiRef } from '@backstage/core-plugin-api';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
@@ -394,63 +393,6 @@ describe('<AboutCard />', () => {
|
||||
},
|
||||
);
|
||||
|
||||
expect(getByText('View TechDocs').closest('a')).toHaveAttribute(
|
||||
'href',
|
||||
'/docs/default/component/software',
|
||||
);
|
||||
});
|
||||
|
||||
it('renders techdocs link if techdocs.legacyUseCaseSensitiveTripletPaths is true', async () => {
|
||||
const configApi: ConfigApi = new ConfigReader({
|
||||
integrations: {
|
||||
github: [
|
||||
{
|
||||
host: 'github.com',
|
||||
token: '...',
|
||||
},
|
||||
],
|
||||
},
|
||||
techdocs: {
|
||||
legacyUseCaseSensitiveTripletPaths: true,
|
||||
},
|
||||
});
|
||||
|
||||
const entity = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Component',
|
||||
metadata: {
|
||||
name: 'software',
|
||||
annotations: {
|
||||
'backstage.io/techdocs-ref': './',
|
||||
},
|
||||
},
|
||||
spec: {
|
||||
owner: 'guest',
|
||||
type: 'service',
|
||||
lifecycle: 'production',
|
||||
},
|
||||
};
|
||||
|
||||
const { getByText } = await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[scmIntegrationsApiRef, ScmIntegrationsApi.fromConfig(configApi)],
|
||||
[configApiRef, configApi],
|
||||
[catalogApiRef, catalogApi],
|
||||
]}
|
||||
>
|
||||
<EntityProvider entity={entity}>
|
||||
<AboutCard />
|
||||
</EntityProvider>
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/docs/:namespace/:kind/:name': viewTechDocRouteRef,
|
||||
'/catalog/:namespace/:kind/:name': entityRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(getByText('View TechDocs').closest('a')).toHaveAttribute(
|
||||
'href',
|
||||
'/docs/default/Component/software',
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import {
|
||||
ANNOTATION_EDIT_URL,
|
||||
ANNOTATION_LOCATION,
|
||||
getCompoundEntityRef,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -26,12 +26,7 @@ import {
|
||||
InfoCardVariants,
|
||||
Link,
|
||||
} from '@backstage/core-components';
|
||||
import {
|
||||
alertApiRef,
|
||||
configApiRef,
|
||||
useApi,
|
||||
useRouteRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
ScmIntegrationIcon,
|
||||
scmIntegrationsApiRef,
|
||||
@@ -55,7 +50,6 @@ import EditIcon from '@material-ui/icons/Edit';
|
||||
import React, { useCallback } from 'react';
|
||||
import { viewTechDocRouteRef } from '../../routes';
|
||||
import { AboutContent } from './AboutContent';
|
||||
import { toLowercaseEntityRefMaybe } from '@backstage/plugin-techdocs-react';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
gridItemCard: {
|
||||
@@ -97,8 +91,6 @@ export function AboutCard(props: AboutCardProps) {
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const alertApi = useApi(alertApiRef);
|
||||
const viewTechdocLink = useRouteRef(viewTechDocRouteRef);
|
||||
const config = useApi(configApiRef);
|
||||
const entityRef = getCompoundEntityRef(entity);
|
||||
|
||||
const entitySourceLocation = getEntitySourceLocation(
|
||||
entity,
|
||||
@@ -121,7 +113,11 @@ export function AboutCard(props: AboutCardProps) {
|
||||
icon: <DocsIcon />,
|
||||
href:
|
||||
viewTechdocLink &&
|
||||
viewTechdocLink(toLowercaseEntityRefMaybe(entityRef, config)),
|
||||
viewTechdocLink({
|
||||
namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
}),
|
||||
};
|
||||
|
||||
let cardClass = '';
|
||||
|
||||
Reference in New Issue
Block a user