From: Stas Vilchik Date: Fri, 6 Feb 2015 15:58:49 +0000 (+0100) Subject: SONAR-5950 ignore issue measures X-Git-Tag: 5.1-RC1~369 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6dc37c6e24e0d85e723efbf5aa761fcba0498a46;p=sonarqube.git SONAR-5950 ignore issue measures --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb index bd8cdd9482e..4a4ea3e3341 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/alerts.html.erb @@ -47,7 +47,8 @@ error_measure = ProjectMeasure.new :metric => condition_metric, :value => error_value is_difference_measure = condition_metric.name.start_with?('new_') - is_not_difference_measure_with_period = !is_difference_measure && !period.blank? + is_issue_measure = get_issue_metrics.include? condition_metric.name + is_not_difference_measure_with_period = !is_difference_measure && !period.blank? && !is_issue_measure unless level == 'OK' && !widget_properties['show_ok'] 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 3ec5c860636..cebf88db8fe 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 @@ -87,17 +87,17 @@ module ApplicationHelper # shortcut for the method is_admin?() without parameters. Result is kept in cache. def administrator? @is_administrator ||= - begin - is_admin? - end + begin + is_admin? + end end # shortcut for the method has_role?(:profileadmin). Result is kept in cache. def profiles_administrator? @is_profileadmin ||= - begin - has_role?(:profileadmin) - end + begin + has_role?(:profileadmin) + end end def qualifier_icon(object) @@ -195,10 +195,7 @@ module ApplicationHelper metric_key = metric_or_measure end - issues_metrics = ['violations', - 'blocker_violations', 'critical_violations', 'major_violations', 'minor_violations', 'info_violations', - 'new_blocker_violations', 'new_critical_violations', 'new_major_violations', 'new_minor_violations', 'new_info_violations', - 'open_issues', 'reopened_issues', 'confirmed_issues', 'false_positive_issues'] + issues_metrics = get_issue_metrics if issues_metrics.include? metric_key resource = options[:resource]||@resource.key @@ -321,7 +318,6 @@ module ApplicationHelper end - # # # link to the current page with the given resource. If file, then open a popup to display resource viewers. @@ -618,11 +614,11 @@ module ApplicationHelper min_length=options[:min_length] js_options={ - 'minimumInputLength' => min_length, - 'allowClear' => options[:allow_clear]||false, - 'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}", - 'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}", - 'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}" + 'minimumInputLength' => min_length, + 'allowClear' => options[:allow_clear]||false, + 'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}", + 'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}", + 'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}" } js_options['placeholder']= "'#{options[:placeholder]}'" if options.has_key?(:placeholder) js_options['width']= "'#{width}'" if width @@ -786,8 +782,8 @@ module ApplicationHelper width=options[:width]||'250px' html_id=options[:html_id]||name js_options={ - 'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}", - 'width' => "'#{width}'" + 'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}", + 'width' => "'#{width}'" } select_tag_prompt=nil @@ -849,8 +845,8 @@ module ApplicationHelper minimumResultsForSearch=show_search_box ? 0 : option_tags.size + 1 js_options={ - 'minimumResultsForSearch' => minimumResultsForSearch, - 'allowClear' => options[:allow_clear]||false, + 'minimumResultsForSearch' => minimumResultsForSearch, + 'allowClear' => options[:allow_clear]||false, } js_options['placeholder']= options.has_key?(:placeholder) ? "'#{options[:placeholder]}'" : "''" js_options['width']= "'#{width}'" if width @@ -1063,4 +1059,12 @@ module ApplicationHelper end end + + def get_issue_metrics + ['violations', + 'blocker_violations', 'critical_violations', 'major_violations', 'minor_violations', 'info_violations', + 'new_blocker_violations', 'new_critical_violations', 'new_major_violations', 'new_minor_violations', 'new_info_violations', + 'open_issues', 'reopened_issues', 'confirmed_issues', 'false_positive_issues'] + end + end