From dfc4775044add4604fb198d9d2cb844a63a0f9f4 Mon Sep 17 00:00:00 2001 From: Felipe Date: Sun, 10 Nov 2024 22:31:36 -0300 Subject: [PATCH] make exclusive to solid_queue --- .../mission_control/jobs/adapter_features.rb | 6 ++- .../internal_api/navigation_controller.rb | 6 +++ .../mission_control/jobs/navigation_helper.rb | 9 ++-- .../mission_control/jobs/_navigation.html.erb | 43 ++++++++++++++----- .../jobs/_navigation_update.html.erb | 2 +- .../mission_control/jobs/application.html.erb | 18 ++++---- .../jobs/dashboard/index.html.erb | 5 +-- lib/active_job/queue_adapters/resque_ext.rb | 4 ++ lib/mission_control/jobs/adapter.rb | 4 ++ 9 files changed, 67 insertions(+), 30 deletions(-) diff --git a/app/controllers/concerns/mission_control/jobs/adapter_features.rb b/app/controllers/concerns/mission_control/jobs/adapter_features.rb index e4e09c72..fceea0d4 100644 --- a/app/controllers/concerns/mission_control/jobs/adapter_features.rb +++ b/app/controllers/concerns/mission_control/jobs/adapter_features.rb @@ -2,7 +2,7 @@ module MissionControl::Jobs::AdapterFeatures extend ActiveSupport::Concern included do - helper_method :supported_job_statuses, :queue_pausing_supported?, :workers_exposed?, :recurring_tasks_supported? + helper_method :supported_job_statuses, :queue_pausing_supported?, :workers_exposed?, :supports_dashboard?, :recurring_tasks_supported? end private @@ -21,4 +21,8 @@ def workers_exposed? def recurring_tasks_supported? MissionControl::Jobs::Current.server.queue_adapter.supports_recurring_tasks? end + + def supports_dashboard? + MissionControl::Jobs::Current.server.queue_adapter.supports_dashboard? + end end diff --git a/app/controllers/mission_control/jobs/internal_api/navigation_controller.rb b/app/controllers/mission_control/jobs/internal_api/navigation_controller.rb index 42b7e19f..c65be689 100644 --- a/app/controllers/mission_control/jobs/internal_api/navigation_controller.rb +++ b/app/controllers/mission_control/jobs/internal_api/navigation_controller.rb @@ -1,5 +1,11 @@ class MissionControl::Jobs::InternalApi::NavigationController < MissionControl::Jobs::ApplicationController + include ActionView::Helpers::NumberHelper + include MissionControl::Jobs::NavigationHelper + + def index + @navigation_sections = navigation_sections + render partial: "layouts/mission_control/jobs/navigation_update", locals: { section: params[:section].to_sym } diff --git a/app/helpers/mission_control/jobs/navigation_helper.rb b/app/helpers/mission_control/jobs/navigation_helper.rb index 65772e6e..9bb0f6f0 100644 --- a/app/helpers/mission_control/jobs/navigation_helper.rb +++ b/app/helpers/mission_control/jobs/navigation_helper.rb @@ -2,15 +2,18 @@ module MissionControl::Jobs::NavigationHelper attr_reader :page_title, :current_section def navigation_sections - { dashboard: [ "Dashboard", application_dashboard_index_path(@application) ] }.tap do |sections| - sections[:queues] = [ "Queues", application_queues_path(@application) ] + sections = { } + sections[:dashboard] = [ "Dashboard", application_dashboard_index_path(@application) ] if supports_dashboard? + + sections.tap do |sections| sections[:queues] = [ "Queues", application_queues_path(@application) ] supported_job_statuses.without(:pending).each do |status| - sections[navigation_section_for_status(status)] = [ "#{status.to_s.titleize} jobs (#{jobs_count_with_status(status)})", application_jobs_path(@application, status) ] + sections[navigation_section_for_status(status)] = [ "#{status.to_s.titleize} jobs (#{jobs_count_with_status(status)})", application_jobs_path(@application, status) ] end sections[:workers] = [ "Workers", application_workers_path(@application) ] if workers_exposed? + sections[:recurring_tasks] = [ "Recurring tasks", application_recurring_tasks_path(@application) ] if recurring_tasks_supported? end end diff --git a/app/views/layouts/mission_control/jobs/_navigation.html.erb b/app/views/layouts/mission_control/jobs/_navigation.html.erb index 2cc2df81..4acdf504 100644 --- a/app/views/layouts/mission_control/jobs/_navigation.html.erb +++ b/app/views/layouts/mission_control/jobs/_navigation.html.erb @@ -9,6 +9,10 @@ diff --git a/app/views/layouts/mission_control/jobs/_navigation_update.html.erb b/app/views/layouts/mission_control/jobs/_navigation_update.html.erb index d9e8a74d..4b8c01d8 100644 --- a/app/views/layouts/mission_control/jobs/_navigation_update.html.erb +++ b/app/views/layouts/mission_control/jobs/_navigation_update.html.erb @@ -1,5 +1,5 @@