From 49713d9e445ee290c0e2a95441a0db76db155100 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Mon, 22 Mar 2021 22:23:59 -0400 Subject: [PATCH 1/7] Add icon to badge menu Signed-off-by: Adam Harvey --- .../src/components/EntityContextMenu/EntityContextMenu.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx index b9af9b307e..e4275181df 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx @@ -24,6 +24,7 @@ import { } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import Cancel from '@material-ui/icons/Cancel'; +import BadgeIcon from '@material-ui/icons/CallToAction'; import MoreVert from '@material-ui/icons/MoreVert'; import React, { useState } from 'react'; @@ -81,6 +82,9 @@ export const EntityContextMenu = ({ onShowBadgesDialog(); }} > + + + Badges )} From a2a8463b4b6915dc56632967b5e012a85ce6f2cd Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Mon, 22 Mar 2021 22:39:43 -0400 Subject: [PATCH 2/7] Update dialog format Signed-off-by: Adam Harvey --- .../src/components/EntityBadgesDialog.tsx | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx index 74a244e698..b3c0a4fee4 100644 --- a/plugins/badges/src/components/EntityBadgesDialog.tsx +++ b/plugins/badges/src/components/EntityBadgesDialog.tsx @@ -22,6 +22,7 @@ import { useApi, } from '@backstage/core'; import { + Box, Button, Dialog, DialogActions, @@ -55,7 +56,6 @@ export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => { const theme = useTheme(); const fullScreen = useMediaQuery(theme.breakpoints.down('sm')); const badgesApi = useApi(badgesApiRef); - const classes = useStyles(); const { value: badges, loading, error } = useAsync(async () => { if (open) { @@ -67,18 +67,11 @@ export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => { const content = (badges || []).map( ({ badge: { description }, id, url, markdown }) => ( -
- - {description || `${id} badge`} -
- {description -
- - Copy the following snippet of markdown code for the badge: - - -
-
+ + + {description + + ), ); @@ -87,6 +80,10 @@ export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => { Entity Badges + + Embed badges in other web sites that link back to this entity. Copy + the relevant snippet of Markdown code to use the badge. + {loading && } {error && } {content} From 687f066e129397b0924b985ceabb67d3411f0bdb Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Mon, 22 Mar 2021 22:41:46 -0400 Subject: [PATCH 3/7] Add changeset Signed-off-by: Adam Harvey --- .changeset/calm-mugs-jog.md | 5 +++++ .changeset/silly-crabs-press.md | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/calm-mugs-jog.md create mode 100644 .changeset/silly-crabs-press.md diff --git a/.changeset/calm-mugs-jog.md b/.changeset/calm-mugs-jog.md new file mode 100644 index 0000000000..6cb5c1de24 --- /dev/null +++ b/.changeset/calm-mugs-jog.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-badges': patch +--- + +Update badge dialog formatting diff --git a/.changeset/silly-crabs-press.md b/.changeset/silly-crabs-press.md new file mode 100644 index 0000000000..64895cb847 --- /dev/null +++ b/.changeset/silly-crabs-press.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Add icon for entity badge menu From f29a41bcc41a0c96e90d3c2327a64f51b912a186 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Mon, 22 Mar 2021 22:46:16 -0400 Subject: [PATCH 4/7] Test check for Markdown output Signed-off-by: Adam Harvey --- plugins/badges/src/components/EntityBadgesDialog.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/badges/src/components/EntityBadgesDialog.test.tsx b/plugins/badges/src/components/EntityBadgesDialog.test.tsx index 2491a3462c..25a6f01c1a 100644 --- a/plugins/badges/src/components/EntityBadgesDialog.test.tsx +++ b/plugins/badges/src/components/EntityBadgesDialog.test.tsx @@ -55,7 +55,7 @@ describe('EntityBadgesDialog', () => { ); await expect( - rendered.findByText('testbadge badge'), + rendered.findByText('![test: badge](http://127.0.0.1/catalog/...)'), ).resolves.toBeInTheDocument(); }); }); From 63541d53dc74cf253fdc430037734b29b3961b27 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Mon, 22 Mar 2021 22:56:34 -0400 Subject: [PATCH 5/7] Remove unused formatting Signed-off-by: Adam Harvey --- plugins/badges/src/components/EntityBadgesDialog.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx index b3c0a4fee4..58bce6a03b 100644 --- a/plugins/badges/src/components/EntityBadgesDialog.tsx +++ b/plugins/badges/src/components/EntityBadgesDialog.tsx @@ -33,7 +33,6 @@ import { useMediaQuery, useTheme, } from '@material-ui/core'; -import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; import { useAsync } from 'react-use'; import { badgesApiRef } from '../api'; @@ -44,14 +43,6 @@ type Props = { entity: Entity; }; -const useStyles = makeStyles({ - codeBlock: { - '& code': { - whiteSpace: 'pre-wrap', - }, - }, -}); - export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => { const theme = useTheme(); const fullScreen = useMediaQuery(theme.breakpoints.down('sm')); From 9f4e12cf925bfd2a0797046299961dc9b40bbcd7 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Wed, 24 Mar 2021 10:00:33 -0400 Subject: [PATCH 6/7] Move typography to DialogContentText Signed-off-by: Adam Harvey --- plugins/badges/src/components/EntityBadgesDialog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx index 58bce6a03b..c7ce7b822c 100644 --- a/plugins/badges/src/components/EntityBadgesDialog.tsx +++ b/plugins/badges/src/components/EntityBadgesDialog.tsx @@ -71,10 +71,10 @@ export const EntityBadgesDialog = ({ open, onClose, entity }: Props) => { Entity Badges - + Embed badges in other web sites that link back to this entity. Copy the relevant snippet of Markdown code to use the badge. - + {loading && } {error && } {content} From da5d235f0f3488e930f1abbd0afc6b9285c1c150 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Wed, 24 Mar 2021 10:04:56 -0400 Subject: [PATCH 7/7] Remove unused import Signed-off-by: Adam Harvey --- plugins/badges/src/components/EntityBadgesDialog.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx index c7ce7b822c..f6ba9de9fe 100644 --- a/plugins/badges/src/components/EntityBadgesDialog.tsx +++ b/plugins/badges/src/components/EntityBadgesDialog.tsx @@ -29,7 +29,6 @@ import { DialogContent, DialogContentText, DialogTitle, - Typography, useMediaQuery, useTheme, } from '@material-ui/core';