mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Adjust API a bit, #5624
This commit is contained in:
parent
053303f405
commit
cc2a07d45e
3 changed files with 22 additions and 4 deletions
|
@ -6,6 +6,7 @@ HEAD
|
|||
----------
|
||||
|
||||
- Add BID link on job_info page if job is part of a Batch [#5623]
|
||||
- Allow custom extensions to add rows/links within the Job Details page [#5624]
|
||||
|
||||
7.0.1
|
||||
----------
|
||||
|
|
|
@ -12,6 +12,12 @@ class WebJob
|
|||
end
|
||||
end
|
||||
|
||||
class LogDisplayer
|
||||
def add_pair(job)
|
||||
yield "External Logs", "<a href='https://example.com/logs/#{job.jid}'>Logs for #{job.jid}</a>"
|
||||
end
|
||||
end
|
||||
|
||||
describe Sidekiq::Web do
|
||||
include Rack::Test::Methods
|
||||
|
||||
|
@ -271,10 +277,21 @@ describe Sidekiq::Web do
|
|||
assert_match(/HardJob/, last_response.body)
|
||||
end
|
||||
|
||||
it "displays custom job info" do
|
||||
Sidekiq::Web.custom_job_info_rows << LogDisplayer.new
|
||||
params = add_retry
|
||||
get "/retries/#{job_params(*params)}"
|
||||
assert_equal 200, last_response.status
|
||||
assert_match(/https:\/\/example.com\/logs\//, last_response.body)
|
||||
ensure
|
||||
Sidekiq::Web.custom_job_info_rows.clear
|
||||
end
|
||||
|
||||
it "can display a single retry" do
|
||||
params = add_retry
|
||||
get "/retries/0-shouldntexist"
|
||||
assert_equal 302, last_response.status
|
||||
|
||||
get "/retries/#{job_params(*params)}"
|
||||
assert_equal 200, last_response.status
|
||||
assert_match(/HardJob/, last_response.body)
|
||||
|
|
|
@ -92,11 +92,11 @@
|
|||
<td><%= relative_time(job.at) if job['retry_count'] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% Sidekiq::Web.custom_job_info_rows.each do |processor| %>
|
||||
<% if processor.show_row(job) %>
|
||||
<% Sidekiq::Web.custom_job_info_rows.each do |helper| %>
|
||||
<% helper.add_pair(job) do |name, value| %>
|
||||
<tr>
|
||||
<th><%= processor.row_name %></th>
|
||||
<td><%= processor.row_contents(job) %></td>
|
||||
<th><%= name %></th>
|
||||
<td><%= value %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Reference in a new issue