Sha256: 23625ddbe92bafd1c73166475722ad97b25a762ece375d327b8ff328141d6567

Contents?: true

Size: 833 Bytes

Versions: 20

Compression:

Stored size: 833 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::State.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, @next_page = Ui::Lib::PaginateArray.new.call(
              jobs_total,
              @params.current_page
            )

            respond
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
karafka-web-0.6.3 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.6.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.6.0 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.5.2 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.5.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.5.0 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.4.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.4.0 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.3.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.3.0 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.5 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.4 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.3 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.2 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.2.0 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.1.3 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.1.2 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.1.1 lib/karafka/web/ui/controllers/jobs.rb
karafka-web-0.1.0 lib/karafka/web/ui/controllers/jobs.rb