]> source.dussan.org Git - sonarqube.git/commitdiff
display number of new lines to cover on overview page
authorStas Vilchik <vilchiks@gmail.com>
Mon, 16 May 2016 13:15:08 +0000 (15:15 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 16 May 2016 13:15:18 +0000 (15:15 +0200)
server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js
server/sonar-web/src/main/js/apps/overview/main/Coverage.js
server/sonar-web/src/main/js/apps/overview/styles.css
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index fdd667d396dd481d926171e6e3744527f11af0ae..19603ac1fccbf5934681723cba7ad847ee01e190 100644 (file)
@@ -65,6 +65,9 @@ const METRICS = [
   'new_coverage',
   'it_coverage',
   'new_it_coverage',
+  'new_lines_to_cover',
+  'new_it_lines_to_cover',
+  'new_overall_lines_to_cover',
   'tests',
 
   // duplications
index d86fb2b88ffc948736f6a11bbb3ebd5cab7dc824..d6aee6495a1af4a8a2d5c0579efa43088abd358b 100644 (file)
@@ -57,6 +57,12 @@ class Coverage extends React.Component {
         .find(measure => measure.metric.key === `new_${prefix}coverage`);
   }
 
+  getNewLinesToCover (prefix) {
+    const { measures } = this.props;
+    return measures
+        .find(measure => measure.metric.key === `new_${prefix}lines_to_cover`);
+  }
+
   renderHeader () {
     return this.props.renderHeader(
         'Coverage',
@@ -109,29 +115,50 @@ class Coverage extends React.Component {
   renderNewCoverage (coverageMetricPrefix) {
     const { component, leakPeriod } = this.props;
     const newCoverageMeasure = this.getNewCoverageMeasure(coverageMetricPrefix);
+    const newLinesToCover = this.getNewLinesToCover(coverageMetricPrefix);
 
     const value = newCoverageMeasure ? (
-        <DrilldownLink
-            component={component.key}
-            metric={newCoverageMeasure.metric.key}
-            period={leakPeriod.index}>
-          <span className="js-overview-main-new-coverage">
-            {formatMeasure(getPeriodValue(newCoverageMeasure, leakPeriod.index), 'PERCENT')}
-          </span>
-        </DrilldownLink>
+        <div>
+          <DrilldownLink
+              component={component.key}
+              metric={newCoverageMeasure.metric.key}
+              period={leakPeriod.index}>
+            <span className="js-overview-main-new-coverage">
+              {formatMeasure(getPeriodValue(newCoverageMeasure, leakPeriod.index), 'PERCENT')}
+            </span>
+          </DrilldownLink>
+        </div>
     ) : (
         <span>—</span>
     );
 
+    const label = newLinesToCover ? (
+        <div className="overview-domain-measure-label">
+          {translate('overview.coverage_on')}
+          <br/>
+          <DrilldownLink
+              className="spacer-right overview-domain-secondary-measure-value"
+              component={component.key}
+              metric={newLinesToCover.metric.key}
+              period={leakPeriod.index}>
+            <span className="js-overview-main-new-coverage">
+              {formatMeasure(getPeriodValue(newLinesToCover, leakPeriod.index), 'SHORT_INT')}
+            </span>
+          </DrilldownLink>
+          {getMetricName('new_ncloc')}
+        </div>
+    ) : (
+        <div className="overview-domain-measure-label">
+          {getMetricName('new_coverage')}
+        </div>
+    );
+
     return (
         <div className="overview-domain-measure">
           <div className="overview-domain-measure-value">
             {value}
           </div>
-
-          <div className="overview-domain-measure-label">
-            {getMetricName('new_coverage')}
-          </div>
+          {label}
         </div>
     );
   }
index 7e09cd5241c938baea14a3b5f11c86bab637977f..d31c9a404c811d1721b79fc3f8754a2a0c04c357 100644 (file)
   font-weight: 300;
 }
 
+.overview-domain-secondary-measure-value {
+  line-height: 1;
+  font-size: 20px;
+  font-weight: 300;
+}
+
 .overview-domain-leak .overview-domain-measure-value {
   text-align: center;
 }
index c9d6cab70c7cc798cae3b5422463ad58075472c6..442e81d8f8356024cbcac6d4dd1a7b43eb57c6b0 100644 (file)
@@ -3132,7 +3132,9 @@ overview.metric.new_coverage=Coverage on New Code
 overview.metric.duplications=Duplications
 overview.metric.duplicated_blocks=Duplicated Blocks
 overview.metric.ncloc=Lines of Code
+overview.metric.new_ncloc=New Lines of Code
 overview.metric.files=Files
+overview.coverage_on=Coverage on
 
 overview.period.previous_version=since {0}
 overview.period.previous_version_only_date=since previous version