[yast-commit] <web-client> master : catch exception COLLECTD_SYNC_ERROR and show it to the user (#bnc555204)
ref: refs/heads/master commit 61671be0674cc61c28f51bddb47aebb55c6d1052 Author: Stefan Schubert <schubi@suse.de> Date: Tue Nov 24 16:10:02 2009 +0100 catch exception COLLECTD_SYNC_ERROR and show it to the user (#bnc555204) --- .../status/app/controllers/status_controller.rb | 22 ++++++++++++++----- .../app/views/status/_status_summary.html.erb | 19 ++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/plugins/status/app/controllers/status_controller.rb b/plugins/status/app/controllers/status_controller.rb index 1202af1..887479d 100644 --- a/plugins/status/app/controllers/status_controller.rb +++ b/plugins/status/app/controllers/status_controller.rb @@ -165,7 +165,9 @@ class StatusController < ApplicationController error_hash = Hash.from_xml error.response.body logger.warn error_hash.inspect if error_hash["error"] && - (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || error_hash["error"]["type"] == "NO_PERM") + (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || + error_hash["error"]["type"] == "COLLECTD_SYNC_ERROR" || + error_hash["error"]["type"] == "NO_PERM") flash[:error] = error_hash["error"]["description"] else raise error @@ -176,25 +178,33 @@ class StatusController < ApplicationController def show_summary return unless client_permissions begin + level = "ok" if create_data status = limits_reached status = (_("Limits exceeded for %s") % status) unless status.empty? + level = "error" else status = _("No data found for showing system status.") + level = "warning" end - render :partial => "status_summary", :locals => { :status => status, :error => nil } + render :partial => "status_summary", :locals => { :status => status, :level => level, :error => nil } rescue ActiveResource::ClientError => error logger.warn error.inspect - render :partial => "status_summary", :locals => { :status => nil, :error => ClientException.new(error) } and return + level = "error" + render :partial => "status_summary", :locals => { :status => nil, :level => "error", :error => ClientException.new(error) } and return rescue ActiveResource::ServerError => error error_hash = Hash.from_xml error.response.body + level = "error" logger.warn error_hash.inspect if error_hash["error"] && - (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || error_hash["error"]["type"] == "NO_PERM") + (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || + error_hash["error"]["type"] == "NO_PERM" || + error_hash["error"]["type"] == "COLLECTD_SYNC_ERROR") + level = "warning" if error_hash["error"]["type"] == "COLLECTD_SYNC_ERROR" #it is a warning only status = error_hash["error"]["description"] - render :partial => "status_summary", :locals => { :status => status, :error => nil } + render :partial => "status_summary", :locals => { :status => status, :level => level, :error => nil } else - render :partial => "status_summary", :locals => { :status => nil, :error => ClientException.new(error) } + render :partial => "status_summary", :locals => { :status => nil, :level => level, :error => ClientException.new(error) } end end end diff --git a/plugins/status/app/views/status/_status_summary.html.erb b/plugins/status/app/views/status/_status_summary.html.erb index 3950e6e..7f75da8 100644 --- a/plugins/status/app/views/status/_status_summary.html.erb +++ b/plugins/status/app/views/status/_status_summary.html.erb @@ -1,18 +1,13 @@ <%= report_error(error, _("An problem occured when loading status information.")) if error %> <div class="status_status"> - <% unless status %> - <div class="status-icon warning"></div> - <span><%= _("No status information available") %></span> - <% else %> - <% link_to "status" do %> - <% if !status.blank? %> - <div class="status-icon error"></div> - <span><%= status %></span> - <% else %> - <div class="status-icon ok"></div> - <span><%= _("Your system is healthy.") %></span> - <% end %> + <% link_to "status" do %> + <% if !status.blank? %> + <div class="status-icon <%= level %>"></div> + <span><%= status %></span> + <% else %> + <div class="status-icon ok"></div> + <span><%= _("Your system is healthy.") %></span> <% end %> <% end %> </div> -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Stefan Schubert