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/_job_info.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

90 lines
2.4 KiB
Text

<% job = locals[:job] %>
<header>
<h3><%= t('Job') %></h3>
</header>
<div class="table_container">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('Queue') %></th>
<td>
<a href="<%= root_path %>queues/<%= job.queue %>"><%= job.queue %></a>
</td>
</tr>
<tr>
<th><%= t('Job') %></th>
<td>
<code><%= job.display_class %></code>
</td>
</tr>
<tr>
<th><%= t('Arguments') %></th>
<td>
<code class="code-wrap">
<!-- We don't want to truncate any job arguments when viewing a single job's status page -->
<div class="args-extended"><%= display_args(job.display_args, nil) %></div>
</code>
</td>
</tr>
<tr>
<th>JID</th>
<td>
<code><%= job.jid %></code>
</td>
</tr>
<tr>
<th><%= t('CreatedAt') %></th>
<td><%= relative_time(job.created_at) %></td>
</tr>
<tr>
<th><%= t('Enqueued') %></th>
<td><%= (enqueued_at = job.enqueued_at) ? relative_time(enqueued_at) : t('NotYetEnqueued') %></td>
</tr>
<% unless retry_extra_items(job).empty? %>
<tr>
<th><%= t('Extras') %></th>
<td>
<code>
<%= retry_extra_items(job).inspect %>
</code>
</td>
</tr>
<% end %>
<% if locals[:type] == :retry %>
<% if job['retry_count'] && job['retry_count'] > 0 %>
<tr>
<th><%= t('RetryCount') %></th>
<td><%= job['retry_count'] %></td>
</tr>
<tr>
<th><%= t('LastRetry') %></th>
<td><%= relative_time(Time.at(job['retried_at'])) %></td>
</tr>
<% else %>
<tr>
<th><%= t('OriginallyFailed') %></th>
<td><%= relative_time(Time.at(job['failed_at'])) %></td>
</tr>
<% end %>
<tr>
<th><%= t('NextRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<% if locals[:type] == :scheduled %>
<tr>
<th><%= t('Scheduled') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<% if locals[:type] == :dead %>
<tr>
<th><%= t('LastRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>