diff --git a/Gemfile.lock b/Gemfile.lock index 5dc6d79..73a6841 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,6 @@ PATH remote: . specs: solid_queue_dashboard (0.1.0) - pagy (>= 9.0) rails (>= 8.1.3) solid_queue (>= 1.0) @@ -145,10 +144,6 @@ GEM racc (~> 1.4) nokogiri (1.19.3-x86_64-linux-gnu) racc (~> 1.4) - pagy (43.5.4) - json - uri - yaml parallel (2.1.0) parser (3.3.11.1) ast (~> 2.4.1) @@ -289,7 +284,6 @@ GEM base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - yaml (0.4.0) zeitwerk (2.7.5) PLATFORMS @@ -354,7 +348,6 @@ CHECKSUMS nokogiri (1.19.3-aarch64-linux-gnu) sha256=46b89e5d7b9e844c2ee360794240c6ea2a4e6fa0c5892a4ed487db621224b639 nokogiri (1.19.3-arm64-darwin) sha256=71b9bd424b1b7abc18b05052a1a3cfd3627abdca62be280854cc411791357e42 nokogiri (1.19.3-x86_64-linux-gnu) sha256=2f5078620fe12e83669b5b17311b32532a8153d02eee7ad06948b926d6080976 - pagy (43.5.4) sha256=2bdf3fa6b1e0cac5bbafe5d077fb24eb971f72f3194f8c6863a0f3867261ce59 parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356 parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54 pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6 @@ -408,7 +401,6 @@ CHECKSUMS useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 websocket-driver (0.8.0) sha256=ed0dba4b943c22f17f9a734817e808bc84cdce6a7e22045f5315aa57676d4962 websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 - yaml (0.4.0) sha256=240e69d1e6ce3584d6085978719a0faa6218ae426e034d8f9b02fb54d3471942 zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/app/controllers/solid_queue_dashboard/application_controller.rb b/app/controllers/solid_queue_dashboard/application_controller.rb index 85c6a91..bb3bf52 100644 --- a/app/controllers/solid_queue_dashboard/application_controller.rb +++ b/app/controllers/solid_queue_dashboard/application_controller.rb @@ -1,7 +1,5 @@ module SolidQueueDashboard class ApplicationController < ActionController::Base - include Pagy::Method - before_action :authenticate! private diff --git a/app/controllers/solid_queue_dashboard/failed_jobs_controller.rb b/app/controllers/solid_queue_dashboard/failed_jobs_controller.rb index 49290f3..cc13a40 100644 --- a/app/controllers/solid_queue_dashboard/failed_jobs_controller.rb +++ b/app/controllers/solid_queue_dashboard/failed_jobs_controller.rb @@ -1,25 +1,10 @@ module SolidQueueDashboard class FailedJobsController < ApplicationController def index - scope = SolidQueue::FailedExecution.includes(:job).order(created_at: :desc) - @pagy, @failed_jobs = pagy(:offset, scope, limit: 50) - end - - def retry - execution = SolidQueue::FailedExecution.find(params[:id]) - execution.retry - redirect_to failed_jobs_path, notice: "Job queued for retry." - end - - def discard - execution = SolidQueue::FailedExecution.find(params[:id]) - execution.discard - redirect_to failed_jobs_path, notice: "Job discarded." - end - - def discard_all - SolidQueue::FailedExecution.discard_all_in_batches - redirect_to failed_jobs_path, notice: "All failed jobs discarded." + @failed_jobs = SolidQueue::FailedExecution + .includes(:job) + .order(created_at: :desc) + .limit(100) end end end diff --git a/app/controllers/solid_queue_dashboard/jobs_controller.rb b/app/controllers/solid_queue_dashboard/jobs_controller.rb index 2fef1dc..55a97a6 100644 --- a/app/controllers/solid_queue_dashboard/jobs_controller.rb +++ b/app/controllers/solid_queue_dashboard/jobs_controller.rb @@ -6,7 +6,7 @@ def index @status = params[:status].presence_in(STATUSES) || "ready" @queue = params[:queue].presence - scope = case @status + @jobs = case @status when "ready" then SolidQueue::ReadyExecution.includes(:job) when "scheduled" then SolidQueue::ScheduledExecution.includes(:job) when "claimed" then SolidQueue::ClaimedExecution.includes(:job) @@ -14,10 +14,8 @@ def index when "failed" then SolidQueue::FailedExecution.includes(:job) end - scope = scope.where(jobs: { queue_name: @queue }) if @queue.present? - scope = scope.order(created_at: :desc) - - @pagy, @jobs = pagy(:offset, scope, limit: 50) + @jobs = @jobs.where(jobs: { queue_name: @queue }) if @queue.present? + @jobs = @jobs.order(created_at: :desc).limit(100) end end end diff --git a/app/controllers/solid_queue_dashboard/queues_controller.rb b/app/controllers/solid_queue_dashboard/queues_controller.rb index 3c46204..ca522e4 100644 --- a/app/controllers/solid_queue_dashboard/queues_controller.rb +++ b/app/controllers/solid_queue_dashboard/queues_controller.rb @@ -1,20 +1,7 @@ module SolidQueueDashboard class QueuesController < ApplicationController def index - all_queues = SolidQueue::Queue.all.sort_by(&:name) - @pagy, @queues = pagy(:offset, all_queues, limit: 50) - end - - def pause - queue = SolidQueue::Queue.find_by_name(params[:id]) - queue.pause - redirect_to queues_path, notice: "Queue \"#{queue.name}\" paused." - end - - def resume - queue = SolidQueue::Queue.find_by_name(params[:id]) - queue.resume - redirect_to queues_path, notice: "Queue \"#{queue.name}\" resumed." + @queues = SolidQueue::Queue.all.sort_by(&:name) end end end diff --git a/app/views/solid_queue_dashboard/failed_jobs/index.html.erb b/app/views/solid_queue_dashboard/failed_jobs/index.html.erb index aef2ee3..8807dad 100644 --- a/app/views/solid_queue_dashboard/failed_jobs/index.html.erb +++ b/app/views/solid_queue_dashboard/failed_jobs/index.html.erb @@ -1,12 +1,4 @@ -
-

