From: Julien Lancelot Date: Wed, 13 Mar 2013 13:13:37 +0000 (+0100) Subject: SONAR-4170 Revert feature to search for removed rules X-Git-Tag: 3.6~891^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=130636c1960f68e9d7e23d83b5d9461bb22390da;p=sonarqube.git SONAR-4170 Revert feature to search for removed rules --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index c823e30bc8a..5738fb5dce2 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -18,7 +18,6 @@ assignee=Assignee author=Author back=Back backup_verb=Backup -beta=Beta blocker=Blocker bold=Bold build_date=Build date @@ -47,7 +46,6 @@ date=Date days=Days default=Default delete=Delete -deprecated=Deprecated descending=Descending description=Description directories=Directories @@ -103,7 +101,6 @@ projects=Projects raw=Raw refresh=Refresh remove=Remove -removed=Removed rename=Rename reset_verb=Reset result=Result @@ -1452,14 +1449,17 @@ rules_configuration.rule_overriding_from_profile_x=Rule overrides parent definit rules_configuration.original_value=Original value rules_configuration.original_severity=Original severity rules_configuration.repository=Repository -rules_configuration.status_filters=Status filters -rules_configuration.available_rules=Available rules +rules_configuration.status_filters=Status rules_configuration.sort_by=Sort by: rules_configuration.rule_name=Rule name rules_configuration.creation_date=Creation date rules_configuration.removal_date=Removal date rules_configuration.available_since=Available since rules_configuration.removed_since=Removed since +rules_configuration.status.beta=Beta +rules_configuration.status.deprecated=Deprecated +rules_configuration.status.ready=Ready +rules_configuration.status.removed=Removed #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb index c1466dac750..4b49fa192a2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb @@ -50,10 +50,10 @@ class RulesConfigurationController < ApplicationController @select_activation = [[message('any'), 'any'], [message('active'), STATUS_ACTIVE], [message('inactive'), STATUS_INACTIVE]] @select_inheritance = [[message('any'), 'any'], [message('rules_configuration.not_inherited'), 'NOT'], [message('rules_configuration.inherited'), 'INHERITED'], [message('rules_configuration.overrides'), 'OVERRIDES']] - @select_status = ANY_SELECTION + [[message('beta'), Rule::STATUS_BETA], [message('deprecated'), Rule::STATUS_DEPRECATED], [message('removed'), Rule::STATUS_REMOVED]] - @select_sort_by = [[message('rules_configuration.rule_name'), Rule::SORT_BY_RULE_NAME]] - @select_sort_by << [message('rules_configuration.creation_date'), Rule::SORT_BY_CREATION_DATE] if !status_include_removed? - @select_sort_by << [message('rules_configuration.removal_date'), Rule::SORT_BY_REMOVAL_DATE] if status_include_removed? + @select_status = ANY_SELECTION + [[message('rules_configuration.status.beta'), Rule::STATUS_BETA], + [message('rules_configuration.status.deprecated'), Rule::STATUS_DEPRECATED], + [message('rules_configuration.status.ready'), Rule::STATUS_READY]] + @select_sort_by = [[message('rules_configuration.rule_name'), Rule::SORT_BY_RULE_NAME], [message('rules_configuration.creation_date'), Rule::SORT_BY_CREATION_DATE]] @rules = Rule.search(java_facade, { :profile => @profile, :activation => @activation, :priorities => @priorities, :inheritance => @inheritance, :status => @status, @@ -387,10 +387,7 @@ class RulesConfigurationController < ApplicationController @activation = params[:rule_activation] || STATUS_ACTIVE @inheritance = params[:inheritance] || 'any' @status = params[:status] - @sort_by = !params[:sort_by].blank? ? params[:sort_by] : nil - # Force sort by removal date when status contains REMOVED - @sort_by ||= Rule::SORT_BY_REMOVAL_DATE if status_include_removed? - @sort_by ||= Rule::SORT_BY_RULE_NAME + @sort_by = !params[:sort_by].blank? ? params[:sort_by] : Rule::SORT_BY_RULE_NAME @searchtext = params[:searchtext] end @@ -401,8 +398,4 @@ class RulesConfigurationController < ApplicationController array end - def status_include_removed? - !params[:status].blank? and params[:status].include?(Rule::STATUS_REMOVED) - end - end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index 9dc46f26683..8fcb36e3596 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -28,7 +28,6 @@ class Rule < ActiveRecord::Base SORT_BY_RULE_NAME = "SORT_BY_RULE_NAME" SORT_BY_CREATION_DATE = "SORT_BY_CREATION_DATE" - SORT_BY_REMOVAL_DATE = "SORT_BY_REMOVAL_DATE" validates_presence_of :name, :description, :plugin_name validates_presence_of :plugin_rule_key, :if => 'name.present?' @@ -370,8 +369,6 @@ class Rule < ActiveRecord::Base case sort_by when SORT_BY_CREATION_DATE rules = rules.sort_by {|rule| rule.created_at}.reverse - when SORT_BY_REMOVAL_DATE - rules = rules.sort {|rule1, rule2| (rule1.updated_at && rule2.updated_at) ? rule1.updated_at <=> rule2.updated_at : 0} else rules = rules.sort end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb index 8eb570079e6..eb0b3d9ad16 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb @@ -37,11 +37,9 @@ <% if !rule.ready? %>
<% if rule.beta? %> -
<%= message('beta') %>
+
<%= message('rules_configuration.status.beta') %>
<% elsif rule.deprecated? %> -
<%= message('deprecated') %>
- <% elsif rule.removed? %> -
<%= message('removed') %>
+
<%= message('rules_configuration.status.deprecated') %>
<% end %>
<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb index 1d0ff51c36d..5b5b43bd87f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb @@ -40,7 +40,6 @@ } function submitSearch() { - $j('#sort_by').val(""); $j("#rules-search-form").submit(); } @@ -89,7 +88,7 @@ <%= dropdown_tag "status", options_for_select(@select_status, @status), { :show_search_box => true, :width => '120px', - :placeholder => message('rules_configuration.available_rules') + :placeholder => message('any') }, {:id => 'search_status', :multiple => true} -%> <% if @profile.inherited? %> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index 32c9f39a2eb..e7a73d49557 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -2417,8 +2417,4 @@ textarea.width100 { .rule-status .status-deprecated { color: #906947; -} - -.rule-status .status-removed { - color: #904553; -} +} \ No newline at end of file