[PATCH conductor] BZ#786207 - need selection validation on launch_new -- adition

Tomas Hrcka thrcka at redhat.com
Thu Apr 19 13:02:36 UTC 2012


This patch fixies latest comments on the BZ.

Small js adjustment and changed controller method to one liner
---
 src/app/controllers/deployments_controller.rb   |    3 +--
 src/app/views/deployments/_launch_new.html.haml |    1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 504a050..d95f19a 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -340,8 +340,7 @@ class DeploymentsController < ApplicationController
   # TODO - The AJAX calls here have a potential race condition; might want to include params[:name]
   # in the output to help catch this and discard output if appropriate
   def check_name
-    deployment = Deployment.find_by_name(params[:name])
-    render :text => deployment.nil?.to_s
+    render :text => params[:name].empty? ? false : Deployment.find_by_name(params[:name]).nil?
   end
 
   def launch_from_catalog
diff --git a/src/app/views/deployments/_launch_new.html.haml b/src/app/views/deployments/_launch_new.html.haml
index 46f1499..30ae4dc 100644
--- a/src/app/views/deployments/_launch_new.html.haml
+++ b/src/app/views/deployments/_launch_new.html.haml
@@ -63,6 +63,7 @@
         $('#name_avail_indicator').html(data == "false" ? "#{t'deployments.launch_new.already_in_use'}" : "#{t'deployments.launch_new.name_available'}");
         if(data == "true" && $('#next_button').is(':disabled')){
          $('#next_button').removeAttr('disabled');
+        }else if(data == "true" && $('#next_button').is_not(':disabled')){
         }else{
          $('#next_button').attr("disabled", "disabled");
         }
-- 
1.7.1




More information about the aeolus-devel mailing list