solid_queue_web 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7de0f3d542cd6cd6d162d4069eb5ca373e5ee6fca1738937c2a00ac3f9560956
4
- data.tar.gz: f8bb5e17912f2e87287aba8a5e6a057eb64adafbea6934aecac8b2559bc17290
3
+ metadata.gz: 313999fb3e2f6307b5f5e65bd8be047935bc04894d4bc1cfb94f2b87e945f9ac
4
+ data.tar.gz: d107e00893b0f8cd655d096c59778bb171b1c10c4f6716d4ec88182957ba0dfc
5
5
  SHA512:
6
- metadata.gz: ad6b13a2fe53124e78d5365d112eeb1e8811db4a5ba2be56e0e1d5fb4ac7da13c6f503cc0b71c68e4c295119764d3b4211767609a10efeca2ea8abc472dc51ef
7
- data.tar.gz: 6d046fa5771188fe639ad72960ec4d3ab55916fc4e8d702e68d21b838ee5bdf9b25e6eda641b051ed6d10ecfec69dcdb4720841f170ba02b834d23e2113d516a
6
+ metadata.gz: 796462cdaf3a6c1e40daf0fe0f9d398f9ae3e095ff22dadd2938330d2159f6cce468770582a114a52bf68de9f5eb05ce2336c8ca333bd5e3e8effa62d3f58707
7
+ data.tar.gz: 6b30554ce77a3daf354848bd7c80eea666fe8dda09b487ec246ccd7ab47adbc9ae42e43f6c82c6a73da3918a9d93f3ee48a5bcc5c126aac49079d1b5de24e47b
data/README.md CHANGED
@@ -1,19 +1,60 @@
1
1
  # SolidQueueWeb
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/solid_queue_web.svg)](https://rubygems.org/gems/solid_queue_web)
3
+ [![CI](https://github.com/eclectic-coding/solid_queue_web/actions/workflows/ci.yml/badge.svg)](https://github.com/eclectic-coding/solid_queue_web/actions/workflows/ci.yml)
4
+ [![Ruby Version](https://img.shields.io/badge/ruby-%3E%3D%203.3-CC342D)](https://rubygems.org/gems/solid_queue_web)
5
+ [![Gem Version](https://img.shields.io/gem/v/solid_queue_web)](https://rubygems.org/gems/solid_queue_web)
6
+ [![Downloads](https://img.shields.io/gem/dt/solid_queue_web)](https://rubygems.org/gems/solid_queue_web)
7
+ [![Coverage](https://codecov.io/gh/eclectic-coding/solid_queue_web/branch/main/graph/badge.svg)](https://codecov.io/gh/eclectic-coding/solid_queue_web)
4
8
 
5
- A Rails engine that mounts a monitoring dashboard for [Solid Queue](https://github.com/rails/solid_queue). View queues, inspect jobs by status, browse failed executions, and take action — all without leaving your app.
9
+ A monitoring and management dashboard for [Solid Queue](https://github.com/rails/solid_queue), mountable as a Rails engine in any app.
10
+
11
+ ## The problem
12
+
13
+ Solid Queue ships without a web interface. When jobs fail, queues back up, or workers go silent in production, the only options are `rails console` or raw SQL queries. SolidQueueWeb gives your team a real-time dashboard to inspect, retry, and discard jobs without leaving the browser — and without standing up any additional infrastructure.
14
+
15
+ ## Why SolidQueueWeb?
16
+
17
+ - Purpose-built for Solid Queue — uses its native models directly, no adapters
18
+ - No external CSS framework — drops into any Rails app without asset conflicts
19
+ - Zero-config to start — one line in `routes.rb` and you're running
20
+ - Built for Rails 8 — Turbo Frames for in-place updates, Stimulus for dynamic search, Pagy for efficient pagination
21
+ - Inspired by Sidekiq Web UI and the GoodJob dashboard, adapted for the Solid Queue ecosystem
22
+
23
+ ## Real-world use case
24
+
25
+ A Rails app processes order confirmations, email notifications, and report generation through Solid Queue. An operations team needs to:
26
+
27
+ - Monitor queue depth before a high-traffic event
28
+ - Retry a batch of failed notification jobs after a third-party API outage
29
+ - Pause a queue while a fix is being deployed
30
+ - Identify blocked or long-running jobs before they impact users
31
+
32
+ SolidQueueWeb surfaces all of this in a browser UI available at any route you choose.
6
33
 
7
34
  ## Features
8
35
 
9
- - **Dashboard** — stat cards showing counts for ready, scheduled, running, blocked, and failed jobs, plus queues and processes
36
+ - **Dashboard** — stat cards showing counts for ready, scheduled, running, blocked, and failed jobs, plus queues, recurring tasks, and processes
10
37
  - **Queues** — all queues sorted by name
11
- - **Jobs** — filterable by status (ready, scheduled, claimed, blocked, failed) and by queue; discard individual or all jobs
38
+ - **Jobs** — filterable by status (ready, scheduled, claimed, blocked, failed) and by queue; search by job class name with dynamic auto-submit; discard individual or all jobs; Turbo Frame navigation so only the table updates on filter or search
12
39
  - **Failed jobs** — list of failed executions with error details; retry or discard individually or in bulk
13
40
  - **Job detail** — full arguments, timestamps, and error backtrace; action buttons based on job status
14
41
  - **Queue management** — pause and resume individual queues
42
+ - **Recurring tasks** — all configured recurring tasks with cron schedule, next run time, last run time, and static/dynamic classification
15
43
  - **Processes** — workers, dispatchers, and supervisors with heartbeat health status
16
- - No external CSS framework — works out of the box
44
+
45
+ ## Screenshots
46
+
47
+ ![SolidQueueWeb dashboard](docs/solid-queue-web.png)
48
+
49
+ ## Compatibility
50
+
51
+ | Dependency | Version |
52
+ |-------------|------------|
53
+ | Ruby | >= 3.3 |
54
+ | Rails | >= 8.1.3 |
55
+ | Solid Queue | >= 1.0 |
56
+
57
+ Tested on Ruby 3.3, 3.4, and 4.0.
17
58
 
18
59
  ## Installation
19
60
 
@@ -37,7 +78,7 @@ Add to your `config/routes.rb`:
37
78
  mount SolidQueueWeb::Engine, at: "/jobs"
38
79
  ```
39
80
 
40
- The dashboard will be available at `/jobs`.
81
+ The dashboard will be available at `/jobs`. See [Authentication](#authentication) to restrict access to admin users.
41
82
 
42
83
  ## Authentication
43
84
 
@@ -53,12 +94,6 @@ end
53
94
 
54
95
  HTTP Basic authentication is used as a fallback when the block returns falsy.
55
96
 
56
- ## Requirements
57
-
58
- - Ruby >= 3.3
59
- - Rails >= 8.1.3
60
- - solid_queue >= 1.0
61
-
62
97
  ## Contributing
63
98
 
64
99
  Bug reports and pull requests are welcome on [GitHub](https://github.com/eclectic-coding/solid_queue_web).
@@ -4,6 +4,24 @@
4
4
 
5
5
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
6
6
 
7
+ .sqd-sr-only {
8
+ position: absolute;
9
+ width: 1px;
10
+ height: 1px;
11
+ padding: 0;
12
+ margin: -1px;
13
+ overflow: hidden;
14
+ clip: rect(0, 0, 0, 0);
15
+ white-space: nowrap;
16
+ border: 0;
17
+ }
18
+
19
+ :focus-visible {
20
+ outline: 2px solid var(--primary);
21
+ outline-offset: 2px;
22
+ border-radius: 2px;
23
+ }
24
+
7
25
  :root {
8
26
  --bg: #f8f9fa;
9
27
  --surface: #ffffff;
@@ -30,6 +48,11 @@ body {
30
48
  .sqd-header {
31
49
  background: var(--surface);
32
50
  border-bottom: 1px solid var(--border);
51
+ }
52
+
53
+ .sqd-header__inner {
54
+ max-width: 1200px;
55
+ margin: 0 auto;
33
56
  padding: 0 1.5rem;
34
57
  display: flex;
35
58
  align-items: center;
@@ -67,6 +90,28 @@ body {
67
90
  color: var(--text);
68
91
  }
69
92
 
93
+ .sqd-nav-toggle {
94
+ display: none;
95
+ flex-direction: column;
96
+ justify-content: center;
97
+ gap: 5px;
98
+ width: 36px;
99
+ height: 36px;
100
+ padding: 6px;
101
+ margin-left: auto;
102
+ background: none;
103
+ border: 1px solid var(--border);
104
+ border-radius: 5px;
105
+ cursor: pointer;
106
+ }
107
+
108
+ .sqd-nav-toggle span {
109
+ display: block;
110
+ height: 2px;
111
+ background: var(--text);
112
+ border-radius: 1px;
113
+ }
114
+
70
115
  .sqd-main {
71
116
  max-width: 1200px;
72
117
  margin: 0 auto;
@@ -104,7 +149,7 @@ body {
104
149
  /* Stat cards */
105
150
  .sqd-stats {
106
151
  display: grid;
107
- grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
152
+ grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
108
153
  gap: 1rem;
109
154
  margin-bottom: 2rem;
110
155
  }
@@ -138,6 +183,19 @@ body {
138
183
  .sqd-stat--blocked .sqd-stat__value { color: var(--warning); }
139
184
  .sqd-stat--queues .sqd-stat__value { color: var(--purple); }
140
185
  .sqd-stat--processes .sqd-stat__value { color: var(--muted); }
186
+ .sqd-stat--recurring .sqd-stat__value { color: var(--info); }
187
+
188
+ .sqd-stat--link {
189
+ display: block;
190
+ text-decoration: none;
191
+ color: inherit;
192
+ transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
193
+ }
194
+ .sqd-stat--link:hover {
195
+ border-color: var(--primary);
196
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
197
+ transform: translateY(-2px);
198
+ }
141
199
 
142
200
  /* Tables */
143
201
  .sqd-card {
@@ -210,6 +268,8 @@ tbody tr:hover { background: var(--bg); }
210
268
  .sqd-badge--claimed { background: #cfe2ff; color: #084298; }
211
269
  .sqd-badge--failed { background: #f8d7da; color: #842029; }
212
270
  .sqd-badge--blocked { background: #fff3cd; color: #664d03; }
271
+ .sqd-badge--static { background: #d1e7dd; color: #0f5132; }
272
+ .sqd-badge--dynamic { background: #e0d7f5; color: #4a2c8a; }
213
273
  .sqd-badge--paused { background: #e2e3e5; color: #41464b; }
214
274
  .sqd-badge--running { background: #d1e7dd; color: #0f5132; }
215
275
  .sqd-badge--supervisor { background: #e0d7f5; color: #4a2c8a; }
@@ -242,6 +302,36 @@ tbody tr:hover { background: var(--bg); }
242
302
  .sqd-row-actions { white-space: nowrap; text-align: right; width: 1%; }
243
303
  .sqd-row-actions form { display: inline; margin-left: 0.25rem; }
244
304
 
305
+ /* Search */
306
+ .sqd-search {
307
+ display: flex;
308
+ gap: 0.5rem;
309
+ align-items: center;
310
+ margin-bottom: 1rem;
311
+ }
312
+
313
+ .sqd-search__input {
314
+ width: 280px;
315
+ padding: 0.35rem 0.75rem;
316
+ border: 1px solid var(--border);
317
+ border-radius: 5px;
318
+ font-size: 13px;
319
+ background: var(--surface);
320
+ color: var(--text);
321
+ line-height: 1.5;
322
+ }
323
+
324
+ .sqd-search__input:focus {
325
+ outline: 2px solid var(--primary);
326
+ outline-offset: -1px;
327
+ border-color: var(--primary);
328
+ }
329
+
330
+ @media (max-width: 640px) {
331
+ .sqd-search { flex-wrap: wrap; }
332
+ .sqd-search__input { width: 100%; }
333
+ }
334
+
245
335
  /* Filters */
246
336
  .sqd-filters {
247
337
  display: flex;
@@ -332,8 +422,84 @@ nav.pagy a[aria-disabled="true"] { color: var(--muted); cursor: default; }
332
422
  gap: 1.5rem;
333
423
  }
334
424
 
425
+ .sqd-grid-2 {
426
+ display: grid;
427
+ grid-template-columns: 1fr 1fr;
428
+ gap: 1rem;
429
+ }
430
+
335
431
  @media (max-width: 768px) {
336
432
  .sqd-detail-grid { grid-template-columns: 1fr; }
433
+ .sqd-grid-2 { grid-template-columns: 1fr; }
434
+ }
435
+
436
+ @media (max-width: 640px) {
437
+ .sqd-main {
438
+ padding: 1.5rem 1rem;
439
+ }
440
+
441
+ .sqd-page-header {
442
+ flex-direction: column;
443
+ align-items: flex-start;
444
+ gap: 0.75rem;
445
+ }
446
+
447
+ .sqd-card {
448
+ overflow-x: auto;
449
+ }
450
+
451
+ .sqd-card__header {
452
+ flex-wrap: wrap;
453
+ }
454
+
455
+ .sqd-stats {
456
+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
457
+ }
458
+
459
+ .sqd-truncate {
460
+ max-width: 160px;
461
+ }
462
+ }
463
+
464
+ @media (max-width: 576px) {
465
+ .sqd-header {
466
+ position: relative;
467
+ }
468
+
469
+ .sqd-header__inner {
470
+ padding: 0 1rem;
471
+ }
472
+
473
+ .sqd-nav-toggle {
474
+ display: flex;
475
+ }
476
+
477
+ .sqd-nav-wrapper {
478
+ display: none;
479
+ position: absolute;
480
+ top: 100%;
481
+ left: 0;
482
+ right: 0;
483
+ background: var(--surface);
484
+ border-bottom: 1px solid var(--border);
485
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
486
+ z-index: 50;
487
+ padding: 0.5rem;
488
+ }
489
+
490
+ .sqd-nav-wrapper.sqd-nav--open {
491
+ display: block;
492
+ }
493
+
494
+ .sqd-nav {
495
+ flex-direction: column;
496
+ gap: 0.25rem;
497
+ }
498
+
499
+ .sqd-nav a {
500
+ padding: 0.5rem 0.75rem;
501
+ font-size: 14px;
502
+ }
337
503
  }
338
504
 
339
505
  .sqd-detail-section { padding: 1.25rem; }
@@ -8,7 +8,8 @@ module SolidQueueWeb
8
8
  failed: SolidQueue::FailedExecution.count,
9
9
  blocked: SolidQueue::BlockedExecution.count,
10
10
  queues: SolidQueue::Job.select(:queue_name).distinct.count,
11
- processes: SolidQueue::Process.count
11
+ processes: SolidQueue::Process.count,
12
+ recurring: SolidQueue::RecurringTask.count
12
13
  }
13
14
  end
14
15
  end
@@ -1,21 +1,24 @@
1
1
  module SolidQueueWeb
2
2
  class JobsController < ApplicationController
3
+ before_action :set_status_and_queue, only: [ :destroy, :discard_all ]
4
+
3
5
  STATUSES = %w[ready scheduled claimed blocked failed].freeze
4
6
  DISCARDABLE = %w[ready scheduled blocked].freeze
7
+ EXECUTION_MODELS = {
8
+ "ready" => SolidQueue::ReadyExecution,
9
+ "scheduled" => SolidQueue::ScheduledExecution,
10
+ "claimed" => SolidQueue::ClaimedExecution,
11
+ "blocked" => SolidQueue::BlockedExecution,
12
+ "failed" => SolidQueue::FailedExecution
13
+ }.freeze
5
14
 
6
15
  def index
7
16
  @status = params[:status].presence_in(STATUSES) || "ready"
8
17
  @queue = params[:queue].presence
9
-
10
- @jobs = case @status
11
- when "ready" then SolidQueue::ReadyExecution.includes(:job)
12
- when "scheduled" then SolidQueue::ScheduledExecution.includes(:job)
13
- when "claimed" then SolidQueue::ClaimedExecution.includes(:job)
14
- when "blocked" then SolidQueue::BlockedExecution.includes(:job)
15
- when "failed" then SolidQueue::FailedExecution.includes(:job)
16
- end
17
-
18
- @jobs = @jobs.where(jobs: { queue_name: @queue }) if @queue.present?
18
+ @search = params[:q].presence
19
+ @jobs = EXECUTION_MODELS[@status].includes(:job)
20
+ @jobs = @jobs.where(jobs: { queue_name: @queue }) if @queue.present?
21
+ @jobs = @jobs.references(:job).where("solid_queue_jobs.class_name LIKE ?", "%#{@search}%") if @search.present?
19
22
  @pagy, @jobs = pagy(@jobs.order(created_at: :desc))
20
23
  end
21
24
 
@@ -28,27 +31,30 @@ module SolidQueueWeb
28
31
  end
29
32
 
30
33
  def destroy
31
- execution = execution_model_for!(params[:status]).find(params[:id])
32
- execution.discard
33
- redirect_to jobs_path(status: params[:status], queue: params[:queue]), notice: "Job discarded."
34
+ model = execution_model_for!(@status)
35
+ @execution = model.find(params[:id])
36
+ @execution.discard
37
+ @remaining_count = filtered_scope(model).count
38
+ respond_to do |format|
39
+ format.turbo_stream
40
+ format.html { redirect_to jobs_path(status: @status, queue: @queue), notice: "Job discarded." }
41
+ end
34
42
  rescue ArgumentError => e
35
- redirect_to jobs_path(status: params[:status], queue: params[:queue]), alert: e.message
43
+ redirect_to jobs_path(status: @status, queue: @queue), alert: e.message
36
44
  rescue => e
37
- redirect_to jobs_path(status: params[:status], queue: params[:queue]), alert: "Could not discard job: #{e.message}"
45
+ redirect_to jobs_path(status: @status, queue: @queue), alert: "Could not discard job: #{e.message}"
38
46
  end
39
47
 
40
48
  def discard_all
41
- model = execution_model_for!(params[:status])
42
- scope = model.includes(:job)
43
- scope = scope.where(jobs: { queue_name: params[:queue] }) if params[:queue].present?
44
- jobs = scope.map(&:job)
49
+ model = execution_model_for!(@status)
50
+ jobs = filtered_scope(model).map(&:job)
45
51
  model.discard_all_from_jobs(jobs)
46
- redirect_to jobs_path(status: params[:status], queue: params[:queue]),
52
+ redirect_to jobs_path(status: @status, queue: @queue),
47
53
  notice: "#{jobs.size} #{"job".pluralize(jobs.size)} discarded."
48
54
  rescue ArgumentError => e
49
- redirect_to jobs_path(status: params[:status], queue: params[:queue]), alert: e.message
55
+ redirect_to jobs_path(status: @status, queue: @queue), alert: e.message
50
56
  rescue => e
51
- redirect_to jobs_path(status: params[:status], queue: params[:queue]), alert: "Could not discard jobs: #{e.message}"
57
+ redirect_to jobs_path(status: @status, queue: @queue), alert: "Could not discard jobs: #{e.message}"
52
58
  end
53
59
 
54
60
  private
@@ -62,13 +68,19 @@ module SolidQueueWeb
62
68
  "finished"
63
69
  end
64
70
 
71
+ def set_status_and_queue
72
+ @status = params[:status]
73
+ @queue = params[:queue].presence
74
+ end
75
+
76
+ def filtered_scope(model)
77
+ scope = model.includes(:job)
78
+ @queue.present? ? scope.where(jobs: { queue_name: @queue }) : scope
79
+ end
80
+
65
81
  def execution_model_for!(status)
66
- case status
67
- when "ready" then SolidQueue::ReadyExecution
68
- when "scheduled" then SolidQueue::ScheduledExecution
69
- when "blocked" then SolidQueue::BlockedExecution
70
- else raise ArgumentError, "Cannot discard #{status} jobs from this page."
71
- end
82
+ raise ArgumentError, "Cannot discard #{status} jobs from this page." unless DISCARDABLE.include?(status)
83
+ EXECUTION_MODELS[status]
72
84
  end
73
85
  end
74
86
  end
@@ -0,0 +1,7 @@
1
+ module SolidQueueWeb
2
+ class RecurringTasksController < ApplicationController
3
+ def index
4
+ @recurring_tasks = SolidQueue::RecurringTask.includes(:recurring_executions).order(:key)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ import "@hotwired/turbo"
2
+ import { Application } from "@hotwired/stimulus"
3
+ import SearchController from "solid_queue_web/search_controller"
4
+
5
+ const application = Application.start()
6
+ application.register("search", SearchController)
@@ -0,0 +1,11 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ filter({ target }) {
5
+ clearTimeout(this._timer)
6
+ const len = target.value.length
7
+ if (len >= 4 || len === 0) {
8
+ this._timer = setTimeout(() => target.form.requestSubmit(), 300)
9
+ }
10
+ }
11
+ }
@@ -7,28 +7,40 @@
7
7
  <%= csrf_meta_tags %>
8
8
  <%= csp_meta_tag %>
9
9
  <%= inline_styles %>
10
+ <%= javascript_importmap_tags "solid_queue_web" %>
10
11
  </head>
11
12
  <body>
12
13
 
13
14
  <header class="sqd-header">
14
- <%= link_to "Solid Queue", root_path, class: "sqd-header__title" %>
15
- <nav>
16
- <ul class="sqd-nav">
17
- <li><%= link_to "Dashboard", root_path, class: current_page?(root_path) ? "active" : "" %></li>
18
- <li><%= link_to "Queues", queues_path, class: current_page?(queues_path) ? "active" : "" %></li>
19
- <li><%= link_to "Jobs", jobs_path, class: current_page?(jobs_path) ? "active" : "" %></li>
20
- <li><%= link_to "Failed", failed_jobs_path, class: current_page?(failed_jobs_path) ? "active" : "" %></li>
21
- <li><%= link_to "Processes", processes_path, class: current_page?(processes_path) ? "active" : "" %></li>
22
- </ul>
23
- </nav>
15
+ <div class="sqd-header__inner">
16
+ <%= link_to "Solid Queue", root_path, class: "sqd-header__title" %>
17
+ <button class="sqd-nav-toggle" aria-label="Toggle navigation" aria-expanded="false"
18
+ onclick="var open=document.querySelector('.sqd-nav-wrapper').classList.toggle('sqd-nav--open');this.setAttribute('aria-expanded',open)">
19
+ <span></span>
20
+ <span></span>
21
+ <span></span>
22
+ </button>
23
+ <div class="sqd-nav-wrapper">
24
+ <nav aria-label="Main">
25
+ <ul class="sqd-nav">
26
+ <li><%= link_to "Dashboard", root_path, class: current_page?(root_path) ? "active" : "", aria: { current: current_page?(root_path) ? "page" : nil } %></li>
27
+ <li><%= link_to "Queues", queues_path, class: current_page?(queues_path) ? "active" : "", aria: { current: current_page?(queues_path) ? "page" : nil } %></li>
28
+ <li><%= link_to "Jobs", jobs_path, class: current_page?(jobs_path) ? "active" : "", aria: { current: current_page?(jobs_path) ? "page" : nil } %></li>
29
+ <li><%= link_to "Failed", failed_jobs_path, class: current_page?(failed_jobs_path) ? "active" : "", aria: { current: current_page?(failed_jobs_path) ? "page" : nil } %></li>
30
+ <li><%= link_to "Recurring", recurring_tasks_path, class: current_page?(recurring_tasks_path) ? "active" : "", aria: { current: current_page?(recurring_tasks_path) ? "page" : nil } %></li>
31
+ <li><%= link_to "Processes", processes_path, class: current_page?(processes_path) ? "active" : "", aria: { current: current_page?(processes_path) ? "page" : nil } %></li>
32
+ </ul>
33
+ </nav>
34
+ </div>
35
+ </div>
24
36
  </header>
25
37
 
26
38
  <main class="sqd-main">
27
39
  <% if notice.present? %>
28
- <div class="sqd-flash sqd-flash--notice"><%= notice %></div>
40
+ <div class="sqd-flash sqd-flash--notice" role="status"><%= notice %></div>
29
41
  <% end %>
30
42
  <% if alert.present? %>
31
- <div class="sqd-flash sqd-flash--alert"><%= alert %></div>
43
+ <div class="sqd-flash sqd-flash--alert" role="alert"><%= alert %></div>
32
44
  <% end %>
33
45
 
34
46
  <%= yield %>
@@ -1,34 +1,38 @@
1
1
  <h1 class="sqd-page-title">Dashboard</h1>
2
2
 
3
3
  <div class="sqd-stats">
4
- <div class="sqd-stat sqd-stat--ready">
4
+ <%= link_to jobs_path(status: "ready"), class: "sqd-stat sqd-stat--ready sqd-stat--link" do %>
5
5
  <div class="sqd-stat__value"><%= @stats[:ready] %></div>
6
6
  <div class="sqd-stat__label">Ready</div>
7
- </div>
8
- <div class="sqd-stat sqd-stat--scheduled">
7
+ <% end %>
8
+ <%= link_to jobs_path(status: "scheduled"), class: "sqd-stat sqd-stat--scheduled sqd-stat--link" do %>
9
9
  <div class="sqd-stat__value"><%= @stats[:scheduled] %></div>
10
10
  <div class="sqd-stat__label">Scheduled</div>
11
- </div>
12
- <div class="sqd-stat sqd-stat--claimed">
11
+ <% end %>
12
+ <%= link_to jobs_path(status: "claimed"), class: "sqd-stat sqd-stat--claimed sqd-stat--link" do %>
13
13
  <div class="sqd-stat__value"><%= @stats[:claimed] %></div>
14
14
  <div class="sqd-stat__label">Running</div>
15
- </div>
16
- <div class="sqd-stat sqd-stat--blocked">
15
+ <% end %>
16
+ <%= link_to jobs_path(status: "blocked"), class: "sqd-stat sqd-stat--blocked sqd-stat--link" do %>
17
17
  <div class="sqd-stat__value"><%= @stats[:blocked] %></div>
18
18
  <div class="sqd-stat__label">Blocked</div>
19
- </div>
20
- <div class="sqd-stat sqd-stat--failed">
19
+ <% end %>
20
+ <%= link_to failed_jobs_path, class: "sqd-stat sqd-stat--failed sqd-stat--link" do %>
21
21
  <div class="sqd-stat__value"><%= @stats[:failed] %></div>
22
22
  <div class="sqd-stat__label">Failed</div>
23
- </div>
24
- <div class="sqd-stat sqd-stat--queues">
23
+ <% end %>
24
+ <%= link_to queues_path, class: "sqd-stat sqd-stat--queues sqd-stat--link" do %>
25
25
  <div class="sqd-stat__value"><%= @stats[:queues] %></div>
26
26
  <div class="sqd-stat__label">Queues</div>
27
- </div>
28
- <div class="sqd-stat sqd-stat--processes">
27
+ <% end %>
28
+ <%= link_to recurring_tasks_path, class: "sqd-stat sqd-stat--recurring sqd-stat--link" do %>
29
+ <div class="sqd-stat__value"><%= @stats[:recurring] %></div>
30
+ <div class="sqd-stat__label">Recurring</div>
31
+ <% end %>
32
+ <%= link_to processes_path, class: "sqd-stat sqd-stat--processes sqd-stat--link" do %>
29
33
  <div class="sqd-stat__value"><%= @stats[:processes] %></div>
30
34
  <div class="sqd-stat__label">Processes</div>
31
- </div>
35
+ <% end %>
32
36
  </div>
33
37
 
34
38
  <div style="display:grid; grid-template-columns: 1fr 1fr; gap: 1rem;">
@@ -41,6 +45,7 @@
41
45
  <%= link_to "View scheduled jobs", jobs_path(status: "scheduled"), class: "sqd-btn sqd-btn--muted" %>
42
46
  <%= link_to "View failed jobs", failed_jobs_path, class: "sqd-btn sqd-btn--muted" %>
43
47
  <%= link_to "Manage queues", queues_path, class: "sqd-btn sqd-btn--muted" %>
48
+ <%= link_to "View recurring tasks", recurring_tasks_path, class: "sqd-btn sqd-btn--muted" %>
44
49
  </div>
45
50
  </div>
46
51
 
@@ -21,11 +21,11 @@
21
21
  <table>
22
22
  <thead>
23
23
  <tr>
24
- <th>Job Class</th>
25
- <th>Queue</th>
26
- <th>Error</th>
27
- <th>Failed At</th>
28
- <th></th>
24
+ <th scope="col">Job Class</th>
25
+ <th scope="col">Queue</th>
26
+ <th scope="col">Error</th>
27
+ <th scope="col">Failed At</th>
28
+ <th scope="col"><span class="sqd-sr-only">Actions</span></th>
29
29
  </tr>
30
30
  </thead>
31
31
  <tbody>
@@ -0,0 +1,9 @@
1
+ <% if @remaining_count == 0 %>
2
+ <%= turbo_stream.replace "jobs-list" do %>
3
+ <div class="sqd-card" id="jobs-list">
4
+ <div class="sqd-empty">No <%= @status %> jobs.</div>
5
+ </div>
6
+ <% end %>
7
+ <% else %>
8
+ <%= turbo_stream.remove "execution_#{@execution.id}" %>
9
+ <% end %>
@@ -1,7 +1,16 @@
1
+ <h1 class="sqd-page-title" style="margin-bottom: 1.5rem;">Jobs</h1>
2
+
3
+ <%= turbo_frame_tag "jobs-table", data: { turbo_action: "advance" } do %>
1
4
  <% discardable = SolidQueueWeb::JobsController::DISCARDABLE.include?(@status) %>
2
5
 
3
6
  <div class="sqd-page-header">
4
- <h1 class="sqd-page-title">Jobs</h1>
7
+ <div class="sqd-filters">
8
+ <%= link_to "Ready", jobs_path(status: "ready", queue: @queue, q: @search), class: @status == "ready" ? "active" : "" %>
9
+ <%= link_to "Scheduled", jobs_path(status: "scheduled", queue: @queue, q: @search), class: @status == "scheduled" ? "active" : "" %>
10
+ <%= link_to "Running", jobs_path(status: "claimed", queue: @queue, q: @search), class: @status == "claimed" ? "active" : "" %>
11
+ <%= link_to "Blocked", jobs_path(status: "blocked", queue: @queue, q: @search), class: @status == "blocked" ? "active" : "" %>
12
+ <%= link_to "Failed", jobs_path(status: "failed", queue: @queue, q: @search), class: @status == "failed" ? "active" : "" %>
13
+ </div>
5
14
  <% if discardable && @jobs.any? %>
6
15
  <div class="sqd-actions">
7
16
  <%= button_to "Discard All", discard_all_jobs_path,
@@ -13,33 +22,39 @@
13
22
  <% end %>
14
23
  </div>
15
24
 
16
- <div class="sqd-filters">
17
- <%= link_to "Ready", jobs_path(status: "ready", queue: @queue), class: @status == "ready" ? "active" : "" %>
18
- <%= link_to "Scheduled", jobs_path(status: "scheduled", queue: @queue), class: @status == "scheduled" ? "active" : "" %>
19
- <%= link_to "Running", jobs_path(status: "claimed", queue: @queue), class: @status == "claimed" ? "active" : "" %>
20
- <%= link_to "Blocked", jobs_path(status: "blocked", queue: @queue), class: @status == "blocked" ? "active" : "" %>
21
- <%= link_to "Failed", jobs_path(status: "failed", queue: @queue), class: @status == "failed" ? "active" : "" %>
22
- </div>
25
+ <form class="sqd-search" action="<%= jobs_path %>" method="get" data-controller="search">
26
+ <input type="hidden" name="status" value="<%= @status %>">
27
+ <% if @queue.present? %>
28
+ <input type="hidden" name="queue" value="<%= @queue %>">
29
+ <% end %>
30
+ <input class="sqd-search__input" type="search" name="q" value="<%= @search %>"
31
+ placeholder="Filter by job class…" autocomplete="off" aria-label="Filter by job class"
32
+ data-action="input->search#filter">
33
+ <button type="submit" class="sqd-btn sqd-btn--muted">Search</button>
34
+ <% if @search.present? %>
35
+ <%= link_to "Clear", jobs_path(status: @status, queue: @queue), class: "sqd-btn sqd-btn--muted" %>
36
+ <% end %>
37
+ </form>
23
38
 
24
- <div class="sqd-card">
39
+ <div class="sqd-card" id="jobs-list">
25
40
  <% if @jobs.empty? %>
26
41
  <div class="sqd-empty">No <%= @status %> jobs.</div>
27
42
  <% else %>
28
43
  <table>
29
44
  <thead>
30
45
  <tr>
31
- <th>Job Class</th>
32
- <th>Queue</th>
33
- <th>Priority</th>
34
- <th>Scheduled At</th>
35
- <th>Enqueued At</th>
36
- <% if discardable %><th></th><% end %>
46
+ <th scope="col">Job Class</th>
47
+ <th scope="col">Queue</th>
48
+ <th scope="col">Priority</th>
49
+ <th scope="col">Scheduled At</th>
50
+ <th scope="col">Enqueued At</th>
51
+ <% if discardable %><th scope="col"><span class="sqd-sr-only">Actions</span></th><% end %>
37
52
  </tr>
38
53
  </thead>
39
54
  <tbody>
40
55
  <% @jobs.each do |execution| %>
41
56
  <% job = execution.job %>
42
- <tr>
57
+ <tr id="execution_<%= execution.id %>">
43
58
  <td>
44
59
  <span class="sqd-badge sqd-badge--<%= @status %>"><%= @status %></span>
45
60
  <%= link_to job.class_name, job_path(job), style: "margin-left: 0.5rem;" %>
@@ -78,4 +93,5 @@
78
93
  Filtering by queue: <strong><%= @queue %></strong> &mdash;
79
94
  <%= link_to "Clear filter", jobs_path(status: @status) %>
80
95
  </p>
96
+ <% end %>
81
97
  <% end %>
@@ -7,13 +7,13 @@
7
7
  <table>
8
8
  <thead>
9
9
  <tr>
10
- <th>Kind</th>
11
- <th>Name</th>
12
- <th>PID</th>
13
- <th>Host</th>
14
- <th>Details</th>
15
- <th>Last Heartbeat</th>
16
- <th>Status</th>
10
+ <th scope="col">Kind</th>
11
+ <th scope="col">Name</th>
12
+ <th scope="col">PID</th>
13
+ <th scope="col">Host</th>
14
+ <th scope="col">Details</th>
15
+ <th scope="col">Last Heartbeat</th>
16
+ <th scope="col">Status</th>
17
17
  </tr>
18
18
  </thead>
19
19
  <tbody>
@@ -7,11 +7,11 @@
7
7
  <table>
8
8
  <thead>
9
9
  <tr>
10
- <th>Name</th>
11
- <th>Size</th>
12
- <th>Latency</th>
13
- <th>Status</th>
14
- <th></th>
10
+ <th scope="col">Name</th>
11
+ <th scope="col">Size</th>
12
+ <th scope="col">Latency</th>
13
+ <th scope="col">Status</th>
14
+ <th scope="col"><span class="sqd-sr-only">Actions</span></th>
15
15
  </tr>
16
16
  </thead>
17
17
  <tbody>
@@ -0,0 +1,68 @@
1
+ <h1 class="sqd-page-title">Recurring Tasks</h1>
2
+
3
+ <div class="sqd-card" style="margin-top: 1.5rem;">
4
+ <% if @recurring_tasks.empty? %>
5
+ <div class="sqd-empty">No recurring tasks configured.</div>
6
+ <% else %>
7
+ <table>
8
+ <thead>
9
+ <tr>
10
+ <th scope="col">Key</th>
11
+ <th scope="col">Schedule</th>
12
+ <th scope="col">Job / Command</th>
13
+ <th scope="col">Queue</th>
14
+ <th scope="col">Next Run</th>
15
+ <th scope="col">Last Run</th>
16
+ <th scope="col">Type</th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <% @recurring_tasks.each do |task| %>
21
+ <tr>
22
+ <td class="sqd-mono"><%= task.key %></td>
23
+ <td class="sqd-mono"><%= task.schedule %></td>
24
+ <td>
25
+ <% if task.class_name.present? %>
26
+ <%= task.class_name %>
27
+ <% if task.arguments.present? %>
28
+ <div class="sqd-muted-text sqd-mono" style="font-size: 11px;">
29
+ <%= task.arguments.inspect %>
30
+ </div>
31
+ <% end %>
32
+ <% else %>
33
+ <span class="sqd-mono sqd-muted-text"><%= task.command %></span>
34
+ <% end %>
35
+ <% if task.description.present? %>
36
+ <div class="sqd-muted-text" style="font-size: 12px; margin-top: 0.2rem;">
37
+ <%= task.description %>
38
+ </div>
39
+ <% end %>
40
+ </td>
41
+ <td class="sqd-mono"><%= task.queue_name.presence || "default" %></td>
42
+ <td class="sqd-mono">
43
+ <%
44
+ next_run = begin
45
+ task.next_time.strftime("%Y-%m-%d %H:%M %Z")
46
+ rescue
47
+ nil
48
+ end
49
+ %>
50
+ <%= next_run || "—" %>
51
+ </td>
52
+ <td class="sqd-mono">
53
+ <% last_run = task.last_enqueued_time %>
54
+ <%= last_run ? last_run.strftime("%Y-%m-%d %H:%M %Z") : "—" %>
55
+ </td>
56
+ <td>
57
+ <% if task.static? %>
58
+ <span class="sqd-badge sqd-badge--static">Static</span>
59
+ <% else %>
60
+ <span class="sqd-badge sqd-badge--dynamic">Dynamic</span>
61
+ <% end %>
62
+ </td>
63
+ </tr>
64
+ <% end %>
65
+ </tbody>
66
+ </table>
67
+ <% end %>
68
+ </div>
@@ -0,0 +1,2 @@
1
+ pin "solid_queue_web", to: "solid_queue_web/application.js"
2
+ pin "solid_queue_web/search_controller", to: "solid_queue_web/search_controller.js"
data/config/routes.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  SolidQueueWeb::Engine.routes.draw do
2
2
  root to: "dashboard#index"
3
3
 
4
+ resources :recurring_tasks, only: [ :index ]
4
5
  resources :processes, only: [ :index ]
5
6
  resources :queues, only: [ :index ], param: :name do
6
7
  member do
@@ -1,6 +1,7 @@
1
1
  require "solid_queue"
2
2
  require "pagy"
3
3
  require "pagy/toolbox/paginators/method"
4
+ require "turbo-rails"
4
5
 
5
6
  module SolidQueueWeb
6
7
  class Engine < ::Rails::Engine
@@ -8,6 +9,19 @@ module SolidQueueWeb
8
9
 
9
10
  config.i18n.load_path += Gem.find_files("pagy/locales/en.yml")
10
11
 
12
+ initializer "solid_queue_web.assets" do |app|
13
+ if app.config.respond_to?(:assets)
14
+ app.config.assets.paths << root.join("app/javascript")
15
+ end
16
+ end
17
+
18
+ initializer "solid_queue_web.importmap", before: "importmap" do |app|
19
+ if app.config.respond_to?(:importmap)
20
+ app.config.importmap.paths << root.join("config/importmap.rb")
21
+ app.config.importmap.cache_sweepers << root.join("app/javascript")
22
+ end
23
+ end
24
+
11
25
  initializer "solid_queue_web.pagy" do
12
26
  Pagy::OPTIONS[:limit] = 25
13
27
  end
@@ -1,3 +1,3 @@
1
1
  module SolidQueueWeb
2
- VERSION = "0.3.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "solid_queue_web/version"
2
+ require "importmap-rails"
2
3
  require "solid_queue_web/engine"
3
4
 
4
5
  module SolidQueueWeb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_queue_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuck Smith
@@ -51,6 +51,34 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '43.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: turbo-rails
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: importmap-rails
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '1.2'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.2'
54
82
  description: Mount SolidQueueWeb in any Rails app using Solid Queue to get a dashboard
55
83
  for your queues, jobs by status, failed executions, and job actions (retry, discard)
56
84
  — all without leaving your app.
@@ -70,16 +98,22 @@ files:
70
98
  - app/controllers/solid_queue_web/jobs_controller.rb
71
99
  - app/controllers/solid_queue_web/processes_controller.rb
72
100
  - app/controllers/solid_queue_web/queues_controller.rb
101
+ - app/controllers/solid_queue_web/recurring_tasks_controller.rb
73
102
  - app/helpers/solid_queue_web/application_helper.rb
103
+ - app/javascript/solid_queue_web/application.js
104
+ - app/javascript/solid_queue_web/search_controller.js
74
105
  - app/jobs/solid_queue_web/application_job.rb
75
106
  - app/models/solid_queue_web/application_record.rb
76
107
  - app/views/layouts/solid_queue_web/application.html.erb
77
108
  - app/views/solid_queue_web/dashboard/index.html.erb
78
109
  - app/views/solid_queue_web/failed_jobs/index.html.erb
110
+ - app/views/solid_queue_web/jobs/destroy.turbo_stream.erb
79
111
  - app/views/solid_queue_web/jobs/index.html.erb
80
112
  - app/views/solid_queue_web/jobs/show.html.erb
81
113
  - app/views/solid_queue_web/processes/index.html.erb
82
114
  - app/views/solid_queue_web/queues/index.html.erb
115
+ - app/views/solid_queue_web/recurring_tasks/index.html.erb
116
+ - config/importmap.rb
83
117
  - config/routes.rb
84
118
  - lib/solid_queue_web.rb
85
119
  - lib/solid_queue_web/engine.rb