ref: refs/heads/master
commit 1f58657c3a784fac14719fe8e9aeaf12139b417a
Author: Klaus Kämpf
Date: Fri Jul 17 18:04:39 2009 +0200
Set error when redirecting to hosts controller
---
webclient/app/controllers/hosts_controller.rb | 2 ++
webclient/app/controllers/sessions_controller.rb | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/webclient/app/controllers/hosts_controller.rb b/webclient/app/controllers/hosts_controller.rb
index 8ff6c7d..3dfb9a1 100644
--- a/webclient/app/controllers/hosts_controller.rb
+++ b/webclient/app/controllers/hosts_controller.rb
@@ -24,6 +24,8 @@ class HostsController < ApplicationController
host = Host.find(params[:hostid]) rescue nil
flash[:error] = _("Can't connect to host #{host.name}.") if host
flash[:warning] = _("Make sure the host is up and that the YaST web service is running.")
+ elsif error == "nohostid"
+ flash[:notice] = _("Please select a host to connect to.")
end
end
diff --git a/webclient/app/controllers/sessions_controller.rb b/webclient/app/controllers/sessions_controller.rb
index 9dc5cd4..e505129 100644
--- a/webclient/app/controllers/sessions_controller.rb
+++ b/webclient/app/controllers/sessions_controller.rb
@@ -29,12 +29,13 @@ class SessionsController < ApplicationController
return
end
+ # Set @host to display info at login screen
@host = Host.find(params[:hostid]) rescue nil
+
# if the hostname is not set, go to the host controller
# to pickup a service
unless @host
- flash[:notice] = _("Please select a host to connect to.") unless flash[:notice]
- redirect_to :controller => 'hosts', :action => 'index'
+ redirect_to :controller => 'hosts', :action => 'index', :error => "nohostid"
return
end
@@ -67,8 +68,7 @@ class SessionsController < ApplicationController
# error handling when login to the service is pretty
# important to get meaningful error messages to the user
rescue Errno::ECONNREFUSED => e
- flash[:error] = _("Can't connect to host at #{host.name}, make sure the host is up and that the YaST web service is running.")
- redirect_to :action => "new"
+ redirect_to :controller => "hosts", :action => "index", :hostid => host.id, :error => "econnrefused"
return
rescue Exception => e
logger.warn e.to_s
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org