diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-18 10:38:02 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-18 10:38:22 +0100 |
commit | b8189d2d8c4cf3432db51392ff0589552105fc1c (patch) | |
tree | c1e931c174622c3313f972003bf330969a249760 /plugins | |
parent | bdab023b4702e193017ed6f3a8365efc7e779f8b (diff) | |
download | sonarqube-b8189d2d8c4cf3432db51392ff0589552105fc1c.tar.gz sonarqube-b8189d2d8c4cf3432db51392ff0589552105fc1c.zip |
Fix ability to configure height of treemaps
Diffstat (limited to 'plugins')
4 files changed, 13 insertions, 7 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java index dc0256edd4b..267b5b48573 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/MeasureFilterTreemapWidget.java @@ -32,12 +32,14 @@ import static org.sonar.api.web.WidgetScope.GLOBAL; @WidgetProperties({ @WidgetProperty(key = MeasureFilterTreemapWidget.FILTER_PROPERTY, type = WidgetPropertyType.FILTER, optional = false), @WidgetProperty(key = MeasureFilterTreemapWidget.SIZE_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true), - @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, options = "type:PERCENT") + @WidgetProperty(key = MeasureFilterTreemapWidget.COLOR_METRIC_PROPERTY, type = WidgetPropertyType.METRIC, optional = true, options = "type:PERCENT"), + @WidgetProperty(key = MeasureFilterTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55", description = "Height in percents of width") }) public class MeasureFilterTreemapWidget extends CoreWidget { public static final String FILTER_PROPERTY = "filter"; public static final String SIZE_METRIC_PROPERTY = "sizeMetric"; public static final String COLOR_METRIC_PROPERTY = "colorMetric"; + public static final String HEIGHT_PERCENTS_PROPERTY = "heightInPercents"; public static final String ID = "measure_filter_treemap"; public MeasureFilterTreemapWidget() { 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 c1beb2258df..8ac21eaa09d 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 @@ -25,8 +25,9 @@ import org.sonar.api.web.WidgetProperty; import org.sonar.api.web.WidgetPropertyType; @WidgetProperties({ - @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") + @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, description = "Metric used for square size"), + @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, description = "Metric used for square color"), + @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55", description = "Height in percents of width") }) public class TreemapWidget extends CoreWidget { public TreemapWidget() { diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb index 53c2fae8967..259ed662c38 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb @@ -15,6 +15,8 @@ filter.set_criteria_value(:tmColor, color_metric.key) url_options[:tmColor]=color_metric.key end + filter.set_criteria_value(:tmHeight, widget_properties['heightInPercents']) + if !filter.require_authentication? || logged_in? filter.execute(self, :user => current_user) 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 75f765a35b1..68aafa104e1 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 @@ -3,10 +3,11 @@ 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.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.set_criteria_value(:tmHeight, widget_properties['heightInPercents']) filter.execute(self, :user => current_user) %> <%= render :partial => "measures/display_treemap", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %> |