1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/web/views/morgue.erb
Kelly Sutton 461ef8392f
Fix a Sidekiq Pro tagging bug (#4933)
Issue: Tags on morgue classes do not properly apply filters when clicked. They redirect to a route that Sidekiq does not service.

Steps to reproduce:
0. Create an app running Sidekiq.
0. Kill a job with a tag.
0. Click on the tag in the web UI.
0. Observe that the tag does not redirect to a route serviced by Sidekiq Rack app. Depending on how host app is configured, route will 404, redirect, or do something else as it falls through.

Root cause:
- It looks like Sidekiq Pro mounts the routes `/filter/dead` but the `display_tags` method links to `/filter/morgue`.

Notes:
- There might be other ways of fixing this problem, like change the `/filter/dead` to `/filter/morgue`. 

Let me know if there's any other info needed or test cases we can provide!
2021-06-22 16:24:31 -07:00

78 lines
2.8 KiB
Text

<header class="row">
<div class="col-sm-5">
<h3><%= t('DeadJobs') %></h3>
</div>
<% if @dead.size > 0 && @total_size > @count %>
<div class="col-sm-4">
<%= erb :_paging, locals: { url: "#{root_path}morgue" } %>
</div>
<% end %>
<%= filtering('dead') %>
</header>
<% if @dead.size > 0 %>
<form action="<%= root_path %>morgue" method="post">
<%= csrf_tag %>
<div class="table_container">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="table-checkbox checkbox-column">
<label>
<input type="checkbox" class="check_all" />
</label>
</th>
<th><%= t('LastRetry') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Job') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Error') %></th>
</tr>
</thead>
<% @dead.each do |entry| %>
<tr>
<td class="table-checkbox">
<label>
<input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
</label>
</td>
<td>
<a href="<%= root_path %>morgue/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
</td>
<td>
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
</td>
<td>
<%= entry.display_class %>
<%= display_tags(entry, "dead") %>
</td>
<td>
<div class="args"><%= display_args(entry.display_args) %></div>
</td>
<td>
<% if entry.error? %>
<div><%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %></div>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<input class="btn btn-primary pull-left flip" type="submit" name="retry" value="<%= t('RetryNow') %>" />
<input class="btn btn-danger pull-left flip" type="submit" name="delete" value="<%= t('Delete') %>" />
</form>
<% unfiltered? do %>
<form action="<%= root_path %>morgue/all/delete" method="post">
<%= csrf_tag %>
<input class="btn btn-danger pull-right flip" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
<form action="<%= root_path %>morgue/all/retry" method="post">
<%= csrf_tag %>
<input class="btn btn-danger pull-right flip" type="submit" name="retry" value="<%= t('RetryAll') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
<% end %>
<% else %>
<div class="alert alert-success"><%= t('NoDeadJobsFound') %></div>
<% end %>