diff options
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx | 18 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx | 4 |
2 files changed, 9 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx index b4d71c1b9ef..d0ea22018fb 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx @@ -30,7 +30,7 @@ import { import * as React from 'react'; import { useIntl } from 'react-intl'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; -import { formatMeasure, formatRating } from '../../../helpers/measures'; +import { formatMeasure } from '../../../helpers/measures'; import { getComponentIssuesUrl } from '../../../helpers/urls'; import { SoftwareImpactMeasureData, @@ -62,22 +62,18 @@ export function SoftwareImpactMeasureCard(props: Readonly<SoftwareImpactBreakdow // Find rating measure const ratingMeasure = measures.find((m) => m.metric.key === ratingMetricKey); - const ratingLabel = ratingMeasure?.value ? formatRating(ratingMeasure.value) : undefined; const totalLinkHref = getComponentIssuesUrl(component.key, { ...DEFAULT_ISSUES_QUERY, impactSoftwareQualities: softwareQuality, }); - // We highlight the highest severity breakdown card with non-zero count if the rating is not A - let highlightedSeverity: SoftwareImpactSeverity | undefined; - if (measure && (!ratingLabel || ratingLabel !== 'A')) { - highlightedSeverity = [ - SoftwareImpactSeverity.High, - SoftwareImpactSeverity.Medium, - SoftwareImpactSeverity.Low, - ].find((severity) => measure[severity] > 0); - } + // We highlight the highest severity breakdown card with non-zero count + const highlightedSeverity = + measure && + [SoftwareImpactSeverity.High, SoftwareImpactSeverity.Medium, SoftwareImpactSeverity.Low].find( + (severity) => measure[severity] > 0, + ); return ( <LightGreyCard diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx index ef86a352004..a956a8b75e3 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx @@ -281,7 +281,7 @@ describe('project overview', () => { [SoftwareImpactSeverity.Medium]: 2, [SoftwareImpactSeverity.Low]: 1, }, - [false, false, false], + [false, true, false], ); ui.expectSoftwareImpactMeasureCard( SoftwareQuality.Maintainability, @@ -327,7 +327,7 @@ describe('project overview', () => { [SoftwareImpactSeverity.Medium]: 2, [SoftwareImpactSeverity.Low]: 1, }, - [false, false, false], + [false, true, false], ); // Maintainability is not computed |