diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2013-12-11 17:17:16 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2013-12-11 17:17:26 +0600 |
commit | 7ef81a9c53df3db31b60981649946705ad1d1daa (patch) | |
tree | 6166c4804444930b99e05be92abbe7774b9f79d7 /plugins/sonar-core-plugin | |
parent | a1f2499b07cab3fa7bbe09f1f9139b2bb16a8fa2 (diff) | |
download | sonarqube-7ef81a9c53df3db31b60981649946705ad1d1daa.tar.gz sonarqube-7ef81a9c53df3db31b60981649946705ad1d1daa.zip |
SONAR-4952 Provide a new PieChart widget to display a measure filter
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb index b83b65e351f..c0f2ae42206 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/pie_chart.html.erb @@ -1,11 +1,53 @@ +<% + containerId = 'pie-chart-widget' + widget.id.to_s + chartHeight = widget_properties["chartHeight"] + chartTitle = widget_properties["chartTitle"] + filterId = widget_properties["filter"].to_i +%> + +<div class="pie-chart-widget" id="<%= containerId %>"> + <!--[if lte IE 8 ]> <h3><%= message('widget.unsupported_browser_warning') -%></h3> <![endif]--> + + <!--[if (gte IE 9)|!(IE)]><!--> + <% if chartTitle %> + <h3 style="text-align: center;"><%= h(chartTitle) -%></h3> + <% end %> + <!--<![endif]--> +</div> + +<!--[if (gte IE 9)|!(IE)]><!--> <script> - var filterId = <%= widget_properties['filter'].to_i %>; - var chartTitle = <%= widget_properties['chartTitle'].to_s %>; - var chartHeight = <%= widget_properties['chartHeight'].to_s %>; - var mainMetric = <%= widget_properties['mainMetric'].to_s %>; - var extraMetric1 = <%= widget_properties['extraMetric1'].to_s %>; - var extraMetric2 = <%= widget_properties['extraMetric2'].to_s %>; - var extraMetric3 = <%= widget_properties['extraMetric3'].to_s %>; + (function () { + var metrics = [ + '<%= widget_properties["mainMetric"].name %>', + '<%= widget_properties["extraMetric1"].name %>', + '<%= widget_properties["extraMetric2"].name %>', + '<%= widget_properties["extraMetric3"].name %>' + ], + query = [ + 'filter=<%= filterId %>', + 'metrics=' + metrics.join(','), + 'fields=name', + 'pageSize=9', + 'page=1', + 'sort=metric:' + metrics[0], + 'asc=false' + ].join('&'); + widget = new SonarWidgets.Widget(); + + widget + .type('PieChart') + .source(baseUrl + '/measures/search_filter?' + query) + .metricsPriority(metrics) + .height(<%= chartHeight %>) + .render('#<%= containerId %>'); + + autoResize(500, function() { + widget.update('#<%= containerId %>'); + }); + })(); </script> +<!--<![endif]--> + |