panoptic 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+
2
+ // This tells sprockets to link the build directory
3
+ //= This is how application get loaded through javascript tags
4
+
5
+ //= link_directory ../builds/panoptic
@@ -0,0 +1 @@
1
+ import "@hotwired/turbo-rails"
@@ -0,0 +1 @@
1
+ @import "bootstrap/scss/bootstrap";
@@ -13,5 +13,16 @@ module Panoptic
13
13
  def show
14
14
  @job = Panoptic::FailedJob.find(params[:id])
15
15
  end
16
+
17
+ def destroy
18
+ @job = Panoptic::FailedJob.find(params[:id])
19
+ if @job.destroy
20
+ redirect_back fallback_location: failed_jobs_path,
21
+ notice: "Job was successfully deleted."
22
+ else
23
+ redirect_back fallback_location: failed_jobs_path,
24
+ alert: @job.errors.full_messages.to_sentence
25
+ end
26
+ end
16
27
  end
17
28
  end
@@ -7,7 +7,7 @@ module Panoptic
7
7
  def index
8
8
  # TODO: use the `scheduled` scope available in SolidQueue next release
9
9
  @pagy, @jobs = pagy(
10
- SolidQueue::Job.joins(:scheduled_execution).order(created_at: :asc)
10
+ SolidQueue::Job.joins(:scheduled_execution).order(scheduled_at: :asc)
11
11
  )
12
12
 
13
13
  render "panoptic/jobs/index"
@@ -3,7 +3,7 @@
3
3
  module Panoptic
4
4
  class JobsController < ApplicationController
5
5
  def index
6
- @pagy, @jobs = pagy(SolidQueue::Job.order(created_at: :asc))
6
+ @pagy, @jobs = pagy(SolidQueue::Job.order(created_at: :desc))
7
7
  end
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Panoptic
4
4
  class FailedJob < SolidQueue::Job
5
5
  # TODO: use the `failed` scope available in SolidQueue next release
6
- default_scope { joins(:failed_execution) }
6
+ default_scope { includes(:failed_execution).where.not(failed_execution: { id: nil }) }
7
7
 
8
8
  def enqueued_at
9
9
  Time.parse(arguments["enqueued_at"])
@@ -5,17 +5,16 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
8
+ <%= stylesheet_link_tag "panoptic/application" %>
9
+ <%= javascript_include_tag "panoptic/application", defer: true %>
9
10
  </head>
10
11
  <body class="pb-4">
11
12
 
12
- <%= render "shared/navbar" %>
13
+ <%= render "panoptic/shared/navbar" %>
13
14
 
14
15
  <main class="container mt-2">
15
- <%= render "shared/flashes" %>
16
+ <%= render "panoptic/shared/flashes" %>
16
17
  <%= content_for?(:content) ? yield(:content) : yield %>
17
18
  </main>
18
-
19
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
20
19
  </body>
21
20
  </html>
@@ -9,5 +9,10 @@
9
9
  <%= button_to "Retry Job", job_retry_path(job),
10
10
  class: "btn btn-link",
11
11
  form_class: "d-inline" %>
12
+ <%= button_to "Delete Job", failed_job_path(job),
13
+ method: :delete,
14
+ form: { data: { turbo_confirm: "Are you sure you want delete?" } },
15
+ class: "btn btn-link text-danger",
16
+ form_class: "d-inline" %>
12
17
  </td>
13
18
  </tr>
@@ -0,0 +1,2 @@
1
+ pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
2
+ pin "@hotwired/turbo-rails", to: "turbo.min.js"
data/config/routes.rb CHANGED
@@ -7,8 +7,8 @@ Panoptic::Engine.routes.draw do
7
7
  resource :retry, only: :create, module: :jobs
8
8
  end
9
9
 
10
- scope module: :jobs do
10
+ scope :jobs, module: :jobs do
11
11
  resources :scheduled, only: :index, as: :scheduled_jobs
12
- resources :failed, only: [:index, :show], as: :failed_jobs
12
+ resources :failed, only: [:index, :show, :destroy], as: :failed_jobs
13
13
  end
14
14
  end
@@ -1,9 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "turbo-rails"
3
4
  require "pagy"
4
5
 
5
6
  module Panoptic
6
7
  class Engine < ::Rails::Engine
7
8
  isolate_namespace Panoptic
9
+
10
+ initializer "panoptic.assets.precompile" do |app|
11
+ app.config.assets.precompile += %w[panoptic_manifest.js]
12
+ end
8
13
  end
9
14
  end
@@ -1,3 +1,3 @@
1
1
  module Panoptic
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.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.4.1
4
+ version: 0.5.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: 2024-01-05 00:00:00.000000000 Z
11
+ date: 2024-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '6.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: turbo-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.5'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.5'
55
69
  description: Panoptic adds a real time web interface on top of SolidQueue to monitor
56
70
  processes, queues and jobs
57
71
  email:
@@ -60,8 +74,14 @@ executables: []
60
74
  extensions: []
61
75
  extra_rdoc_files: []
62
76
  files:
77
+ - LICENSE
63
78
  - README.md
64
79
  - Rakefile
80
+ - app/assets/builds/panoptic/application.css
81
+ - app/assets/builds/panoptic/application.js
82
+ - app/assets/config/panoptic_manifest.js
83
+ - app/assets/javascripts/panoptic/application.js
84
+ - app/assets/stylesheets/panoptic/application.scss
65
85
  - app/controllers/panoptic/application_controller.rb
66
86
  - app/controllers/panoptic/jobs/failed_controller.rb
67
87
  - app/controllers/panoptic/jobs/retries_controller.rb
@@ -87,8 +107,9 @@ files:
87
107
  - app/views/panoptic/processes/index.html.erb
88
108
  - app/views/panoptic/queues/_queue.html.erb
89
109
  - app/views/panoptic/queues/index.html.erb
90
- - app/views/shared/_flashes.html.erb
91
- - app/views/shared/_navbar.html.erb
110
+ - app/views/panoptic/shared/_flashes.html.erb
111
+ - app/views/panoptic/shared/_navbar.html.erb
112
+ - config/importmap.rb
92
113
  - config/initializers/pagy.rb
93
114
  - config/routes.rb
94
115
  - lib/panoptic.rb