aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-04-18 16:26:43 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-04-18 16:40:03 +0200
commit517d0c5be5d6f2d2146760b58edd7dc4ceec6bb6 (patch)
treedbc2f787413c56e252aceff422b21071709fec5f
parent0df407735c94ca3d6e5f5b4456d8d8155577e7a2 (diff)
downloadsonarqube-517d0c5be5d6f2d2146760b58edd7dc4ceec6bb6.tar.gz
sonarqube-517d0c5be5d6f2d2146760b58edd7dc4ceec6bb6.zip
SONAR-6203 Manual Metrics of type Level and String can't be displayed using 'Custom Measures' widget
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb10
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb17
2 files changed, 18 insertions, 9 deletions
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb
index c817403bc8c..74134f1ac50 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb
+++ b/server/sonar-server/src/main/resources/org/sonar/server/dashboard/widget/custom_measures.html.erb
@@ -15,17 +15,17 @@
-%>
<div class="widget-span widget-span-3">
<div class="widget-measure-container">
- <p class="widget-measure widget-measure-main">
- <span class="widget-label"><%= measure.metric.short_name -%></span>
- <span class="nowrap">
+ <div class="widget-measure widget-measure-main">
+ <div class="widget-label"><%= measure.metric.short_name -%></div>
+ <div class="text-ellipsis">
<% if measure.value.nil? && measure.text_value.nil? -%>
<%= format_measure(measure, :url => url_for_drilldown(measure, :period => period), :period => period) -%>
<% else %>
<%= format_measure(measure, :url => url_for_drilldown(measure)) -%>
<%= format_variation(measure) if dashboard_configuration.selected_period? -%>
<% end -%>
- </span>
- </p>
+ </div>
+ </div>
</div>
</div>
<%
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
index 982956acd76..115ce1fbf89 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
@@ -277,9 +277,18 @@ module ApplicationHelper
if options[:period]
html=m.format_numeric_value(m.variation(options[:period].to_i))
elsif m.metric.val_type==Metric::VALUE_TYPE_LEVEL
- html="<i class=\"icon-alert-#{m.alert_status.downcase}\"></i>" unless m.alert_status.blank?
+ if m.alert_status.blank?
+ html = m.formatted_value
+ else
+ html = "<i class=\"icon-alert-#{m.alert_status.downcase}\"></i>"
+ end
+ elsif m.metric.val_type == Metric::VALUE_TYPE_RATING
+ html = m.formatted_value
+ if html.ord < 65 || html.ord > 69
+ html = (Integer(html) + 64).chr
+ end
else
- html=m.formatted_value
+ html = m.formatted_value
end
alert_class=''
@@ -287,8 +296,8 @@ module ApplicationHelper
if !(m.alert_status.blank?)
alert_class="class='alert_#{m.alert_status}'" unless m.metric.val_type==Metric::VALUE_TYPE_LEVEL
link_rel=h(m.alert_text)
- elsif m.metric.val_type==Metric::VALUE_TYPE_RATING && m.color
- alert_class="class='rating rating-" + m.formatted_value + "'"
+ elsif m.metric.val_type==Metric::VALUE_TYPE_RATING
+ alert_class="class='rating rating-" + html + "'"
end
span_id=''