Class: RailsLiveDashboard::JobStatusBadgeComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/rails_live_dashboard/job_status_badge_component.rb

Constant Summary collapse

CLASSES =
{
  enqueued: 'bg-orange-50 text-orange-700 ring-orange-700/10',
  started: 'bg-blue-50 text-blue-700 ring-blue-700/10',
  performed: 'bg-green-50 text-green-700 ring-green-600/20',
  discarted: 'bg-red-50 text-red-800 ring-red-600/20'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(status) ⇒ JobStatusBadgeComponent

Returns a new instance of JobStatusBadgeComponent.



12
13
14
15
16
17
18
19
# File 'app/components/rails_live_dashboard/job_status_badge_component.rb', line 12

def initialize(status)
  super

  return if status.nil?

  @status = status.upcase
  @classes = CLASSES[status.downcase.to_sym]
end