Sha256: 749e437228636b177ddeaef0b3b1130f989547bfb43670c1cd97943da8cafd68

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

module SolidQueueDashboard
  module ProcessesHelper
    def process_kind_circle(kind, options = {})
      options[:class] = [ "circle", process_kind_circle_class(kind), options[:class] ].compact_blank.join(" ")
      tag.span("", **options)
    end

    def process_kind_circle_class(kind)
      {
        "blue": "circle-blue",
        "green": "circle-green",
        "yellow": "circle-yellow",
        "purple": "circle-purple"
      }[Process::KIND_COLORS[kind]&.to_sym || :zinc]
    end

    def process_kind_badge(kind, options = {})
      options[:class] = [ "badge", process_kind_badge_class(kind), options[:class] ].compact_blank.join(" ")
      tag.span(kind.to_s.titleize, **options)
    end

    def process_kind_badge_class(kind)
      {
        "blue": "badge-blue",
        "green": "badge-green",
        "yellow": "badge-yellow",
        "purple": "badge-purple"
      }[Process::KIND_COLORS[kind]&.to_sym || :zinc]
    end

    def any_processes_filters?
      params[:kind].present? || params[:hostname].present?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solid_queue_dashboard-0.1.1 app/helpers/solid_queue_dashboard/processes_helper.rb
solid_queue_dashboard-0.1.0 app/helpers/solid_queue_dashboard/processes_helper.rb