class Adminix::Web::Router

Public Instance Methods

dashboard_route() click to toggle source

Routes

# File lib/adminix/web/router.rb, line 49
def dashboard_route
  content = view('dashboard.html')
  render html: content, content_type: 'text/html'
end
job_route() click to toggle source
# File lib/adminix/web/router.rb, line 68
def job_route
  @page = !params['page'].nil? ? params['page'].to_i : 1
  @per_page = 2
  content = view('job.html')
  render html: content, content_type: 'text/html'
end
loadstamp_route() click to toggle source
# File lib/adminix/web/router.rb, line 76
def loadstamp_route
  # Adminix.logger.debug params
  @page = !params['page'].nil? ? params['page'].to_i : 1
  @per_page = 2
  content = view('loadstamp.html')
  render html: content, content_type: 'text/html'
end
log_route() click to toggle source
# File lib/adminix/web/router.rb, line 61
def log_route
  @page = !params['page'].nil? ? params['page'].to_i : 1
  @per_page = 2
  content = view('log.html')
  render html: content, content_type: 'text/html'
end
params() click to toggle source

initialize

# File lib/adminix/web/router.rb, line 35
def params
  params = {}
  ls = @http_query_string.to_s.split('&')
  return params if ls == ''

  ls.each do |p|
    parts = p.split('=')
    params[parts[0]] = parts[1]
  end
  return params
end
process_request() click to toggle source
# File lib/adminix/web/router.rb, line 5
def process_request
  if @http_request_uri == '/ping'
    render text: 'pong'
  elsif @http_request_uri == '/'
    dashboard_route
  elsif @http_request_uri == '/link'
    link_route
  elsif @http_request_uri =="/log"
    log_route
  elsif @http_request_uri =="/job"
    job_route
  elsif @http_request_uri =="/loadstamp"
    loadstamp_route
  elsif @http_request_uri =="/start"
    start_route
  elsif @http_request_uri == "/stop"
    stop_route

  else
    asset = Helpers::Files.read_asset(@http_request_uri)
    if asset
      render text: asset
    else
      not_found_route
    end
  end
end
start_route() click to toggle source
# File lib/adminix/web/router.rb, line 84
def start_route
   Adminix.watcher.app_service.start_process
   content = {"status": "process started"}.to_json
   render json: content
end
stop_route() click to toggle source
# File lib/adminix/web/router.rb, line 90
def stop_route
  Adminix.watcher.app_service.stop_process
  content = {"status": "process stopped"}.to_json
  render json: content
end