From 0ae94e3ed692e307325577ef84084261b61395a0 Mon Sep 17 00:00:00 2001 From: Jesse Bye Date: Thu, 25 Feb 2021 14:05:45 -0800 Subject: [PATCH 1/8] Default to 0% if no coverage is reported --- .../sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index 12ed5b3bf4..dfd4f7f0fd 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -232,7 +232,7 @@ export const SonarQubeCard = ({ link={value.getComponentMeasuresUrl('COVERAGE')} title="Coverage" leftSlot={} - rightSlot={} + rightSlot={} /> Date: Thu, 25 Feb 2021 14:23:56 -0800 Subject: [PATCH 2/8] prettier --- .../sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index dfd4f7f0fd..e0339a305e 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -232,7 +232,7 @@ export const SonarQubeCard = ({ link={value.getComponentMeasuresUrl('COVERAGE')} title="Coverage" leftSlot={} - rightSlot={} + rightSlot={} /> Date: Thu, 25 Feb 2021 14:41:18 -0800 Subject: [PATCH 3/8] prettier --- .../src/components/SonarQubeCard/SonarQubeCard.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index e0339a305e..9cd181e6c5 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -85,9 +85,9 @@ const defaultDuplicationRatings: DuplicationRating[] = [ ]; export const SonarQubeCard = ({ - variant = 'gridItem', - duplicationRatings = defaultDuplicationRatings, -}: { + variant = 'gridItem', + duplicationRatings = defaultDuplicationRatings, + }: { entity?: Entity; variant?: InfoCardVariants; duplicationRatings?: DuplicationRating[]; @@ -105,9 +105,9 @@ export const SonarQubeCard = ({ const deepLink = !loading && value ? { - title: 'View more', - link: value.projectUrl, - } + title: 'View more', + link: value.projectUrl, + } : undefined; const classes = useStyles(); @@ -232,7 +232,7 @@ export const SonarQubeCard = ({ link={value.getComponentMeasuresUrl('COVERAGE')} title="Coverage" leftSlot={} - rightSlot={} + rightSlot={} /> Date: Thu, 25 Feb 2021 14:48:07 -0800 Subject: [PATCH 4/8] fix code style --- .../src/components/SonarQubeCard/SonarQubeCard.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index 9cd181e6c5..a8f0cfe491 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -85,9 +85,9 @@ const defaultDuplicationRatings: DuplicationRating[] = [ ]; export const SonarQubeCard = ({ - variant = 'gridItem', - duplicationRatings = defaultDuplicationRatings, - }: { + variant = 'gridItem', + duplicationRatings = defaultDuplicationRatings, +}: { entity?: Entity; variant?: InfoCardVariants; duplicationRatings?: DuplicationRating[]; @@ -105,9 +105,9 @@ export const SonarQubeCard = ({ const deepLink = !loading && value ? { - title: 'View more', - link: value.projectUrl, - } + title: 'View more', + link: value.projectUrl, + } : undefined; const classes = useStyles(); From a4c57580285f3d189c6c1b0ea15193717eccd004 Mon Sep 17 00:00:00 2001 From: Jesse Bye Date: Fri, 26 Feb 2021 11:47:46 -0800 Subject: [PATCH 5/8] Use '-'; add changeset --- .changeset/shaggy-spiders-shop.md | 5 +++++ .../sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/shaggy-spiders-shop.md diff --git a/.changeset/shaggy-spiders-shop.md b/.changeset/shaggy-spiders-shop.md new file mode 100644 index 0000000000..ae500f1e81 --- /dev/null +++ b/.changeset/shaggy-spiders-shop.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-sonarqube': patch +--- + +Display '-' instead of 'undefined' if no code coverage is reported. diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index a8f0cfe491..e4fbc64479 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -232,7 +232,9 @@ export const SonarQubeCard = ({ link={value.getComponentMeasuresUrl('COVERAGE')} title="Coverage" leftSlot={} - rightSlot={} + rightSlot={ + + } /> Date: Fri, 26 Feb 2021 11:57:04 -0800 Subject: [PATCH 6/8] =?UTF-8?q?use=20=E2=80=94=20instead=20of=20-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index e4fbc64479..6e471fc477 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -233,7 +233,7 @@ export const SonarQubeCard = ({ title="Coverage" leftSlot={} rightSlot={ - + } /> Date: Fri, 26 Feb 2021 11:59:23 -0800 Subject: [PATCH 7/8] more consistency; omit % when no coverage is reported --- .../src/components/SonarQubeCard/SonarQubeCard.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index 6e471fc477..77ff035605 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -233,7 +233,13 @@ export const SonarQubeCard = ({ title="Coverage" leftSlot={} rightSlot={ - + } /> Date: Fri, 26 Feb 2021 15:24:20 -0800 Subject: [PATCH 8/8] check for undefined instead to allow displaying 0 values --- .../sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index 77ff035605..14b8ae1af6 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -235,7 +235,7 @@ export const SonarQubeCard = ({ rightSlot={