]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15854 Correctly localize metric names
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 4 Jan 2022 10:00:25 +0000 (11:00 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 5 Jan 2022 20:02:50 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx
server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/QualityGateCondition-test.tsx.snap

index 8fc7bd9740af6c6cf2bdfcdd952669369c8e03eb..a3a191f3ac40fbf83e3625304d2aa1cfdbf778d7 100644 (file)
@@ -25,7 +25,7 @@ import Measure from '../../../components/measure/Measure';
 import DrilldownLink from '../../../components/shared/DrilldownLink';
 import { getBranchLikeQuery } from '../../../helpers/branch-like';
 import { translate } from '../../../helpers/l10n';
-import { formatMeasure, isDiffMetric } from '../../../helpers/measures';
+import { formatMeasure, isDiffMetric, localizeMetric } from '../../../helpers/measures';
 import {
   getComponentIssuesUrl,
   getComponentSecurityHotspotsUrl,
@@ -157,7 +157,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
         <div>
           <span className="overview-quality-gate-condition-metric little-spacer-right">
             <IssueTypeIcon className="little-spacer-right" query={metric.key} />
-            {metric.name}
+            {localizeMetric(metric.key)}
           </span>
           {!isDiff && condition.period != null && (
             <span className="overview-quality-gate-condition-period text-ellipsis little-spacer-right">
index 5696e71d480930f4b20b7a5fb8335abb419c7045..eef919fededbe2db35e023d882327b8c9dada7ca 100644 (file)
@@ -28,7 +28,7 @@ exports[`should render correclty 1`] = `
           className="little-spacer-right"
           query="open_issues"
         />
-        open_issues
+        metric.open_issues.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -80,7 +80,7 @@ exports[`should render correclty 2`] = `
           className="little-spacer-right"
           query="reliability_rating"
         />
-        reliability_rating
+        metric.reliability_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -132,7 +132,7 @@ exports[`should render correclty 3`] = `
           className="little-spacer-right"
           query="security_rating"
         />
-        security_rating
+        metric.security_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -183,7 +183,7 @@ exports[`should render correclty 4`] = `
           className="little-spacer-right"
           query="sqale_rating"
         />
-        sqale_rating
+        metric.sqale_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -236,7 +236,7 @@ exports[`should render correclty 5`] = `
           className="little-spacer-right"
           query="new_reliability_rating"
         />
-        new_reliability_rating
+        metric.new_reliability_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -289,7 +289,7 @@ exports[`should render correclty 6`] = `
           className="little-spacer-right"
           query="new_security_rating"
         />
-        new_security_rating
+        metric.new_security_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -341,7 +341,7 @@ exports[`should render correclty 7`] = `
           className="little-spacer-right"
           query="new_maintainability_rating"
         />
-        new_maintainability_rating
+        metric.new_maintainability_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -396,7 +396,7 @@ exports[`should render correclty 8`] = `
           className="little-spacer-right"
           query="security_hotspots_reviewed"
         />
-        security_hotspots_reviewed
+        metric.security_hotspots_reviewed.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -451,7 +451,7 @@ exports[`should render correclty 9`] = `
           className="little-spacer-right"
           query="new_security_hotspots_reviewed"
         />
-        new_security_hotspots_reviewed
+        metric.new_security_hotspots_reviewed.name
       </span>
       <span
         className="little-spacer-top small text-muted"
@@ -504,7 +504,7 @@ exports[`should work with branch 1`] = `
           className="little-spacer-right"
           query="new_maintainability_rating"
         />
-        new_maintainability_rating
+        metric.new_maintainability_rating.name
       </span>
       <span
         className="little-spacer-top small text-muted"