Sha256: ed91a667c0d5ed4598b05f7de09600ee7120d595c1b300eca0d56d20483adfc6

Contents?: true

Size: 1.94 KB

Versions: 48

Compression:

Stored size: 1.94 KB

Contents

module Admin
  class ServiceErrorsController < UmlautController
    # by default, force ssl connection in production env, but can be
    # config'd. 
    force_ssl if umlaut_config.lookup!("admin.force_ssl", Rails.env.production? )
    # Cheesy way to do auth from config single or multiple. Alternately,
    # you might want to protect at apache level, for instance for shib
    # or SSO integration
    if (admin_auth = umlaut_config.lookup!("admin.auth"))
      before_filter lambda {
        authenticate_or_request_with_http_basic do |login, password|                    
          login == admin_auth[:username] && password == admin_auth[:password]
        end
      }
    end
    
    
    def index
      # grab the earliest dispatch to see how far back our db goes
      @earliest_dispatch = DispatchedService.select("updated_at").
        order("updated_at").
        limit(1).
        first.
        updated_at
      
      
      errors_base = DispatchedService.
        where(:status => [DispatchedService::FailedFatal, DispatchedService::FailedTemporary])
      
      if params[:service_id]
        errors_base = errors_base.where(:service_id => params[:service_id])
      end
      
      if params[:q]
        errors_base = errors_base.where("exception_info #{" NOT " if params[:q_not]} like ?", "%#{params[:q]}%")
      end
      
      # will miraculously return a hash whose key is service_id, value
      # is count of failed service dispatches. 
      @failed_by_service = errors_base.select("service_id").        
        group("service_id").
        count
      
      # And get the most recent batch of failed services
      # kaminari page/per
      @offset = params[:offset].to_i 
      @limit = params[:per_page].to_i 
      @limit = 10 if @limit == 0
      
      @dispatched_services = errors_base.order("updated_at DESC").
        limit(@limit).offset(@offset)             
      @dispatched_services_count = errors_base.count
    end
    
    
  end  
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
umlaut-4.1.7 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.6 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.5 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.4 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.3 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.2 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.1 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.0 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.0.pre3 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.0.pre.2 app/controllers/admin/service_errors_controller.rb
umlaut-4.1.0.pre.alpha.1 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.3 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.2 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.1 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0.beta5 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0.beta4 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0.beta3 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0.beta2 app/controllers/admin/service_errors_controller.rb
umlaut-4.0.0.beta1 app/controllers/admin/service_errors_controller.rb