Sha256: b101da28e01af28662d10db8790e65f2e14c63bd74b5dc4a61d96848390b78b2

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

# https://github.com/mperham/sidekiq/wiki/Monitoring
require 'erb'
require 'yaml'
require 'sinatra/base'
require 'json'

require 'mongo_profiler/web_helpers'

module MongoProfiler
  class Web < Sinatra::Base

    set :root,           File.expand_path(File.dirname(__FILE__) + "/../../web")
    set :public_folder,  Proc.new { "#{root}/assets" }
    set :views,          Proc.new { "#{root}/views" }

    helpers WebHelpers


    get '/' do
      @groups = MongoProfiler::ProfileGroup.order(:updated_at.desc)

      erb :index
    end

    get '/groups/:id' do
      @group = MongoProfiler::ProfileGroup.find(params[:id])

      erb :show
    end

     post '/clear' do
       MongoProfiler::ProfileGroup.delete_all
       MongoProfiler::Profile.delete_all

      redirect to('/')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_profiler-0.0.2 lib/mongo_profiler/web.rb