Module: ResqueWeb::QueuesHelper
- Included in:
- OverviewHelper
- Defined in:
- app/helpers/resque_web/queues_helper.rb
Instance Method Summary collapse
- #failed_queue_class(queue_name) ⇒ Object
- #failed_queue_info(queue_name) ⇒ Object
- #failed_queue_name(original_queue_name) ⇒ Object
- #failed_queue_names ⇒ Object
- #failed_queue_size(queue_name) ⇒ Object
- #queue_end_at ⇒ Object
- #queue_jobs ⇒ Object
- #queue_names ⇒ Object
- #queue_per_page ⇒ Object
- #queue_size(queue_name = params[:id]) ⇒ Object
- #queue_start_at ⇒ Object
- #queues_partial_name ⇒ Object
Instance Method Details
#failed_queue_class(queue_name) ⇒ Object
49 50 51 |
# File 'app/helpers/resque_web/queues_helper.rb', line 49 def failed_queue_class(queue_name) Resque::Failure.count(queue_name).zero? ? "failed" : "failure" end |
#failed_queue_info(queue_name) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/helpers/resque_web/queues_helper.rb', line 57 def failed_queue_info(queue_name) failed_queue = failed_queue_name(queue_name) size = failed_queue_size(failed_queue) if size > 0 css_class = "badge badge-important" badge = link_to(size, failure_path(failed_queue)) else css_class = "badge" badge = size.to_s end raw "<span class=\"#{css_class}\">#{badge}</span>" end |
#failed_queue_name(original_queue_name) ⇒ Object
45 46 47 |
# File 'app/helpers/resque_web/queues_helper.rb', line 45 def failed_queue_name(original_queue_name) "#{original_queue_name}_failed" end |
#failed_queue_names ⇒ Object
41 42 43 |
# File 'app/helpers/resque_web/queues_helper.rb', line 41 def failed_queue_names Resque::Failure.queues.sort_by(&:to_s) end |
#failed_queue_size(queue_name) ⇒ Object
53 54 55 |
# File 'app/helpers/resque_web/queues_helper.rb', line 53 def failed_queue_size(queue_name) Resque::Failure.count(queue_name) end |
#queue_end_at ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/helpers/resque_web/queues_helper.rb', line 21 def queue_end_at if queue_start_at + queue_per_page > queue_size queue_size else queue_start_at + queue_per_page end end |
#queue_jobs ⇒ Object
37 38 39 |
# File 'app/helpers/resque_web/queues_helper.rb', line 37 def queue_jobs @queue_jobs ||= Resque.peek(params[:id], queue_start_at, queue_per_page) end |
#queue_names ⇒ Object
13 14 15 |
# File 'app/helpers/resque_web/queues_helper.rb', line 13 def queue_names Resque.queues.sort_by(&:to_s) end |
#queue_per_page ⇒ Object
29 30 31 |
# File 'app/helpers/resque_web/queues_helper.rb', line 29 def queue_per_page 20 end |
#queue_size(queue_name = params[:id]) ⇒ Object
33 34 35 |
# File 'app/helpers/resque_web/queues_helper.rb', line 33 def queue_size(queue_name = params[:id]) Resque.size queue_name end |
#queue_start_at ⇒ Object
17 18 19 |
# File 'app/helpers/resque_web/queues_helper.rb', line 17 def queue_start_at params[:start].to_i end |
#queues_partial_name ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/helpers/resque_web/queues_helper.rb', line 5 def queues_partial_name if Resque::Failure.backend == Resque::Failure::RedisMultiQueue 'resque_web/queues/queues_advanced' else 'resque_web/queues/queues_basic' end end |