16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/sidekiqtui.rb', line 16
def run
configure
box = TTY::Box.frame(
width: TTY::Screen.width,
height: TTY::Screen.height,
title: { top_left: 'Scheduled Jobs', bottom_right: Sidekiqtui::VERSION }
) do
ss = Sidekiq::ScheduledSet.new
jobs = ss.map do |job|
[
"in #{time_ago_in_words(job.at)}",
job.queue,
job.item['class'],
job.args.join(', ')
]
end.reverse
table = TTY::Table.new(
%w[When Queue Job Arguments],
jobs
)
table.render(:unicode)
end
print box
end
|