aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-04-07 17:50:36 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-04-07 17:52:00 +0200
commitb2745787f1cf99e238e4825cf8e01cc0b5394211 (patch)
tree1c51b6eabec324cc3c1b851668146650611c4ac4
parent92c9ac2e355ff34991ed12bdd4571d399e24287e (diff)
downloadsonarqube-b2745787f1cf99e238e4825cf8e01cc0b5394211.tar.gz
sonarqube-b2745787f1cf99e238e4825cf8e01cc0b5394211.zip
SONAR-5140 Allow selection of RATING metrics for color in treemap widget
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TreemapWidget.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterTreemapWidget.java2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb4
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.best_value
min=metric.worst_value
max=metric.best_value
@@ -16,4 +16,4 @@ if metric && metric.worst_value && metric.best_value
-%><%= metric.suffix -%>
<%
end
-%> \ No newline at end of file
+%>