panoptic 0.1.3 → 0.2.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: 92d310e17406ea0681469b5f4f4ff1d456b9d24ad4c89d4498adc87643f9ed8c
4
- data.tar.gz: 9e2faccbac6daf2820c63202adc28292918934e596462443b046be5d4b874c72
3
+ metadata.gz: 7765d548dafa03735d2dc25e0319bb04857aeaff9b4b8394eec1f1f524674eee
4
+ data.tar.gz: a2aa9f24af59985caff5c0d4650f474f727819d247964d54175da407fd5fd3dd
5
5
  SHA512:
6
- metadata.gz: b596a1d4224631ffb6f1e619958bbed94c20c4bfcb6c64fd967045efd40d785be72d2393b1317dc239866be6ba35952eebbf3eeac22e02cc270626475f325328
7
- data.tar.gz: b07d2227e30e712aedaeb5d1213991fba6cb5e467f67466795c3b1fd8d10a92e9fa5c9a98e86f6afc2a71bd2ac4de963c3a5de2a49a3f74494973c666227d4ba
6
+ metadata.gz: 0e65e09ed7d09a7e3543e03b04f7c6fb12536b37fab220ce4c5e9170cdcd94093f6dd8105c0f998ee9333817b6ea11372627708c412c9f088e22e1278a14a546
7
+ data.tar.gz: a5ad871749df301daf5e13561cfafe05ae5d1bc8f1a67030560f027c92c4ba4d962beb386ce44a2716411673100ff8c2c6f821b4d9be5d66c20ba932a72aa183
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Panoptic
2
- Short description and motivation.
3
2
 
