From: Simon Brandhof Date: Tue, 4 Dec 2012 21:56:36 +0000 (+0100) Subject: SONAR-3825 fix the existing treemap widget X-Git-Tag: 3.4~163 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a95eb1f87bfb7505d46b3d49f33d5b9a7eed3262;p=sonarqube.git SONAR-3825 fix the existing treemap widget --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java index 79d44b52137..05774d5c705 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java @@ -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") }) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb index ac08223ba83..75f765a35b1 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb @@ -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} %>