Class: SolidQueueUi::Web

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_queue_ui/web.rb,
lib/solid_queue_ui/web/csrf_protection.rb

Defined Under Namespace

Classes: CsrfProtection

Constant Summary collapse

ROOT =
File.expand_path("#{File.dirname(__FILE__)}/../../web")
VIEWS =
"#{ROOT}/views"
LOCALES =
["#{ROOT}/locales"]
LAYOUT =
"#{VIEWS}/layout.html.erb"
ASSETS =
"#{ROOT}/assets"
DEFAULT_TABS =
{
  "Dashboard" => "",
}
CONTENT_LANGUAGE =
"content-language"
CONTENT_SECURITY_POLICY =
"content-security-policy"
LOCATION =
"location"
X_CASCADE =
"x-cascade"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.app_urlObject

Returns the value of attribute app_url.



68
69
70
# File 'lib/solid_queue_ui/web.rb', line 68

def app_url
  @app_url
end

.localesObject



48
49
50
# File 'lib/solid_queue_ui/web.rb', line 48

def locales
  @locales ||= LOCALES
end

.viewsObject



52
53
54
# File 'lib/solid_queue_ui/web.rb', line 52

def views
  @views ||= VIEWS
end

Class Method Details

.call(env) ⇒ Object



92
93
94
95
# File 'lib/solid_queue_ui/web.rb', line 92

def self.call(env)
  @app ||= new
  @app.call(env)
end

.custom_job_info_rowsObject



44
45
46
# File 'lib/solid_queue_ui/web.rb', line 44

def custom_job_info_rows
  @custom_job_info_rows ||= []
end

.default_tabsObject



40
41
42
# File 'lib/solid_queue_ui/web.rb', line 40

def default_tabs
  DEFAULT_TABS
end

.inherited(child) ⇒ Object



72
73
74
# File 'lib/solid_queue_ui/web.rb', line 72

def self.inherited(child)
  child.app_url = app_url
end

.middlewaresObject



56
57
58
# File 'lib/solid_queue_ui/web.rb', line 56

def middlewares
  @middlewares ||= []
end

.register(extension) ⇒ Object



113
114
115
# File 'lib/solid_queue_ui/web.rb', line 113

def self.register(extension)
  extension.registered(WebApplication)
end

.set(attribute, value) ⇒ Object



64
65
66
# File 'lib/solid_queue_ui/web.rb', line 64

def set(attribute, value)
  send(:"#{attribute}=", value)
end

.settingsObject



36
37
38
# File 'lib/solid_queue_ui/web.rb', line 36

def settings
  self
end

.use(*args, &block) ⇒ Object



60
61
62
# File 'lib/solid_queue_ui/web.rb', line 60

def use(*args, &block)
  middlewares << [args, block]
end

Instance Method Details

#appObject



97
98
99
# File 'lib/solid_queue_ui/web.rb', line 97

def app
  @app ||= build
end

#call(env) ⇒ Object



88
89
90
# File 'lib/solid_queue_ui/web.rb', line 88

def call(env)
  app.call(env)
end

#disable(*opts) ⇒ Object



105
106
107
# File 'lib/solid_queue_ui/web.rb', line 105

def disable(*opts)
  opts.each { |key| set(key, false) }
end

#enable(*opts) ⇒ Object



101
102
103
# File 'lib/solid_queue_ui/web.rb', line 101

def enable(*opts)
  opts.each { |key| set(key, true) }
end

#middlewaresObject



80
81
82
# File 'lib/solid_queue_ui/web.rb', line 80

def middlewares
  @middlewares ||= self.class.middlewares
end

#set(attribute, value) ⇒ Object



109
110
111
# File 'lib/solid_queue_ui/web.rb', line 109

def set(attribute, value)
  send(:"#{attribute}=", value)
end

#settingsObject



76
77
78
# File 'lib/solid_queue_ui/web.rb', line 76

def settings
  self.class.settings
end

#use(*args, &block) ⇒ Object



84
85
86
# File 'lib/solid_queue_ui/web.rb', line 84

def use(*args, &block)
  middlewares << [args, block]
end