4
- ## Usage
5
- How to use my plugin.
3
+ [![Gem Version](https://badge.fury.io/rb/panoptic.svg)](https://badge.fury.io/rb/panoptic)
4
+
5
+ Panoptic is a web interface for the [SolidQueue](https://github.com/basecamp/solid_queue) queuing backend.
6
+
7
+ ![](./images/demo.png)
8
+
9
+ While MissionControl is getting ready for release, this gem offers a visual interface for testing purposes with SolidQueue.
6
10
 
7
11
  ## Installation
8
12
  Add this line to your application's Gemfile:
@@ -11,18 +15,23 @@ Add this line to your application's Gemfile:
11
15
  gem "panoptic"
12
16
  ```
13
17
 
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
18
+ Then mount the engine in your `config/routes.rb` file
18
19
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install panoptic
20
+ ```ruby
21
+ mount Panoptic::Engine => "/panoptic"
22
22
  ```
23
23
 
24
- ## Contributing
25
- Contribution directions go here.
24
+ ## Usage
25
+
26
+ Once the gem is installed and the Engine mounted, visit your engine route to access Panoptic. For now, it offers three views:
27
+ - Processes
28
+ - Queues
29
+ - A first version of the jobs view
30
+
31
+ In the near future, the following features could be implemented:
32
+ - Pause and clear queues
33
+ - Advanced jobs view, with filters for executed, failed and scheduled jobs
34
+ - Search and retries
26
35
 
27
36
  ## License
28
37
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,4 +1,5 @@
1
1
  module Panoptic
2
2
  class ApplicationController < ActionController::Base
3
+ include Pagy::Backend
3
4
  end
4
5
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Panoptic
4
+ class Jobs::FailedController < ApplicationController
5
+ def index
6
+ # TODO: use the `failed` scope available in SolidQueue next release
7
+ @pagy, @jobs = pagy(
8
+ SolidQueue::Job.joins(:failed_execution).order(created_at: :asc)
9
+ )
10
+
11
+ render "panoptic/jobs/index"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Panoptic
4
+ class Jobs::ScheduledController < ApplicationController
5
+ def index
6
+ # TODO: use the `scheduled` scope available in SolidQueue next release
7
+ @pagy, @jobs = pagy(
8
+ SolidQueue::Job.joins(:scheduled_execution).order(created_at: :asc)
9
+ )
10
+
11
+ render "panoptic/jobs/index"
12
+ end
13
+ end
14
+ end
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Panoptic
4
4
  class JobsController < ApplicationController
5
- include Pagy::Backend
6
-
7
5
  def index
8
6
  @pagy, @jobs = pagy(SolidQueue::Job.order(created_at: :asc))
9
7
  end
@@ -1,5 +1,6 @@
1
1
  module Panoptic
2
2
  module ApplicationHelper
3
3
  include Pagy::Frontend
4
+ include DateTimeHelper
4
5
  end
5
6
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Panoptic
4
+ module DateTimeHelper
5
+ def safe_time_tag(date_or_time, *args, &block)
6
+ return "-" unless date_or_time
7
+
8
+ time_tag(date_or_time, *args, &block)
9
+ end
10
+ end
11
+ end
@@ -2,7 +2,6 @@
2
2
  <th scope="row"><%= job.id %></th>
3
3
  <td scope="col"><%= job.class_name %></td>
4
4
  <td scope="col"><%= job.queue_name %></td>
5
- <td scope="col"><%= job.arguments %></td>
6
- <td scope="col"><% job.scheduled_at %></td>
7
- <td scope="col"><% job.finished_at %></td>
5
+ <td scope="col"><%= safe_time_tag job.scheduled_at %></td>
6
+ <td scope="col"><%= safe_time_tag job.finished_at %></td>
8
7
  </tr>
@@ -1,5 +1,17 @@
1
1
  <h1>Jobs</h1>
2
2
 
3
+ <ul class="nav nav-underline">
4
+ <li class="nav-item">
5
+ <%= link_to "All", jobs_path, class: class_names("nav-link", "active": current_page?(jobs_path)) %>
6
+ </li>
7
+ <li class="nav-item">
8
+ <%= link_to "Scheduled", scheduled_jobs_path, class: class_names("nav-link", "active": current_page?(scheduled_jobs_path)) %>
9
+ </li>
10
+ <li class="nav-item">
11
+ <%= link_to "Failed", failed_jobs_path, class: class_names("nav-link", "active": current_page?(failed_jobs_path)) %>
12
+ </li>
13
+ </ul>
14
+
3
15
  <div class="d-flex justify-content-end">
4
16
  <%== pagy_info(@pagy) %>
5
17
  </div>
@@ -10,14 +22,13 @@
10
22
  <th scope="col">#</th>
11
23
  <th scope="col">Class</th>
12
24
  <th scope="col">Queue</th>
13
- <th scope="col">Arguments</th>
14
- <th scope="col">Scheduled at</th>
15
- <th scope="col">Finished at</th>
25
+ <th scope="col">Scheduled</th>
26
+ <th scope="col">Finished</th>
16
27
  </tr>
17
28
  </thead>
18
29
 
19
30
  <tbody>
20
- <%= render partial: "job", collection: @jobs %>
31
+ <%= render partial: "panoptic/jobs/job", collection: @jobs %>
21
32
  </tbody>
22
33
  </table>
23
34
 
data/config/routes.rb CHANGED
@@ -2,5 +2,13 @@ Panoptic::Engine.routes.draw do
2
2
  root to: "processes#index"
3
3
 
4
4
  resources :queues, only: [:index]
5
- resources :jobs, only: [:index]
5
+
6
+ scope "jobs" do
7
+ get "all", to: "jobs#index", as: "jobs"
8
+
9
+ scope module: "jobs" do
10
+ resources :scheduled, only: :index, as: :scheduled_jobs
11
+ resources :failed, only: :index, as: :failed_jobs
12
+ end
13
+ end
6
14
  end
@@ -1,3 +1,3 @@
1
1
  module Panoptic
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panoptic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Rolea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-28 00:00:00.000000000 Z
11
+ date: 2023-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -63,10 +63,13 @@ files:
63
63
  - README.md
64
64
  - Rakefile
65
65
  - app/controllers/panoptic/application_controller.rb
66
+ - app/controllers/panoptic/jobs/failed_controller.rb
67
+ - app/controllers/panoptic/jobs/scheduled_controller.rb
66
68
  - app/controllers/panoptic/jobs_controller.rb
67
69
  - app/controllers/panoptic/processes_controller.rb
68
70
  - app/controllers/panoptic/queues_controller.rb
69
71
  - app/helpers/panoptic/application_helper.rb
72
+ - app/helpers/panoptic/date_time_helper.rb
70
73
  - app/jobs/panoptic/application_job.rb
71
74
  - app/mailers/panoptic/application_mailer.rb
72
75
  - app/models/panoptic/application_record.rb