Sonarqube mig#9460
Open
amitkumar489 wants to merge 3 commits into
Open
Conversation
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Contributor
Changed Packages
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR migrates the SonarQube card UI from Material-UI v4 components/styles to Backstage UI (BUI) components with CSS modules, removing deprecated MUI dependencies.
Changes:
- Replaced MUI components (
Grid,Typography,Avatar,Chip,Tooltip) with BUI primitives (Flex,Box,Text,Tag) and CSS modules. - Introduced CSS module styles for the SonarQube card subcomponents (Value, Rating, RatingCard, MetricInsights, Percentage).
- Updated dependencies to add
@backstage/ui,@remixicon/react, andreact-aria-components, and removed MUI v4 packages.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Value.tsx | Switches value rendering from MUI Typography/JSS to BUI Text + CSS modules. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Value.module.css | Adds CSS module styling for the Value component. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx | Replaces MUI Grid/JSS with BUI layout primitives and CSS modules. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.module.css | Adds CSS module styling for SonarQubeCard header/action/lastAnalyzed. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/RatingCard.tsx | Migrates rating card layout/typography to BUI + CSS modules. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/RatingCard.module.css | Adds CSS module styling for RatingCard layout. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Rating.tsx | Replaces MUI Avatar/JSS color logic with CSS-module-based rating badges. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Rating.module.css | Adds CSS module styling for rating badges A–E. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Percentage.tsx | Migrates circle sizing to CSS module; replaces theme-derived colors with constants. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/Percentage.module.css | Adds CSS module sizing for the percentage circle. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/MetricInsights.tsx | Migrates chips/icons/tooltips to BUI + remixicon + react-aria tooltip trigger. |
| workspaces/sonarqube/plugins/sonarqube/src/components/SonarQubeCard/MetricInsights.module.css | Adds CSS module styling for the quality-gate badge variants. |
| workspaces/sonarqube/plugins/sonarqube/package.json | Removes MUI v4 deps and adds BUI + remixicon + react-aria-components. |
| workspaces/sonarqube/.changeset/eighty-baboons-eat.md | Declares a major version bump and describes the migration. |
| sonarqube/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.module.css | Adds a second SonarQubeCard CSS module file in a different path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
50
to
85
| let gateLabel: string = t('sonarQubeCard.qualityBadgeLabel.notComputed'); | ||
| let gateColor = classes.badgeUnknown; | ||
| let gateLinkToolTip = ''; | ||
| let badgeClass = styles.badgeUnknown; | ||
| const gateLinkToolTip = ''; | ||
| if (value?.metrics.alert_status) { | ||
| const gatePassed = value?.metrics.alert_status === 'OK'; | ||
| gateLabel = gatePassed | ||
| ? t('sonarQubeCard.qualityBadgeLabel.gatePassed') | ||
| : t('sonarQubeCard.qualityBadgeLabel.gateFailed'); | ||
| gateColor = gatePassed ? classes.badgeSuccess : classes.badgeError; | ||
| } | ||
| let clickableAttrs = {}; | ||
| if (value.projectUrl) { | ||
| gateLinkToolTip = t('sonarQubeCard.qualityBadgeTooltip'); | ||
| clickableAttrs = { | ||
| component: 'a', | ||
| href: value.projectUrl, | ||
| target: '_blank', | ||
| rel: 'noopener noreferrer', | ||
| clickable: true, | ||
| }; | ||
| badgeClass = gatePassed ? styles.badgeSuccess : styles.badgeError; | ||
| } | ||
|
|
||
| const qualityBadge = ( | ||
| <Tooltip title={gateLinkToolTip}> | ||
| <Chip | ||
| label={gateLabel} | ||
| {...clickableAttrs} | ||
| className={props.compact ? classes.badgeCompact : ''} | ||
| classes={{ root: gateColor, label: classes.badgeLabel }} | ||
| icon={value.projectUrl ? <LinkIcon /> : undefined} | ||
| /> | ||
| </Tooltip> | ||
| <Tag | ||
| className={`${badgeClass} ${props.compact ? styles.badgeCompact : ''}`} | ||
| > | ||
| {value.projectUrl ? <RiExternalLinkLine size={16} /> : null} | ||
| {gateLabel} | ||
| </Tag> | ||
| ); | ||
|
|
||
| if (!gateLinkToolTip && !value.projectUrl) { | ||
| return qualityBadge; | ||
| } | ||
|
|
||
| return ( | ||
| <TooltipTrigger> | ||
| {value.projectUrl ? ( | ||
| <a href={value.projectUrl} target="_blank" rel="noopener noreferrer"> | ||
| {qualityBadge} | ||
| </a> | ||
| ) : ( | ||
| qualityBadge | ||
| )} | ||
| {gateLinkToolTip && <Tooltip>{gateLinkToolTip}</Tooltip>} | ||
| </TooltipTrigger> | ||
| ); |
Comment on lines
+7
to
+12
| .upper { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: var(--bui-space-2); | ||
| } |
Comment on lines
+30
to
+33
| .right { | ||
| display: flex; | ||
| margin-left: var(--bui-space-1); | ||
| } |
Comment on lines
+21
to
+22
| const okColor = '#1db679'; | ||
| const errorColor = '#e82c3c'; |
Comment on lines
+29
to
+30
| strokeColor={okColor} | ||
| trailColor={errorColor} |
Comment on lines
+14
to
+24
| .ratingA { | ||
| height: var(--bui-space-6); | ||
| width: var(--bui-space-6); | ||
| color: var(--bui-fg-primary); | ||
| background-color: #1db679; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| border-radius: var(--bui-radius-2); | ||
| font-weight: 600; | ||
| } |
Comment on lines
+106
to
+114
| <Flex direction="column" align="center" style={{ height: '100%' }}> | ||
| <div | ||
| style={{ | ||
| display: 'flex', | ||
| flexWrap: 'wrap', | ||
| justifyContent: 'space-around', | ||
| width: '100%', | ||
| }} | ||
| > |
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| '@backstage-community/plugin-sonarqube-react': major | |||
Comment on lines
+1
to
+14
| @layer components { | ||
| .header { | ||
| padding: var(--bui-space-4) var(--bui-space-4) var(--bui-space-4) var(--bui-space-5); | ||
| } | ||
|
|
||
| .action { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .lastAnalyzed { | ||
| color: var(--bui-fg-secondary); | ||
| padding: var(--bui-space-2) 0; | ||
| } | ||
| } |
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I just made a Pull Request!
migrated the @backstage-community/plugin-sonarqube plugin from Material-UI (MUI) v4 to Backstage UI (BUI) v1.7.0, eliminating deprecated Material-UI dependencies while improving theming consistency and reducing bundle size.
✔️ Checklist
Signed-off-byline in the message. (more info)