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
Amadeus Folego 9ea167db16 Migrate Sidekiq::Web to a pure Rack application
Migrate Sidekiq::Web a pure Rack application to avoid sinatra as
dependency. rack-protection is still needed.

The application is mounted on top of Rack::Builder, mantaining all of
the previous http interface.

Rack apps being used:

- Rack::File to serve assets
- Rack::Session::Cookie, the secret can be configured via
  Sidekiq::Web.session_secret
- Rack::Protection, same as before when using sinatra
- Sidekiq::WebApplication, described below.

Sidekiq::WebApplication is a very simple rack application composed of a
Sidekiq::WebRouter and a Sidekiq::WebAction dispatcher. This terminology
was adopted to be able to mantain Sidekiq::Web as a Rack app.

The Router is heavily inspired on Rack::Router[0] (and in many parts
identical), however not being retrocompatible.

The Action is a wrapper to provide convenience, DRY code and maintain
the old interface.

I tried to mantain most of the old application structures so that
customizations and monkey-patches are easily adjustable or even
further work be done to enforce retrocompatibility.

Testing welcome!

0: https://github.com/pjb3/rack-router
2016-07-26 11:43:32 -03:00

71 lines
2.6 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">
<%= partial :paging, 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-white">
<thead>
<tr>
<th width="20px" class="table-checkbox">
<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 %></td>
<td>
<div class="args"><%= display_args(entry.display_args) %></div>
</td>
<td>
<div><%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %></div>
</td>
</tr>
<% end %>
</table>
</div>
<input class="btn btn-primary btn-xs pull-left" type="submit" name="retry" value="<%= t('RetryNow') %>" />
<input class="btn btn-danger btn-xs pull-left" type="submit" name="delete" value="<%= t('Delete') %>" />
</form>
<form action="<%= root_path %>morgue/all/delete" method="post">
<%= csrf_tag %>
<input class="btn btn-danger btn-xs pull-right" 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 btn-xs pull-right" type="submit" name="retry" value="<%= t('RetryAll') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
<% else %>
<div class="alert alert-success"><%= t('NoDeadJobsFound') %></div>
<% end %>