Sha256: a278e2824da82509d290ab9109557e3a0df766cb161437222714735d4a2affe6

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

require 'marty/background_job/schedule_jobs_grid'

module Marty
  module BackgroundJob
    class ScheduleJobsDashboard < Marty::Form
      include Marty::Extras::Layout

      def configure(c)
        super
        c.items = [
          :schedule_jobs_grid,
          :schedule_jobs_warnings
        ]
      end

      def prepare_warnings
        djs = ::Marty::BackgroundJob::FetchMissingInScheduleCronJobs.call

        messages = djs.map do |dj|
          handler_str = dj.handler[/job_class.*\n/]
          job_class = handler_str.gsub('job_class:', '').strip

          "#{job_class} with cron #{dj.cron} is present " \
            'in delayed_jobs table, but is missing in the Dashboard.'
        end

        messages.join('<br>')
      end

      client_class do |c|
        c.header   = false
        c.defaults = { body_style: 'padding:0px' }
      end

      component :schedule_jobs_grid do |c|
        c.klass = Marty::BackgroundJob::ScheduleJobsGrid
        c.region = :north
        c.min_height = 500
      end

      component :schedule_jobs_warnings do |c|
        c.klass = Marty::Panel
        c.title = I18n.t('jobs.schedule_dashboard.warnings')
        c.html = prepare_warnings
        c.min_height = 200
      end

      def default_bbar
        []
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
marty-9.5.1 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-9.5.0 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-9.3.3 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-9.3.2 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-9.3.0 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-8.5.0 app/components/marty/background_job/schedule_jobs_dashboard.rb
marty-8.4.1 app/components/marty/background_job/schedule_jobs_dashboard.rb