Class: Wurk::Web
- Inherits:
-
Object
- Object
- Wurk::Web
- Defined in:
- lib/wurk/web.rb,
lib/wurk/web/config.rb,
lib/wurk/web/search.rb,
lib/wurk/web/rack_app.rb,
lib/wurk/web/extension.rb,
lib/wurk/web/enterprise.rb,
lib/wurk/web/batch_status.rb
Overview
Web UI namespace. Holds three sibling concerns:
* `Wurk::Web::Config` + `Wurk::Web::Authorization` — the Rack-level
authorization hook (sidekiq-ent §9.2), 403 on falsey.
* `Wurk::Web::Search` — Pro substring search across queues/retries/
scheduled/dead (ZSCAN + glob; sidekiq-pro §10.1).
* `Wurk::Web::Enterprise` — Limits / Periodic / Historical helpers
(sidekiq-ent §9.1) used by the JSON APIs.
Wurk ships every Pro/Ent web feature free. Loading this file is enough
to make Wurk::Web.configure available — no separate require needed.
The class body is intentionally empty — every concern lives in a sibling file already required above. Rubocop's Lint/EmptyClass is disabled because this is a namespace anchor, not a missing-implementation bug.
Defined Under Namespace
Modules: Enterprise, Extension Classes: Authorization, BatchStatus, Config, MiddlewareStack, Search
Constant Summary collapse
- SAFE_METHODS =
Upstream-compatible class-level Rack surface (#204): Sidekiq apps do
run Sidekiq::Web,mount Sidekiq::Web => "/sidekiq", and rack-test ecosystem suites callSidekiq::Web.call(env)directly. Wurk's full dashboard is the engine-mounted SPA; this standalone entry serves the registered third-party Web extensions (#187's renderer) under their own route paths — the surface ecosystem gems exercise. Non-extension paths 404 rather than half-serving the SPA without its engine.Same CSRF model as upstream Sidekiq 8 and ExtensionsController (spec §25.1): unsafe methods must carry
Sec-Fetch-Site: same-origin. %w[GET HEAD OPTIONS TRACE].freeze
- NOT_FOUND_HEADERS =
{ 'Content-Type' => 'text/plain' }.freeze
Class Method Summary collapse
- .app_url ⇒ Object
- .app_url=(value) ⇒ Object
- .assets_path ⇒ Object
- .assets_path=(value) ⇒ Object
-
.call(env) ⇒ Object
Class-level Rack entry — wraps host-registered middleware (
Wurk::Web.use) around the extensions dispatcher. - .config ⇒ Object
-
.configure ⇒ Object
With a block: yields the config (the documented configure form).
- .custom_job_info_rows ⇒ Object
-
.register(extension) ⇒ Object
(also: register_extension)
Class-level extension surface — gems call these straight off
Sidekiq::Web(e.g.Sidekiq::Web.register(Ext, name:, tab:)orSidekiq::Web.tabs["Locks"] = "locks"), not only insideconfigure. -
.reset_config! ⇒ Object
Test helper — exposed for parity with
Wurk::Limiter.reset_config!. - .tabs ⇒ Object
-
.use ⇒ Object
Class-level shorthand for
config.use— mirrorsSidekiq::Web.use.
Class Method Details
.app_url ⇒ Object
312 313 314 |
# File 'lib/wurk/web/config.rb', line 312 def app_url config.app_url end |
.app_url=(value) ⇒ Object
316 317 318 |
# File 'lib/wurk/web/config.rb', line 316 def app_url=(value) config.app_url = value end |
.assets_path ⇒ Object
320 321 322 |
# File 'lib/wurk/web/config.rb', line 320 def assets_path config.assets_path end |
.assets_path=(value) ⇒ Object
324 325 326 |
# File 'lib/wurk/web/config.rb', line 324 def assets_path=(value) config.assets_path = value end |
.call(env) ⇒ Object
Class-level Rack entry — wraps host-registered middleware (Wurk::Web.use)
around the extensions dispatcher. INTENTIONALLY bypasses
Wurk::Web::Authorization (config.authorized? + config.read_only?):
the full dashboard with its auth/read-only enforcement is the
engine-mounted SPA wired in lib/wurk/engine.rb, and the engine's
middleware stack already includes Authorization. This standalone
surface exists for ecosystem rack-test consumers (Sidekiq::Web.call)
whose mounted-app expectations cover extension routes only — wrapping
auth here would break run Sidekiq::Web / rack-test parity with
upstream Sidekiq, which also doesn't auth-gate Sidekiq::Web.call.
31 32 33 |
# File 'lib/wurk/web/rack_app.rb', line 31 def call(env) config.rack_app(method(:dispatch)).call(env) end |
.config ⇒ Object
280 281 282 |
# File 'lib/wurk/web/config.rb', line 280 def config @config ||= Config.new end |
.configure ⇒ Object
With a block: yields the config (the documented configure form).
Without: returns it — upstream's blockless-getter form, which gems
use as Sidekiq::Web.configure.tabs (#204).
287 288 289 |
# File 'lib/wurk/web/config.rb', line 287 def configure block_given? ? yield(config) : config end |
.custom_job_info_rows ⇒ Object
308 309 310 |
# File 'lib/wurk/web/config.rb', line 308 def custom_job_info_rows config.custom_job_info_rows end |
.register(extension) ⇒ Object Also known as: register_extension
Class-level extension surface — gems call these straight off
Sidekiq::Web (e.g. Sidekiq::Web.register(Ext, name:, tab:) or
Sidekiq::Web.tabs["Locks"] = "locks"), not only inside configure.
299 300 301 |
# File 'lib/wurk/web/config.rb', line 299 def register(extension, **, &) config.register_extension(extension, **, &) end |
.reset_config! ⇒ Object
Test helper — exposed for parity with Wurk::Limiter.reset_config!.
Production callers should not need to drop the auth block at runtime.
330 331 332 |
# File 'lib/wurk/web/config.rb', line 330 def reset_config! @config = nil end |
.tabs ⇒ Object
304 305 306 |
# File 'lib/wurk/web/config.rb', line 304 def tabs config.tabs end |
.use ⇒ Object
Class-level shorthand for config.use — mirrors Sidekiq::Web.use.
292 293 294 |
# File 'lib/wurk/web/config.rb', line 292 def use(...) config.use(...) end |