Sha256: db3112d33ea7c130785ce3170344a66cb37513f124b630646a1a79840adedbbf

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

module RailsLiveDashboard
  module JobsHelper
    def job_history_icon(status)
      case status
      when 'enqueued'
        lucide_icon('list-start',
                    class: 'h-8 w-8 p-1.5 rounded-full flex items-center justify-center ring-1 ring-inset bg-orange-50 text-orange-700 ring-orange-700/10')
      when 'started'
        lucide_icon('list-video',
                    class: 'h-8 w-8 p-1.5 rounded-full flex items-center justify-center ring-1 ring-inset bg-blue-50 text-blue-700 ring-blue-700/10')
      when 'performed'
        lucide_icon('check',
                    class: 'h-8 w-8 p-1.5 rounded-full flex items-center justify-center ring-1 ring-inset bg-green-50 text-green-700 ring-green-700/10')
      when 'discarted'
        lucide_icon('trash',
                    class: 'h-8 w-8 p-1.5 rounded-full flex items-center justify-center ring-1 ring-inset bg-red-50 text-red-700 ring-red-700/10')
      else
        lucide_icon('refresh-cw',
                    class: 'h-8 w-8 p-1.5 rounded-full flex items-center justify-center ring-1 ring-inset bg-orange-50 text-orange-700 ring-orange-700/10')
      end
    end

    def job_duration_text(duration)
      return "#{duration} ms" if duration < 1000

      "#{(duration / 1000).round} s"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_live_dashboard-0.2.0 app/helpers/rails_live_dashboard/jobs_helper.rb