.source(baseUrl + '/measures/search_filter?' + query)
.metricsPriority(metrics)
.options({
- baseUrl: baseUrl + '/dashboard/index/'
+ baseUrl: baseUrl + '/dashboard/index/',
+ noData: '<%= message('no_data') -%>'
})
.render('#<%= containerId -%>');
.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 -%>');
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);
}
});
};