]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2084 improve usability
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 20 Mar 2012 16:05:46 +0000 (17:05 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 20 Mar 2012 16:05:46 +0000 (17:05 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/generate_secret_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/index.html.erb

index d24569af8c4fa1a394f207fb70f969b386ebef3e..fc1ca0afbdcfa344c6612fbf1465216bd76b1d4a 100644 (file)
@@ -38,12 +38,14 @@ class EncryptionConfigurationController < ApplicationController
   end
 
   def generate_secret
-    render :text => java_facade.generateRandomSecretKey()
+    @secret = java_facade.generateRandomSecretKey()
+    render :partial => 'encryption_configuration/generate_secret_key'
   end
 
   def encrypt
     bad_request('No secret key') unless java_facade.hasSecretKey()
-    render :text => java_facade.encrypt(params[:text])
+    @encrypted = java_facade.encrypt(params[:text])
+    render :partial => 'encryption_configuration/encrypt'
   end
 
   private
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_encrypt.html.erb
new file mode 100644 (file)
index 0000000..668e96c
--- /dev/null
@@ -0,0 +1 @@
+<p class="spacer-bottom">Encrypted value: <input type="text" id="encrypted_text" size="40" readonly="readonly" class="notice" value="<%= @encrypted -%>"></p>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/encryption_configuration/_generate_secret_key.html.erb
new file mode 100644 (file)
index 0000000..af3a720
--- /dev/null
@@ -0,0 +1,11 @@
+<ul class="bullet">
+  <li>Store the secret key <input type="text" size="40" readonly="readonly" id="secret" value="<%= @secret -%>" class="notice"/> in the file <code>~/.sonar/sonar-secret.txt</code> of the server. This file can be relocated
+  by defining the property <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code></li>
+  <li>Restrict access to this file by making it readable and by owner only</li>
+  <li>Restart the server if the property <code>sonar.secretKeyPath</code> has been set or changed.</li>
+  <li>Copy this file on all the machines that execute code inspection. Define the property <code>sonar.secretKeyPath</code> on those machines if the path is not <code>~/.sonar/sonar-secret.txt</code>.</li>
+  <li>For each property that you want to encrypt, <%= link_to 'generate the encrypted value', {:action => 'index'}, {:class => 'link-action'} -%>
+    and replace the original values where ever they are stored
+    (configuration files, command lines)
+  </li>
+</ul>
\ No newline at end of file
index 8ef137857ef85dba1f0342c83e235ed7b68bb60a..79a5f39ac6618c00f5b934f4a4677a1d71dd2335 100644 (file)
@@ -1,22 +1,11 @@
-<p>Secret key is required to be able to encrypt properties. Please follow those steps :</p>
-<ul class="bullet">
-  <li>
-    <%=  button_to_remote 'Generate a random key',
+<h3 class="spacer-bottom">Encryption</h3>
+<p class="spacer-bottom">Secret key is required to be able to encrypt properties. <a href="http://docs.codehaus.org/display/SONAR/Settings+Encryption" class="external">More information</a>.</p>
+<div id="secret_content">
+  <%=  button_to_remote 'Generate secret key',
                           :url => {:action => 'generate_secret'},
-                          :update => {:success => 'secret', :failure => 'secret_error'},
-                          :success => "$('secret').show()",
+                          :update => {:success => 'secret_content', :failure => 'secret_error'},
                           :failure => "$('secret_error').show()",
                           :method => 'POST',
                           :id => 'submit_generate_secret' -%>
-    <span id="secret" class="notice" style="display:none"></span>
-    <span id="secret_error" class="error" style="display:none"></span>
-  </li>
-  <li>Store this key in the file <code>~/.sonar/sonar-secret.txt</code> of the server. This file can be relocated
-  by defining the property <code>sonar.secretKeyPath</code> in <code>conf/sonar.properties</code></li>
-  <li>Restrict access to this file by making it readable and by owner only</li>
-  <li>Copy this file on all the machines that execute code inspection. Define the property <code>sonar.secretKeyPath</code> on those machines if needed.</li>
-  <li>For each property that you want to encrypt, <%= link_to 'generate the encrypted value', {:action => 'index'}, {:class => 'link-action'} -%>
-    and replace the original values where ever they are stored
-    (configuration files, command lines)
-  </li>
-</ul>
\ No newline at end of file
+  <span id="secret_error" class="error" style="display:none"></span>
+</div>
\ No newline at end of file
index b5d6c4fad0425152e5fa3a181a348963000239bc..53added89956372ef97094f5fdaf78f43b58555a 100644 (file)
@@ -1,17 +1,20 @@
+<h3 class="spacer-bottom">Encryption</h3>
 <p class="spacer-bottom">Secret key is registered. You can encrypt any property value with the following form :</p>
 
 <%= form_remote_tag :url => {:action => 'encrypt'},
-                    :update => {:success => 'encrypted_text', :failure => 'encryption_error'},
-                    :success => "$('encrypted_text').show()",
+                    :update => {:success => 'encrypted_section', :failure => 'encryption_error'},
+                    :success => "$('encrypted_section').show();$('encryption_error').hide();",
                     :failure => "$('encryption_error').show()",
                     :html => {:class => 'spacer-bottom'} -%>
 <input type="text" name="text" id="clear_text"/>
 <input type="submit" value="Encrypt" id="submit_encrypt"/>
-<span id="encrypted_text" class="notice" style="display:none"></span>
-<span id="encryption_error" class="error" style="display:none"></span>
 </form>
+
+<div id="encrypted_section" style="display:none"></div>
+<span id="encryption_error" class="error" style="display:none"></span>
+
 <p>Note that the <%= link_to 'secret key can be changed', {:action => 'generate_secret_form'}, :class => 'link-action' -%>
-  but all the encrypted properties will have to be updated.</p>
+  but all the encrypted properties will have to be updated. <a href="http://docs.codehaus.org/display/SONAR/Settings+Encryption" class="external">More information</a>.</p>
 <script>
   $('clear_text').focus();
 </script>
\ No newline at end of file