From 5ed96f67bee59912b459e13ad611fc19cea0a89f Mon Sep 17 00:00:00 2001 From: David Gageot Date: Fri, 21 Sep 2012 10:36:32 +0200 Subject: [PATCH] SONAR-3754 Restore property validation --- .../webapp/WEB-INF/app/controllers/settings_controller.rb | 3 ++- .../webapp/WEB-INF/app/views/settings/_properties.html.erb | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb index 50282117749..69206f8d16a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb @@ -39,13 +39,14 @@ class SettingsController < ApplicationController load_properties() + @updated_properties = {} @definitions.map(&:key).each do |key| value = params[key] if value.blank? Property.clear(key, resource_id) else - Property.set(key, value, resource_id) + @updated_properties[key] = Property.set(key, value, resource_id) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb index 7719dc2d209..cb3ee1a3b31 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb @@ -36,10 +36,15 @@
- <% else -%> + <% else -%> <%= render "settings/type_#{property_type(property, value)}", :property => property, :value => value -%> <% end -%> + <% p = @updated_properties[property.key] if @updated_properties -%> + <% if p && !p.valid? -%> +
<%= p.validation_error_message -%>
+ <% end -%> + <% default_prop_value = (@resource ? Property.value(property.key, nil, property.defaultValue) : property.defaultValue) -%> <% unless default_prop_value.blank? -%>
Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%>
-- 2.39.5