From: Stas Vilchik Date: Thu, 14 Jul 2016 12:26:24 +0000 (+0200) Subject: SONAR-7809 fix bad rendering when there is no new coverage on the Overview page X-Git-Tag: 6.0-RC1~39^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=af61ada2bb75d85926229dfd7d23596057c325f0;p=sonarqube.git SONAR-7809 fix bad rendering when there is no new coverage on the Overview page --- diff --git a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js index d6aee6495a1..46da2f17b8a 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js +++ b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js @@ -117,14 +117,19 @@ class Coverage extends React.Component { const newCoverageMeasure = this.getNewCoverageMeasure(coverageMetricPrefix); const newLinesToCover = this.getNewLinesToCover(coverageMetricPrefix); - const value = newCoverageMeasure ? ( + const newCoverageValue = newCoverageMeasure ? + getPeriodValue(newCoverageMeasure, leakPeriod.index) : null; + const newLinesToCoverValue = newLinesToCover ? + getPeriodValue(newLinesToCover, leakPeriod.index) : null; + + const formattedValue = newCoverageValue != null ? (
- {formatMeasure(getPeriodValue(newCoverageMeasure, leakPeriod.index), 'PERCENT')} + {formatMeasure(newCoverageValue, 'PERCENT')}
@@ -132,7 +137,7 @@ class Coverage extends React.Component { — ); - const label = newLinesToCover ? ( + const label = newLinesToCoverValue != null ? (
{translate('overview.coverage_on')}
@@ -142,7 +147,7 @@ class Coverage extends React.Component { metric={newLinesToCover.metric.key} period={leakPeriod.index}> - {formatMeasure(getPeriodValue(newLinesToCover, leakPeriod.index), 'SHORT_INT')} + {formatMeasure(newLinesToCoverValue, 'SHORT_INT')} {getMetricName('new_ncloc')} @@ -156,7 +161,7 @@ class Coverage extends React.Component { return (
- {value} + {formattedValue}
{label}