From: David Gageot Date: Mon, 23 Jul 2012 14:24:33 +0000 (+0200) Subject: Improve slow profile page X-Git-Tag: 3.2~15^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=672f34433e52f15d851dff4978878887e69c2969;p=sonarqube.git Improve slow profile page --- 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 e2a4843aece..d9b6b28a323 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 @@ -342,7 +342,7 @@ class RulesConfigurationController < ApplicationController note.text = params[:note] note.user_login = current_user.login note.save! - render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => true } + render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => true, :profile => active_rule.rules_profile } end @@ -350,7 +350,7 @@ class RulesConfigurationController < ApplicationController active_rule = ActiveRule.find(params[:active_rule_id]) active_rule.note.destroy if active_rule.note active_rule.note = nil - render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => true } + render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => true, :profile => active_rule.rules_profile } end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb index 0f0f3d35c73..93957d00f07 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb @@ -34,6 +34,12 @@ class RulesParameter < ActiveRecord::Base end def description + description(rule) + end + + # We provide the rule as parameter to avoid reloading this rule_parameter's rule. + # This hack would be useless if we could use :inverse_of on :rule + def description(rule) @l10n_description ||= begin result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getRuleParamDescription(I18n.locale, rule.repository_key, rule.plugin_rule_key, name()) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_active_rule_note.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_active_rule_note.html.erb index 19f671eb968..f961277b52b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_active_rule_note.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_active_rule_note.html.erb @@ -1,4 +1,4 @@ -<% #locals = active_rule, is_admin +<% #locals = active_rule, is_admin, profile note = active_rule.note active_note_detail_div_id = "and_" + active_rule.id.to_s add_active_note_button_id = "aanb_" + active_rule.id.to_s @@ -28,7 +28,7 @@

<%= note.html_text -%>

- <% elsif is_admin && !active_rule.rules_profile.provided? %> + <% elsif is_admin && !profile.provided? %> <%= message('rules_configuration.add_note') -%> <% 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 99b342d9d0d..c89b7975006 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 @@ -85,7 +85,7 @@ <% if active_rule %>
- <%= render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => is_admin} %> + <%= render :partial => 'active_rule_note', :locals => {:active_rule => active_rule, :is_admin => is_admin, :profile => profile} %>
<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb index 5d2565854b8..e18c9baf4c2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb @@ -40,7 +40,7 @@ <% end %> <% end %> -
<%= h(parameter.description || "") -%> <%= ('(' + readable_type(parameter.param_type) + ')') if !readable_type(parameter.param_type).empty? -%>
+
<%= h(parameter.description(rule) || "") -%> <%= ('(' + readable_type(parameter.param_type) + ')') if !readable_type(parameter.param_type).empty? -%>