diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-07-04 15:57:22 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-07-04 16:03:00 +0200 |
commit | d0a93912bd4095543e46ed698750934e63e6b67b (patch) | |
tree | 12b0ec2a3ccd9c02a72a5da56a22d6e0eac91243 | |
parent | 68e2d32eab695583d34826b3ba11e294acdbc938 (diff) | |
download | sonarqube-d0a93912bd4095543e46ed698750934e63e6b67b.tar.gz sonarqube-d0a93912bd4095543e46ed698750934e63e6b67b.zip |
SONAR-1608 Improve error messages
4 files changed, 24 insertions, 10 deletions
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index e06725d0d83..fdec6a9f57f 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -981,6 +981,8 @@ update_key.cant_update_because_duplicate_keys=The replacement of "{0}" by "{1}" update_key.keys_will_be_updated_as_follows=The resources will be updated as follows (updated keys in bold): update_key.duplicate_key=Duplicate key update_key.bulk_update_confirmation_page=Do you really want to perform the bulk update on project keys? +update_key.bulk_update_impossible=Bulk update can not be performed +update_key.no_key_to_update=No key contains the string to replace ("{0}"). #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb index ba9e1eb1059..3e4643915f7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb @@ -106,10 +106,16 @@ class ProjectController < ApplicationController redirect_to :action => 'key', :id => @project.id else @key_check_results = java_facade.checkModuleKeysBeforeRenaming(@project.id, @old_prefix, @new_prefix) - @can_update = true + @can_update = false + @duplicate_key_found = false @key_check_results.each do |key, value| - @can_update = false if value=="#duplicate_key#" + if value=="#duplicate_key#" + @duplicate_key_found = true + else + @can_update = true + end end + @can_update = false if @duplicate_key_found end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/key.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/key.html.erb index 1dd74cc78c3..fdc99f36876 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/key.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/key.html.erb @@ -25,7 +25,7 @@ <%= message('update_key.current_key_for_project_x_is_x', :params => [@project.name, @project.key]) -%> </p> <br/> - <% form_tag( {:action => 'prepare_key_bulk_update', :id => @project.id }) do -%> + <% form_tag( {:action => 'prepare_key_bulk_update', :id => @project.id }, :onsubmit => "update_launched();$('loading_bulk_update').show();") do -%> <table> <tr> <td style="padding-right: 20px"><%= message('update_key.replace') -%>:</td> @@ -40,8 +40,7 @@ <tr> <td></td> <td style="padding-top: 5px"> - <%= submit_tag message('update_key.rename'), :id => 'bulk_update_button', :class => 'action', - :onclick => "update_launched();$('loading_bulk_update').show();" %> + <%= submit_tag message('update_key.rename'), :id => 'bulk_update_button', :class => 'action' -%> <span class="loading" id="loading_bulk_update" style="display: none; padding: 3px 10px;"></span> </td> <td></td> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/prepare_key_bulk_update.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/prepare_key_bulk_update.html.erb index bbdb6d43631..cd7d6d45e84 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/prepare_key_bulk_update.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/prepare_key_bulk_update.html.erb @@ -12,10 +12,18 @@ } </script> - <h1><%= message('update_key.bulk_update_confirmation_page') -%></h1> + <h1><%= @can_update ? message('update_key.bulk_update_confirmation_page') : message('update_key.bulk_update_impossible') -%></h1> <br/> <p> - <%= @can_update ? message('update_key.keys_will_be_updated_as_follows') : message('update_key.cant_update_because_duplicate_keys', :params => [@old_prefix, @new_prefix]) -%> + <% if @can_update %> + <%= message('update_key.keys_will_be_updated_as_follows') -%> + <% else %> + <% if @duplicate_key_found %> + <%= message('update_key.cant_update_because_duplicate_keys', :params => [@old_prefix, @new_prefix]) -%> + <% else %> + <%= message('update_key.no_key_to_update', :params => @old_prefix) -%> + <% end %> + <% end %> </p> <table class="data" style="width:1%; margin-top: 10px"> @@ -31,13 +39,12 @@ </table> <% if @can_update %> - <% form_tag( {:action => 'perform_key_bulk_update', :id => @project.id }) do -%> + <% form_tag( {:action => 'perform_key_bulk_update', :id => @project.id }, :onsubmit => "update_launched();$('loading_bulk_update').show();") do -%> <input type="hidden" value="<%= @project.id -%>" name="id" id="project_id"> <input type="hidden" value="<%= @old_prefix -%>" name="old_prefix" id="old_prefix"> <input type="hidden" value="<%= @new_prefix -%>" name="new_prefix" id="new_prefix"> <br/> - <%= submit_tag message('update_key.rename'), :id => 'bulk_update_button', :class => 'action', - :onclick => "update_launched();$('loading_bulk_update').show();" %> + <%= submit_tag message('update_key.rename'), :id => 'bulk_update_button', :class => 'action' -%> <a href="<%= url_for :action => 'key', :id => @project.key -%>"><%= message('cancel') -%></a> <span class="loading" id="loading_bulk_update" style="display: none; padding: 3px 10px;"></span> <% end %> |