diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-08-04 14:56:36 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-08-04 14:56:42 +0200 |
commit | 62aa23863d60b66aea4e027a1d8899cb10142560 (patch) | |
tree | 76c4eaf5e1355e001613c379f43c32464a77a451 | |
parent | 324e7ea6fb166942a519dfac10647eae5af803cd (diff) | |
download | sonarqube-62aa23863d60b66aea4e027a1d8899cb10142560.tar.gz sonarqube-62aa23863d60b66aea4e027a1d8899cb10142560.zip |
SONAR-5004 Do not display bubble chart when all values for one axis are null/non available
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/widgets/bubble-chart.js | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb index ecd2bdb29d1..d3dd9d7d3f1 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb @@ -74,7 +74,9 @@ .options({ baseUrl: baseUrl + '/dashboard/index/', xLog: <%= xLog -%>, - yLog: <%= yLog -%> + yLog: <%= yLog -%>, + noData: '<%= message('no_data') -%>', + noMainMetric: '<%= message('widget.measure_filter.no_main_metric') -%>' }) .render('#<%= containerId -%>'); @@ -84,4 +86,3 @@ })(); </script> <!--<![endif]--> - diff --git a/server/sonar-web/src/main/js/widgets/bubble-chart.js b/server/sonar-web/src/main/js/widgets/bubble-chart.js index de34819fdd5..d4b3feb87a3 100644 --- a/server/sonar-web/src/main/js/widgets/bubble-chart.js +++ b/server/sonar-web/src/main/js/widgets/bubble-chart.js @@ -70,9 +70,15 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; container = d3.select(container); - var validData = this.components().reduce(function(p, c) { - return p && !!c.measures[widget.metricsPriority()[0]] && !!c.measures[widget.metricsPriority()[1]]; - }, true); + var noInvalidEntry = true, + atLeastOneValueOnX = false, + atLeastOneValueOnY = false; + this.components().forEach(function validateComponent(component) { + noInvalidEntry &= (!!component.measures[widget.metricsPriority()[0]] && !!component.measures[widget.metricsPriority()[1]]); + atLeastOneValueOnX |= (component.measures[widget.metricsPriority()[0]] || {}).fval != '-'; + atLeastOneValueOnY |= (component.measures[widget.metricsPriority()[1]] || {}).fval != '-'; + }); + var validData = !!noInvalidEntry && !!atLeastOneValueOnX && !!atLeastOneValueOnY; if (!validData) { container.text(this.options().noMainMetric); |