1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

hide "Extras" row if there is nothing to show

This commit is contained in:
Rafael Souza 2013-05-30 13:24:57 -03:00
parent 1cb345114e
commit 94d1320e8e
2 changed files with 13 additions and 11 deletions

View file

@ -107,15 +107,16 @@ module Sidekiq
args.map { |arg| a = arg.inspect; a.size > count ? "#{a[0..count]}..." : a }.join(", ")
end
def display_extra_items(retry_job)
regular_keys = [
"queue", "class", "args", "retry_count", "retried_at", "failed_at",
"retry", "jid", "error_message", "error_class", "backtrace", "error_backtrace"
]
RETRY_JOB_KEYS = [
"queue", "class", "args", "retry_count", "retried_at", "failed_at",
"retry", "jid", "error_message", "error_class", "backtrace",
"error_backtrace", "unique", "enqueued_at"
]
{}.tap do |extra|
def retry_extra_items(retry_job)
@retry_extra_items ||= {}.tap do |extra|
retry_job.item.each do |key, value|
extra[key] = value unless regular_keys.include?(key)
extra[key] = value unless RETRY_JOB_KEYS.include?(key)
end
end
end

View file

@ -19,10 +19,11 @@ table class="retry table table-bordered table-striped"
th JID
td
code= @retry.jid
tr
th = t('Extras')
td
code= display_args(display_extra_items(@retry), 1000)
- unless retry_extra_items(@retry).empty?
tr
th = t('Extras')
td
code= display_args(retry_extra_items(@retry), 1000)
- if @retry['retry_count'] > 0
tr
th = t('RetryCount')