Module: SidekiqAdminEnquerer::WebApp Private

Defined in:
lib/sidekiq_admin_enquerer/web_app.rb,
lib/sidekiq_admin_enquerer/web_app/app_control.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Defined Under Namespace

Modules: AppControl, WebHelpers Classes: JobMethodWrapper, JobParamWrapper, JobWrapper

Constant Summary collapse

TEMPLATES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash<Symbol,String>)

Since:

  • 0.1.0

{
  jobs: File.read(File.join(File.expand_path(__dir__), 'pages', 'jobs.erb')),
  job: File.read(File.join(File.expand_path(__dir__), 'pages', 'job.erb'))
}.freeze

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • app (?)

Since:

  • 0.1.0



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sidekiq_admin_enquerer/web_app.rb', line 27

def registered(app)
  app.helpers(WebHelpers)

  app.get('/enquerer') do
    @jobs = AppControl.jobs
    render(:erb, TEMPLATES[:jobs])
  end

  app.get('/enquerer/:job_name') do
    @job = AppControl.find_job(params[:job_name])
    render(:erb, TEMPLATES[:job])
  end

  app.post('/enquerer') do
    AppControl.run_job(params)
    redirect File.join(root_path, 'enquerer')
  end
end