Sha256: 9427f12b4a859a26c0f5d7328a9fabd047202b023b248cd79ecf810666bdd445

Contents?: true

Size: 911 Bytes

Versions: 11

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Ui
      module Controllers
        # Active jobs (work) reporting controller
        class Jobs < Base
          # Lists jobs
          def index
            current_state = Models::ConsumersState.current!
            processes = Models::Processes.active(current_state)

            # Aggregate jobs and inject the process info into them for better reporting
            jobs_total = processes.flat_map do |process|
              process.jobs.map do |job|
                job.to_h[:process] = process
                job
              end
            end

            @jobs, last_page = Ui::Lib::Paginations::Paginators::Arrays.call(
              jobs_total,
              @params.current_page
            )

            paginate(@params.current_page, !last_page)

            respond
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-web-0.7.10 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.9 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.8 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.7 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.6 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.5 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.4 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.3 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.2 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.7.0 lib/karafka/web/ui/controllers/jobs.rb