]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3825 fix the existing treemap widget
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Dec 2012 21:56:36 +0000 (22:56 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 4 Dec 2012 21:56:36 +0000 (22:56 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb

index 79d44b52137d791e8e8a6ccc8787160ded437051..05774d5c705db3118a7fcfcb84543b7eedcab4a4 100644 (file)
@@ -23,7 +23,6 @@ import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.web.*;
 
 @WidgetProperties({
-  @WidgetProperty(key = "heightInPercents", type= WidgetPropertyType.INTEGER, defaultValue = "50", description = "Height in percents of width"),
   @WidgetProperty(key = "sizeMetric", type= WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, description = "Default metric for size"),
   @WidgetProperty(key = "colorMetric", type= WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, description = "Default metric for color")
 })
index ac08223ba83ff54687eace6615b3f714d6dae373..75f765a35b1050026d7415a69e920adaf96e90eb 100644 (file)
@@ -1,8 +1,12 @@
-<%= render :partial => 'treemap/treemap_container', :locals => {
-  :treemap_id => widget.id,
-  :size_metric => widget_properties['sizeMetric'],
-  :color_metric => widget_properties['colorMetric'],
-  :height_in_percents => widget_properties['heightInPercents'],
-  :context_type => 'resource',
-  :context_id => @resource.id
-  } -%>
\ No newline at end of file
+<%
+   size_metric = widget_properties['sizeMetric']
+   color_metric = widget_properties['colorMetric']
+
+   filter = MeasureFilter.new
+   filter.set_criteria_value('baseId', @resource.id)
+   filter.set_criteria_value('display', 'treemap')
+   filter.set_criteria_value('tmSize', size_metric.key) if size_metric
+   filter.set_criteria_value('tmColor', color_metric.key) if color_metric
+   filter.execute(self, :user => current_user)
+%>
+<%= render :partial => "measures/display_treemap", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %>