Sha256: 94d686371cdf848c99b1c8812ea7d0d975b9161276eebbf90148f92099f403bb

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require 'chronic'

module Mission
  # ---------------------------------------------------------------------------
  get '/' do
    # reset app info
    session[:app_info] = @app_info = nil
  
    last_tick           = session[:last_tick]
    last_tick           ||= Chronic.parse( "#{@refresh_rate} seconds ago" )
    session[:last_tick] = Time.now
    
    @pulse = Wackamole::Mission.pulse( last_tick.utc )
              
    erb :'mission/index'
  end
  
  # ---------------------------------------------------------------------------
  get '/mission/refresh' do
    last_tick           = session[:last_tick]
    last_tick           ||= Chronic.parse( "#{@refresh_rate} seconds ago" )
    session[:last_tick] = Time.now
      
    @pulse = Wackamole::Mission.pulse( last_tick.utc )

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

  get '/mission/logs/:app_name/:stage/:type' do
    Wackamole::Control.switch_mole_db!( params[:app_name].downcase, params[:stage] )
    
    # Set app info
    @app_info = Wackamole::Feature.get_app_info
    session[:app_info] = @app_info

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

  # # ---------------------------------------------------------------------------
  # get '/mission/fixed/:app/:env/:type' do
  #   Wackamole::Mission.reset!( params[:app], params[:env], params[:type] )
  #   erb :'/mission/refresh_js', :layout => false
  # end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wackamole-0.0.7 lib/controllers/mission.rb