aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-07-14 14:26:24 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-07-14 14:26:24 +0200
commit5c9215f07d350436eaf5b03639c13cd3efbbd483 (patch)
tree19b78f15a2ae6f18ebdb89b1d00b42c5a66f8800 /server/sonar-web/src/main/js/apps
parentc41352b140f5c0d2a79aafecd47911a81e7d5b63 (diff)
downloadsonarqube-5c9215f07d350436eaf5b03639c13cd3efbbd483.tar.gz
sonarqube-5c9215f07d350436eaf5b03639c13cd3efbbd483.zip
SONAR-7809 fix bad rendering when there is no new coverage on the Overview page
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/Coverage.js15
1 files 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 ? (
<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')}
+ {formatMeasure(newCoverageValue, 'PERCENT')}
</span>
</DrilldownLink>
</div>
@@ -132,7 +137,7 @@ class Coverage extends React.Component {
<span>—</span>
);
- const label = newLinesToCover ? (
+ const label = newLinesToCoverValue != null ? (
<div className="overview-domain-measure-label">
{translate('overview.coverage_on')}
<br/>
@@ -142,7 +147,7 @@ class Coverage extends React.Component {
metric={newLinesToCover.metric.key}
period={leakPeriod.index}>
<span className="js-overview-main-new-coverage">
- {formatMeasure(getPeriodValue(newLinesToCover, leakPeriod.index), 'SHORT_INT')}
+ {formatMeasure(newLinesToCoverValue, 'SHORT_INT')}
</span>
</DrilldownLink>
{getMetricName('new_ncloc')}
@@ -156,7 +161,7 @@ class Coverage extends React.Component {
return (
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {value}
+ {formattedValue}
</div>
{label}
</div>