From 1cf23e05cb947d9f7dd8563308ae1263cd6c8ab0 Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Fri, 19 Feb 2021 22:22:05 +0100 Subject: [PATCH] badges: fix markdown title bug. cleanup about card. Signed-off-by: Andreas Stenius --- app-config.yaml | 15 ++++++++++++--- plugins/badges/src/BadgesClientApi.ts | 2 +- .../src/components/AboutCard/AboutContent.tsx | 4 ---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index 5efebaab91..7a4fc0a929 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -407,20 +407,29 @@ badges: pingback: kind: 'entity' description: 'Link back to $${app.title}' - target: '$${window.location.href}' + target: '$${entity_url}' label: 'View $${entity.metadata.name} in' message: '$${app.title}' lifecycle: kind: 'entity' description: 'Entity lifecycle badge' - target: '$${window.location.href}' + target: '$${entity_url}' label: 'Lifecycle' message: '$${entity.spec.lifecycle}' owner: kind: 'entity' + title: 'Resource Owner' description: 'Entity owner badge' - target: '$${window.location.href}' + target: '$${entity_url}' label: 'Owner' message: '$${entity.spec.owner}' + color: 'blue' + + docs: + kind: 'entity' + target: '$${entity_url}/docs' + label: 'Documentation' + message: '$${entity.metadata.name}' + color: 'navyblue' diff --git a/plugins/badges/src/BadgesClientApi.ts b/plugins/badges/src/BadgesClientApi.ts index 14f4adebc8..79749e4933 100644 --- a/plugins/badges/src/BadgesClientApi.ts +++ b/plugins/badges/src/BadgesClientApi.ts @@ -81,7 +81,7 @@ export class BadgesClientApi { } private getBadgeMarkdownCode(badge: object): string { - const title = badge.title && ` "${badge.title}"`; + const title = badge.title ? ` "${badge.title}"` : ''; const img = `![${badge.description}](${badge.url}${title})`; if (!badge.target) { return img; diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.tsx index d799668433..695595285b 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.tsx @@ -25,7 +25,6 @@ import { } from '@backstage/plugin-catalog-react'; import { Chip, Grid, makeStyles, Typography } from '@material-ui/core'; import React from 'react'; -import { EntityBadgesField } from '@backstage/plugin-badges'; import { AboutField } from './AboutField'; const useStyles = makeStyles({ @@ -128,9 +127,6 @@ export const AboutContent = ({ entity }: Props) => { ))} - - - ); };