]> source.dussan.org Git - sonarqube.git/commitdiff
improve display of overview pages when no coverage or duplications details available
authorStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 14:01:20 +0000 (15:01 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 14:25:48 +0000 (15:25 +0100)
server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js
server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index d79f7846f51b078382f20b41b69ed78bc17413db..f9aabc06ec6033794916ff05752ba072cfd09098 100644 (file)
@@ -36,7 +36,7 @@ export const CoverageMain = React.createClass({
         ready: true,
         measures,
         leak,
-        coverageMetricPrefix: this.getCoverageMetricPrefix(measures),
+        coverageMetricPrefix: this.getCoverageMetricPrefix(measures)
       });
     });
   },
@@ -73,6 +73,14 @@ export const CoverageMain = React.createClass({
     </div>;
   },
 
+  renderEmpty() {
+    return <div className="overview-detailed-page">
+      <div className="page">
+        <p>{window.t('overview.no_coverage')}</p>
+      </div>
+    </div>;
+  },
+
   renderLegend () {
     return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
   },
@@ -89,6 +97,10 @@ export const CoverageMain = React.createClass({
     let coverageMetric = this.state.coverageMetricPrefix + 'coverage',
         uncoveredLinesMetric = this.state.coverageMetricPrefix + 'uncovered_lines';
 
+    if (this.state.measures[coverageMetric] == null) {
+      return this.renderEmpty();
+    }
+
     return <div className="overview-detailed-page">
       <div className="overview-cards-list">
         <div className="overview-card overview-card-fixed-width">
index fe4cae3afac047ea70bb98dc61cf49844b639d87..785ca31ae65bffd6d91668c349e0934d579a5fca 100644 (file)
@@ -64,6 +64,14 @@ export const DuplicationsMain = React.createClass({
     </div>;
   },
 
+  renderEmpty() {
+    return <div className="overview-detailed-page">
+      <div className="page">
+        <p>{window.t('overview.no_duplications')}</p>
+      </div>
+    </div>;
+  },
+
   renderLegend () {
     return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
   },
@@ -81,9 +89,15 @@ export const DuplicationsMain = React.createClass({
     if (!this.state.ready) {
       return this.renderLoading();
     }
+
+    if (this.state.measures['duplicated_lines_density'] == null) {
+      return this.renderEmpty();
+    }
+
     let treemapScale = d3.scale.linear()
         .domain([0, 25, 50, 75, 100])
         .range(CHART_COLORS_RANGE_PERCENT);
+
     return <div className="overview-detailed-page">
       <div className="overview-cards-list">
         <div className="overview-card overview-card-fixed-width">
index cbacec307173a1daadf00d9ce6e683a6d60a2c85..9a906f10ff7e04e43be726ce0a8b669d18fd0a68 100644 (file)
@@ -3150,6 +3150,9 @@ overview.chart.history=History
 overview.complexity_tooltip.function={0} functions have complexity around {1}
 overview.complexity_tooltip.file={0} files have complexity around {1}
 
+overview.no_coverage=This component does not have coverage details.
+overview.no_duplications=This component does not have details details.
+
 
 #------------------------------------------------------------------------------
 #