From f47d95888bd7694b7c29021144f246d16bd9e5f2 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 6 Dec 2012 17:19:47 +0100 Subject: [PATCH] SONAR-1352 Display new metrics in alert quality profile page --- .../webapp/WEB-INF/app/helpers/alerts_helper.rb | 13 ++++++++++++- .../webapp/WEB-INF/app/views/alerts/_edit.html.erb | 5 +---- .../webapp/WEB-INF/app/views/alerts/_new.html.erb | 9 ++------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/alerts_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/alerts_helper.rb index 247d46f8ce2..fa338a0617b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/alerts_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/alerts_helper.rb @@ -88,7 +88,18 @@ module AlertsHelper end end - def period_select_options(alert, index) + def period_select_options(alert) + if alert.metric + select = '' + select << period_select_option(alert, nil) if !alert.metric.name.start_with?("new_") + for index in 1..3 do + select << period_select_option(alert, index) + end + select + end + end + + def period_select_option(alert, index) if index selected = (alert.period == index ? 'selected' : '') "" diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_edit.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_edit.html.erb index c539bdc0c8f..7accf673e72 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_edit.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_edit.html.erb @@ -6,10 +6,7 @@ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_new.html.erb index 82af723cb1a..34c80e49e88 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_new.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/_new.html.erb @@ -16,7 +16,7 @@ <% Metric.domains.each do |domain| %> <%# 'new_' metrics excluded due to SONAR-2396 %> - <% Metric.by_domain(domain).select{ |m| m.alertable? && !m.name.start_with?("new_") }.each do |metric| %> + <% Metric.by_domain(domain).select{ |m| m.alertable? }.each do |metric| %> <% end %> @@ -26,12 +26,7 @@ -- 2.39.5