Sha256: 471afd26645cd61ad5920e70b995f11787423fea1628bdd6054cf65fcb75e4e5

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

require 'sinatra/base'
require 'erb'
require 'json'
require 'rhoconnect/graph_helper'

module RhoconnectConsole  
  class << self
    ROOT_DIR = File.dirname(File.expand_path(__FILE__)) unless defined? ROOT_DIR
    def root_path(*args)
      File.join(ROOT_DIR, *args)
    end
  end  

  class Server < Sinatra::Base
    set :views,   RhoconnectConsole.root_path('templates')
    set :public_folder, RhoconnectConsole.root_path
    set :static,        true    
    use Rack::Session::Cookie
    HEROKU_NAV = ENV['INSTANCE_ID'] ? RestClient.get('http://nav.heroku.com/v1/providers/header') : nil
    before do
      headers['Expires'] = 'Sun, 19 Nov 1978 05:00:00 GMT'
      headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'  
      headers['Pragma'] = 'no-cache'
    end
    include GraphHelper
    
    get '/' do
      #if heroku instance single sign will already have logged in a have token in session
      @token = session[:token] if ENV['INSTANCE_ID']
      @heroku = RestClient.get('http://nav.heroku.com/v1/providers/header') if @token
      @version = Rhoconnect::VERSION
      @domain =  ENV['RHODES_URL'] || request.host_with_port
      @domain += "/application" if @domain
      erb :index
    end
   

    post "/get_user_graph" do
      count_graph('timing/usercount', "User Count", "Users", "users")
    end

    post '/source_timing' do
      source_timing(params)
    end

    post '/http_timing' do
      http_timing(params)
    end

    post '/device_count' do
      count_graph('timing/devicecount', "Device Count", "Devices", "clients")
    end
    
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rhoconnect-3.3.1.beta4 lib/rhoconnect/web-console/server.rb
rhoconnect-3.3.1.beta3 lib/rhoconnect/web-console/server.rb
rhoconnect-3.3.1.beta2 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.1 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0.beta5 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0.beta4 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0.beta3 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0.beta2 lib/rhoconnect/web-console/server.rb
rhoconnect-3.2.0.beta1 lib/rhoconnect/web-console/server.rb