From 89ecd3d5cc8e1dc94d03e7ab9e9e8829472f73ab Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 16 Dec 2013 18:54:17 +0600 Subject: [PATCH] SONAR-4952 Provide a new PieChart widget to display a measure filter Show resource in the same window Open correct tab for files --- .../org/sonar/plugins/core/widgets/pie_chart.html.erb | 2 +- .../src/main/webapp/javascripts/widgets/pie-chart.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 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 84426eefbba..0b1ff0d0dcf 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 @@ -28,7 +28,7 @@ query = [ 'filter=<%= filterId %>', 'metrics=' + metrics.join(','), - 'fields=name', + 'fields=name,qualifier', 'pageSize=10', 'page=1', 'sort=metric:' + metrics[0], diff --git a/sonar-server/src/main/webapp/javascripts/widgets/pie-chart.js b/sonar-server/src/main/webapp/javascripts/widgets/pie-chart.js index a0b4a365c5b..b9081a5f688 100644 --- a/sonar-server/src/main/webapp/javascripts/widgets/pie-chart.js +++ b/sonar-server/src/main/webapp/javascripts/widgets/pie-chart.js @@ -311,7 +311,15 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; }) .on('mouseleave', leaveHandler) .on('click', function(d) { - window.open(widget.options().baseUrl + encodeURIComponent(d.data.key)); + switch (d.data.qualifier) { + case 'CLA': + case 'FIL': + window.location = widget.options().baseUrl + encodeURIComponent(d.data.key) + + '?metric=' + encodeURIComponent(widget.mainMetric); + break; + default: + window.location = widget.options().baseUrl + encodeURIComponent(d.data.key); + } }); }; -- 2.39.5