[yast-commit] <web-client> master : proxy loader automatic redirects in problems to ensure same behavior of modules, proper document how to disable it if someone needs it (add disable to patch AJAX stuff)

ref: refs/heads/master commit bd90e6e4954fc43317b96b89f44b4d5051bf6acf Author: Josef Reidinger <jreidinger@suse.cz> Date: Fri Jul 17 14:43:20 2009 +0200 proxy loader automatic redirects in problems to ensure same behavior of modules, proper document how to disable it if someone needs it (add disable to patch AJAX stuff) --- .../app/controllers/patch_updates_controller.rb | 2 ++ .../app/controllers/system_time_controller.rb | 3 --- webclient/lib/proxy_loader.rb | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/plugins/patch_updates/app/controllers/patch_updates_controller.rb b/plugins/patch_updates/app/controllers/patch_updates_controller.rb index ce4c0de..186fdc2 100644 --- a/plugins/patch_updates/app/controllers/patch_updates_controller.rb +++ b/plugins/patch_updates/app/controllers/patch_updates_controller.rb @@ -16,6 +16,8 @@ class PatchUpdatesController < ApplicationController patch_updates = load_proxy 'org.opensuse.yast.system.patches', :all unless patch_updates + erase_redirect_results #reset all redirects + erase_render_results flash.clear #no flash from load_proxy render :partial => "patch_summary", :locals => { :patch => nil } return false diff --git a/plugins/systemtime/app/controllers/system_time_controller.rb b/plugins/systemtime/app/controllers/system_time_controller.rb index 138a14a..094c573 100644 --- a/plugins/systemtime/app/controllers/system_time_controller.rb +++ b/plugins/systemtime/app/controllers/system_time_controller.rb @@ -66,7 +66,6 @@ class SystemTimeController < ApplicationController redirect_to root_path return false end - @timezones = systemtime.timezones @timezone = systemtime.timezone @@ -89,7 +88,6 @@ class SystemTimeController < ApplicationController def update_time t = load_proxy 'org.opensuse.yast.modules.yapi.time' - # FIXME: add a 'redirect_to' unless t return false end @@ -118,7 +116,6 @@ class SystemTimeController < ApplicationController def update_timezone t = load_proxy 'org.opensuse.yast.modules.yapi.time' - # FIXME: add a 'redirect_to' unless t return false end diff --git a/webclient/lib/proxy_loader.rb b/webclient/lib/proxy_loader.rb index 6187dfa..4e94aae 100644 --- a/webclient/lib/proxy_loader.rb +++ b/webclient/lib/proxy_loader.rb @@ -1,5 +1,6 @@ # = ProxyLoader module -# Modules handles finding and loading proxy. It take care about pottential problems +# Modules handles finding and loading proxy. It take care about pottential +# problems and redirect in problems to correct page. # == requirements # Use ExceptionLogger module to it run. Intended to be used in Controller. # == Usage @@ -14,6 +15,19 @@ # end # ... # +# In case you don't want redirect (like in AJAX handlers) +# include ProxyLoader +# def index +# @systemtime = load_proxy 'org.opensuse.yast.modules.yapi.time' +# +# unless @systemtime +# erase_redirect_results +# erase_render_results +# #error handling +# return false +# end +# +# module ProxyLoader #Finds proxy and find its result. @@ -27,6 +41,7 @@ module ProxyLoader unless proxy logger.warn "Couldn't find proxy for #{name}" flash[:error] = "Cannot find service on target machine for #{name}." + redirect_to root_path @permissions = nil return nil end @@ -49,9 +64,11 @@ module ProxyLoader rescue ActiveResource::ClientError => e flash[:error] = YaST::ServiceResource.error(e) ExceptionLogger.log_exception e + redirect_to root_path rescue Exception => e flash[:error] = e.message ExceptionLogger.log_exception e + redirect_to root_path end return ret -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Josef Reidinger