]> source.dussan.org Git - sonarqube.git/commitdiff
Show "no data" message in measure filters if there are no data
authorStas Vilchik <vilchiks@gmail.com>
Mon, 30 Dec 2013 06:26:07 +0000 (12:26 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 30 Dec 2013 06:26:07 +0000 (12:26 +0600)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_bubble_chart.html.erb
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_histogram.html.erb
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_pie_chart.html.erb
sonar-server/src/main/webapp/javascripts/widgets/widget.js

index 32f7eacb2aebf8fdd571f92f26bc64caa43531d4..143091538159bcb81202968bffdb8f20f8ad1ab3 100644 (file)
@@ -50,7 +50,8 @@
       .options({
         baseUrl: baseUrl + '/dashboard/index/',
         xLog: <%= xLog -%>,
-        yLog: <%= yLog -%>
+        yLog: <%= yLog -%>,
+        noData: '<%= message('no_data') -%>'
       })
       .render('#<%= containerId -%>');
 
index e8174ce1914358184af54ca91b3470f45902fa7f..465d76d9570de86474c45b0520d2883f00b8d2b1 100644 (file)
@@ -42,7 +42,8 @@
       .source(baseUrl + '/measures/search_filter?' + query)
       .metricsPriority(metrics)
       .options({
-        baseUrl: baseUrl + '/dashboard/index/'
+        baseUrl: baseUrl + '/dashboard/index/',
+        noData: '<%= message('no_data') -%>'
       })
       .render('#<%= containerId -%>');
 
index 27816a9722e1f6b5ea4fef51951b8c42c5428ebc..5f768d5a0450bfc3694bb0170bcea02dd4baf28d 100644 (file)
@@ -44,7 +44,8 @@
       .options({
         baseUrl: baseUrl + '/dashboard/index/',
         displayWorstBestValues: <%= displayWorstBestValues -%>,
-        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>'
+        maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
+        noData: '<%= message('no_data') -%>'
       })
       .render('#<%= containerId -%>');
 
index b872426f3e63b9fb235d4ae7c611472f724a5db0..cb8963bc9bd1558577b6d0bf25f833d5954db0f4 100644 (file)
@@ -46,7 +46,8 @@
       .metricsPriority(metrics)
       .height(<%= chartHeight %>)
       .options({
-        baseUrl: baseUrl + '/dashboard/index/'
+        baseUrl: baseUrl + '/dashboard/index/',
+        noData: '<%= message('no_data') -%>'
       })
       .render('#<%= containerId -%>');
 
index 497c90f8a79eef665bd5f9dc08daec4322bf311a..4c7f3a6a06e6c02640e57335c85eb09d3a32d68c 100644 (file)
@@ -42,19 +42,23 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets;
 
     d3.json(this.source(), function(error, response) {
       if (response && !error) {
-        that.widget = new SonarWidgets[that.type()]();
-        that.widget
-            .metrics(response.metrics)
-            .metricsPriority(that.metricsPriority())
-            .components(response.components)
-            .options(that.options());
-        if (typeof that.widget.maxResultsReached === 'function') {
-          that.widget.maxResultsReached(response.paging.pages > 1);
+        if (response.components.length > 0) {
+          that.widget = new SonarWidgets[that.type()]();
+          that.widget
+              .metrics(response.metrics)
+              .metricsPriority(that.metricsPriority())
+              .components(response.components)
+              .options(that.options());
+          if (typeof that.widget.maxResultsReached === 'function') {
+            that.widget.maxResultsReached(response.paging.pages > 1);
+          }
+          if (that.height()) {
+            that.widget.height(that.height());
+          }
+          that.widget.render(container);
+        } else {
+          d3.select(container).html(that.options().noData);
         }
-        if (that.height()) {
-          that.widget.height(that.height());
-        }
-        that.widget.render(container);
       }
     });
   };