Sha256: 83796b4c3ce32a9a0ad629a796955800a349f2214ba6ccad3c7a251af2bf1259

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module ActiveAdminSidekiqStats

  class Panel

    def self.inject
      klass = new
      klass.inject!
    end

    def inject!
      html = Arbre::Context.new do
      panel "Sidekiq Stats" do
        begin
          sidekiq = JSON.parse(::Sidekiq::Stats.new.to_json)
          stats = sidekiq.fetch("stats", Hash.new)
            div style: "display: flex; justify-content: center; align-items: center" do
              stats.each do |process_name, process_value|
                div style: "display: flex; flex:1; justify-content: center; align-items: center; flex-direction: column" do
                  h1 process_value
                  span process_name.titleize
                end
              end
            end
        rescue Redis::CannotConnectError
          h1 "Redis Connection Failed"
        end
      end
    end
    html.to_s
  end

  private

  def container_style
    "display: flex; justify-content: center; align-items: center"
  end

  def item_style
    "flex:1; justify-content: center;"
  end


  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin_sidekiq_stats-0.1.2 lib/activeadmin_sidekiq_stats/panel.rb
activeadmin_sidekiq_stats-0.1.1 lib/activeadmin_sidekiq_stats/panel.rb