aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-05-07 09:56:10 +0200
committerDavid Gageot <david@gageot.net>2012-05-07 16:29:40 +0200
commitd0da13b5b9b00ecd5ac756d11e8ebb3d4bebb22c (patch)
treeb0346389784112ea2651253af431748f6d1d659d /sonar-server
parenta725703e09e367e8dc79e6ba2017bf3c00775abe (diff)
downloadsonarqube-d0da13b5b9b00ecd5ac756d11e8ebb3d4bebb22c.tar.gz
sonarqube-d0da13b5b9b00ecd5ac756d11e8ebb3d4bebb22c.zip
Filter Widget first try
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb17
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_widget.html.erb2
2 files changed, 17 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
index e4e23281cde..4eb23b5b17f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
@@ -1,3 +1,18 @@
+<%
+ def treemap_metrics(filter)
+ metrics=filter.measure_columns.map{|col| col.metric}
+ size_metric=(metrics.size>=1 ? metrics[0] : Metric.by_key('ncloc'))
+ color_metric=nil
+ if metrics.size>=2
+ color_metric=metrics[1]
+ end
+ if color_metric.nil? || !color_metric.treemap_color?
+ color_metric=Metric.by_key('violations_density')
+ end
+ [size_metric, color_metric]
+ end
+%>
+
<% if @filter.period? %>
<%= message('filters.treemap_not_supported_for_period_selection') -%>
@@ -13,4 +28,4 @@
:context_type => 'filter',
:context_id => @filter.id
} -%>
-<% end %> \ No newline at end of file
+<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_widget.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_widget.html.erb
index 62cd8c0d34c..2022ed58ee3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_widget.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_widget.html.erb
@@ -3,7 +3,7 @@
['A','B','C','D']
end
- @filter=::Filter.find(1)
+ @filter=::Filter.find(2)
@filter_context=Filters.execute(@filter, self, params)
%>