Skip to content

Commit 8657be6

Browse files
authored
tech-insights: refactor ScorecardsBadge to use Tooltip and Tag from @backstage/ui (#7047)
* refactor: replace mui with bui Signed-off-by: Kurt King <kurtaking@gmail.com> * reinstall backstage/ui Signed-off-by: Kurt King <kurtaking@gmail.com> * deps: bump typescript to 5.7.0 Signed-off-by: Kurt King <kurtaking@gmail.com> * rebuild reports after ugprading typescript Signed-off-by: Kurt King <kurtaking@gmail.com> * Release as minor Signed-off-by: Kurt King <kurtaking@gmail.com> --------- Signed-off-by: Kurt King <kurtaking@gmail.com>
1 parent e1154ff commit 8657be6

5 files changed

Lines changed: 45 additions & 26 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-tech-insights': minor
3+
---
4+
5+
The `ScorecardsBadge` component has been rewritten with `@backstage/ui`.

workspaces/tech-insights/packages/app/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
5050
import { RequirePermission } from '@backstage/plugin-permission-react';
5151
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
5252

53+
import '@backstage/ui/css/styles.css';
54+
5355
const app = createApp({
5456
apis,
5557
bindRoutes({ bind }) {

workspaces/tech-insights/plugins/tech-insights/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"@backstage/frontend-plugin-api": "backstage:^",
6666
"@backstage/plugin-catalog-react": "backstage:^",
6767
"@backstage/types": "backstage:^",
68+
"@backstage/ui": "backstage:^",
6869
"@material-table/exporters": "^1.2.19",
6970
"@material-ui/core": "^4.12.2",
7071
"@material-ui/icons": "^4.9.1",

workspaces/tech-insights/plugins/tech-insights/src/components/ScorecardsBadge/ScorecardsBadge.tsx

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { CheckResult } from '@backstage-community/plugin-tech-insights-common';
1817
import { Entity } from '@backstage/catalog-model';
19-
import Chip from '@material-ui/core/Chip';
2018
import { useApi } from '@backstage/core-plugin-api';
19+
import { Tooltip, Tag, TagGroup, TooltipTrigger } from '@backstage/ui';
20+
21+
import { CheckResult } from '@backstage-community/plugin-tech-insights-common';
2122
import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
22-
import Tooltip from '@material-ui/core/Tooltip';
23+
2324
import { ScorecardsList } from '../ScorecardsList';
2425

2526
export const ScorecardsBadge = (props: {
@@ -43,25 +44,34 @@ export const ScorecardsBadge = (props: {
4344
({ result, renderer }) => !renderer?.isFailed?.(result),
4445
).length;
4546

47+
const isAllPassing = succeeded === checkResults.length;
48+
4649
return (
47-
<Tooltip
48-
title={
49-
<ScorecardsList
50-
checkResults={checkResults}
51-
entity={entity}
52-
dense
53-
hideDescription
54-
/>
55-
}
56-
>
57-
<Chip
58-
label={`${succeeded}/${checkResults.length}`}
59-
size="small"
60-
style={{
61-
backgroundColor:
62-
succeeded === checkResults.length ? 'mediumseagreen' : 'orangered',
63-
}}
64-
/>
65-
</Tooltip>
50+
<TooltipTrigger>
51+
<TagGroup>
52+
<Tag
53+
size="medium"
54+
style={{
55+
borderRadius: 16,
56+
paddingTop: 8,
57+
paddingBottom: 8,
58+
paddingLeft: 16,
59+
paddingRight: 16,
60+
backgroundColor: isAllPassing ? 'mediumseagreen' : 'orangered',
61+
}}
62+
>
63+
{`${succeeded}/${checkResults.length}`}
64+
</Tag>
65+
66+
<Tooltip>
67+
<ScorecardsList
68+
checkResults={checkResults}
69+
entity={entity}
70+
dense
71+
hideDescription
72+
/>
73+
</Tooltip>
74+
</TagGroup>
75+
</TooltipTrigger>
6676
);
6777
};

workspaces/tech-insights/yarn.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,7 @@ __metadata:
16031603
"@backstage/frontend-plugin-api": "backstage:^"
16041604
"@backstage/plugin-catalog-react": "backstage:^"
16051605
"@backstage/types": "backstage:^"
1606+
"@backstage/ui": "backstage:^"
16061607
"@material-table/exporters": "npm:^1.2.19"
16071608
"@material-ui/core": "npm:^4.12.2"
16081609
"@material-ui/icons": "npm:^4.9.1"
@@ -3532,9 +3533,9 @@ __metadata:
35323533
languageName: node
35333534
linkType: hard
35343535

3535-
"@backstage/ui@npm:^0.11.0":
3536-
version: 0.11.1
3537-
resolution: "@backstage/ui@npm:0.11.1"
3536+
"@backstage/ui@backstage:^::backstage=1.47.2&npm=0.11.2, @backstage/ui@npm:^0.11.0, @backstage/ui@npm:^0.11.2":
3537+
version: 0.11.2
3538+
resolution: "@backstage/ui@npm:0.11.2"
35383539
dependencies:
35393540
"@backstage/version-bridge": "npm:^1.0.11"
35403541
"@remixicon/react": "npm:^4.6.0"
@@ -3549,7 +3550,7 @@ __metadata:
35493550
peerDependenciesMeta:
35503551
"@types/react":
35513552
optional: true
3552-
checksum: 10/7343621ebcef22ead8b4fed717afaee567a17eed01a3de3e57db210b30031a75375faa5486f275a004064f42341de4f847fbcbca03e9360e747e3efd8c95a722
3553+
checksum: 10/d3aea803533a276cf27f52d24e261cdf396db09f4e9321e8d199b32c6e00ffaf969d6aeabf7533e2db739b58834f315f1f0153974953400c631c8957aed74275
35533554
languageName: node
35543555
linkType: hard
35553556

0 commit comments

Comments
 (0)