Failed Jobs

- <% if @failed_jobs.any? %> - <%= button_to "Discard All", discard_all_failed_jobs_path, - method: :delete, - data: { confirm: "Discard all failed jobs? This cannot be undone." }, - class: "sqd-btn sqd-btn--danger" %> - <% end %> -
+

Failed Jobs

<% if @failed_jobs.empty? %> @@ -19,7 +11,6 @@ Queue Error Failed At - @@ -38,19 +29,9 @@ <% end %> <%= execution.created_at.strftime("%Y-%m-%d %H:%M:%S") %> - - <%= button_to "Retry", retry_failed_job_path(execution), - method: :post, class: "sqd-btn sqd-btn--primary", - style: "margin-right: 0.25rem;" %> - <%= button_to "Discard", failed_job_path(execution), - method: :delete, - data: { confirm: "Discard this job?" }, - class: "sqd-btn sqd-btn--danger" %> - <% end %> - <%= raw @pagy.series_nav if @pagy.pages > 1 %> <% end %> -
+ \ No newline at end of file diff --git a/app/views/solid_queue_dashboard/jobs/index.html.erb b/app/views/solid_queue_dashboard/jobs/index.html.erb index 88d2b79..a544d22 100644 --- a/app/views/solid_queue_dashboard/jobs/index.html.erb +++ b/app/views/solid_queue_dashboard/jobs/index.html.erb @@ -43,7 +43,6 @@ <% end %> - <%= raw @pagy.series_nav if @pagy.pages > 1 %> <% end %> @@ -52,4 +51,4 @@ Filtering by queue: <%= @queue %> — <%= link_to "Clear filter", jobs_path(status: @status) %>

-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/solid_queue_dashboard/queues/index.html.erb b/app/views/solid_queue_dashboard/queues/index.html.erb index 6e6a2a2..4a74a88 100644 --- a/app/views/solid_queue_dashboard/queues/index.html.erb +++ b/app/views/solid_queue_dashboard/queues/index.html.erb @@ -11,7 +11,6 @@ Size Latency Status - @@ -27,19 +26,9 @@ Running <% end %> - - <% if queue.paused? %> - <%= button_to "Resume", resume_queue_path(queue.name), - method: :post, class: "sqd-btn sqd-btn--primary" %> - <% else %> - <%= button_to "Pause", pause_queue_path(queue.name), - method: :post, class: "sqd-btn sqd-btn--muted" %> - <% end %> - <% end %> - <%= raw @pagy.series_nav if @pagy.pages > 1 %> <% end %> - \ No newline at end of file + diff --git a/config/routes.rb b/config/routes.rb index bb6a914..2da5aa6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,22 +1,7 @@ SolidQueueDashboard::Engine.routes.draw do root to: "dashboard#index" - resources :queues, only: [ :index ] do - member do - post :pause - post :resume - end - end - - resources :jobs, only: [ :index ] - - resources :failed_jobs, only: [ :index ] do - member do - post :retry - delete :discard - end - collection do - delete :discard_all - end - end + resources :queues, only: [ :index ] + resources :jobs, only: [ :index ] + resources :failed_jobs, only: [ :index ] end diff --git a/lib/solid_queue_dashboard/engine.rb b/lib/solid_queue_dashboard/engine.rb index 9f1c6f6..87e5481 100644 --- a/lib/solid_queue_dashboard/engine.rb +++ b/lib/solid_queue_dashboard/engine.rb @@ -1,5 +1,3 @@ -require "pagy" -require "pagy/toolbox/paginators/method" require "solid_queue" module SolidQueueDashboard diff --git a/solid_queue_dashboard.gemspec b/solid_queue_dashboard.gemspec index 356db80..37cc570 100644 --- a/solid_queue_dashboard.gemspec +++ b/solid_queue_dashboard.gemspec @@ -27,5 +27,4 @@ Gem::Specification.new do |spec| spec.add_dependency "rails", ">= 8.1.3" spec.add_dependency "solid_queue", ">= 1.0" - spec.add_dependency "pagy", ">= 9.0" end