Sha256: c0d09728ba5a00658be28bea511c8b8e425a20ee438974fe4b457a6c53016454

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require 'chronic'
require 'json'

module Dashboard
  
  # ---------------------------------------------------------------------------
  # Show application dashboard
  get '/dashboard/:zone/:app/:stage' do
    zone  = params[:zone]
    app   = params[:app]
    stage = params[:stage]

    switch_context!( zone, app, stage )
    
    @info = Wackamole::MoledInfo.collect_dashboard_info( @updated_on )

    # Reset app info
    load_app_info

    # Reset filters    
    @filter.reset!

    erb :'dashboard/index'
  end
  
  # ---------------------------------------------------------------------------
  # Refresh dashboard
  get '/dashboard/refresh' do
    Wackamole::Control.ensure_db( session[:context] )    
    @info = Wackamole::MoledInfo.collect_dashboard_info( @updated_on )

    erb :'dashboard/refresh_js', :layout => false
  end

  # ---------------------------------------------------------------------------  
  get '/dashboard/logs/:type/:hour/' do
    # Reset filter
    filter = Wackamole::SearchFilter.new
    filter.mole_type( params[:type].to_i )
    filter.hour = params[:hour].to_i
    session[:filter] = filter
    
    redirect '/logs/1'
  end
  
  # ---------------------------------------------------------------------------  
  get '/dashboard/users/:hour/' do
    # Reset filter
    filter = Wackamole::SearchFilter.new
    filter.hour = params[:hour].to_i    
    session[:filter] = filter
    
    redirect '/users/1'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wackamole-0.1.4 lib/controllers/dashboard.rb
wackamole-0.1.3 lib/controllers/dashboard.rb
wackamole-0.1.2 lib/controllers/dashboard.rb