From b2745787f1cf99e238e4825cf8e01cc0b5394211 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Mon, 7 Apr 2014 17:50:36 +0200 Subject: [PATCH] SONAR-5140 Allow selection of RATING metrics for color in treemap widget --- .../java/org/sonar/plugins/core/widgets/TreemapWidget.java | 2 +- .../core/widgets/measures/MeasureFilterTreemapWidget.java | 2 +- .../main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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 45c4b43f7c3..5cd3a3aa680 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 @@ -26,7 +26,7 @@ import org.sonar.api.web.WidgetPropertyType; @WidgetProperties({ @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY), - @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, options = "type:PERCENT"), + @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.VIOLATIONS_DENSITY_KEY, options = "type:PERCENT,RATING"), @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55") }) public class TreemapWidget extends CoreWidget { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java index f14802d615d..4b0bbb545a8 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java @@ -29,7 +29,7 @@ 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,RATING"), @WidgetProperty(key = MeasureFilterTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55", description = "Height in percents of width"), @WidgetProperty(key = MeasureFilterListWidget.DISPLAY_FILTER_DESCRIPTION, type = WidgetPropertyType.BOOLEAN, defaultValue = "false") diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb index e1114603021..c42b6acbf0c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb @@ -1,5 +1,5 @@ <% -if metric && metric.worst_value && metric.best_value +if metric && metric.worst_value && metric.best_value && (metric.val_type != Metric::VALUE_TYPE_RATING) if metric.worst_value<%= metric.suffix -%> <% end -%> \ No newline at end of file +%> -- 2.39.5