]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5004 Do not display bubble chart when all values for one axis are null/non...
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 4 Aug 2014 12:56:36 +0000 (14:56 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 4 Aug 2014 12:56:42 +0000 (14:56 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/bubbleChart.html.erb
server/sonar-web/src/main/js/widgets/bubble-chart.js

index ecd2bdb29d1c1f2bd67a079e628f7bc3353bfd60..d3dd9d7d3f17c7fca054c19f01a69451179159cb 100644 (file)
@@ -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]-->
-
index de34819fdd5a4003be09ee5785a50443d338892c..d4b3feb87a35ab4c0e5709f5a4bb8a3498d11c12 100644 (file)
@@ -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);