From af61ada2bb75d85926229dfd7d23596057c325f0 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 14 Jul 2016 14:26:24 +0200 Subject: [PATCH] SONAR-7809 fix bad rendering when there is no new coverage on the Overview page --- .../src/main/js/apps/overview/main/Coverage.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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}
-- 2.39.5