Sha256: 5e41d78c6621ba60c834f9acb85a62a53722ac51dd65b324f35d89c720e62d41

Contents?: true

Size: 1.49 KB

Versions: 14

Compression:

Stored size: 1.49 KB

Contents

module Marty
  module BackgroundJob
    class DelayedJobsGrid < Marty::Grid
      ACCESSIBLE_BY = [:admin]

      has_marty_permissions(
        read: ACCESSIBLE_BY,
        create: nil,
        update: nil,
        delete: nil,
        destroy: ACCESSIBLE_BY,
        job_run: ACCESSIBLE_BY,
        edit_window__edit_form__submit: ACCESSIBLE_BY,
        add_window__add_form__submit: ACCESSIBLE_BY
      )

      def configure(c)
        super

        c.title ||= I18n.t(
          'schedule_jobs_dashboard_view_title',
          default: 'Delayed Jobs Dashboard'
        )

        c.model = 'Delayed::Job'
        c.paging = :buffered
        c.editing = :in_form
        c.multi_select = false

        c.attributes = [
          :id,
          :handler,
          :run_at,
          :locked_at,
          :locked_by,
          :created_at,
          :cron,
          :last_error
        ]

        c.store_config.merge!(
          sorters: [
            { property: :locked_at, direction: 'DESC' },
            { property: :run_at, direction: 'DESC' }
          ])

        # c.scope = lambda do |r|
        # r.order('locked_at DESC NULLS LAST')
        # end
      end

      attribute :locked_at do |c|
        c.sorting_scope = lambda do |relation, dir|
          relation.order("locked_at #{dir} NULLS LAST")
        end
      end

      def default_context_menu
        []
      end

      def default_bbar
        []
      end

      attribute :cron do |c|
        c.width = 400
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
marty-14.3.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-14.0.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-13.0.2 app/components/marty/background_job/delayed_jobs_grid.rb
marty-11.0.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-10.0.3 app/components/marty/background_job/delayed_jobs_grid.rb
marty-10.0.2 app/components/marty/background_job/delayed_jobs_grid.rb
marty-10.0.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-9.5.1 app/components/marty/background_job/delayed_jobs_grid.rb
marty-9.5.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-9.3.3 app/components/marty/background_job/delayed_jobs_grid.rb
marty-9.3.2 app/components/marty/background_job/delayed_jobs_grid.rb
marty-9.3.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-8.5.0 app/components/marty/background_job/delayed_jobs_grid.rb
marty-8.4.1 app/components/marty/background_job/delayed_jobs_grid.rb