From: Stas Vilchik Date: Wed, 2 Dec 2015 14:01:20 +0000 (+0100) Subject: improve display of overview pages when no coverage or duplications details available X-Git-Tag: 5.3-RC1~101 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=78e12d6af59b774ee6f3fa16e38aa35caab159d7;p=sonarqube.git improve display of overview pages when no coverage or duplications details available --- diff --git a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js index d79f7846f51..f9aabc06ec6 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js @@ -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({ ; }, + renderEmpty() { + return
+
+

{window.t('overview.no_coverage')}

+
+
; + }, + renderLegend () { return }, @@ -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
diff --git a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js index fe4cae3afac..785ca31ae65 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js @@ -64,6 +64,14 @@ export const DuplicationsMain = React.createClass({
; }, + renderEmpty() { + return
+
+

{window.t('overview.no_duplications')}

+
+
; + }, + renderLegend () { return }, @@ -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
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index cbacec30717..9a906f10ff7 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -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. + #------------------------------------------------------------------------------ #