Skip to content

Commit

Permalink
Merge pull request sidekiq#2349 from davydovanton/overflow-tables
Browse files Browse the repository at this point in the history
Create table containers with overflow is overlay
  • Loading branch information
mperham committed May 15, 2015
2 parents 562a858 + 17ee70f commit eb38086
Show file tree
Hide file tree
Showing 10 changed files with 349 additions and 323 deletions.
4 changes: 4 additions & 0 deletions web/assets/stylesheets/application.css
Expand Up @@ -165,6 +165,10 @@ header.row .pagination {
width: 100%;
}

.table_container {
overflow: overlay;
}

table.table-white {
background-color: #fff;
}
Expand Down
134 changes: 68 additions & 66 deletions web/views/_job_info.erb
Expand Up @@ -2,81 +2,83 @@
<h3><%= t('Job') %></h3>
</header>

<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('Enqueued') %></th>
<td><%= relative_time(job.enqueued_at) %></td>
</tr>
<% unless retry_extra_items(job).empty? %>
<div class="table_container">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('Extras') %></th>
<th><%= t('Queue') %></th>
<td>
<code>
<%= retry_extra_items(job).inspect %>
<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>
<% end %>
<% if type == :retry %>
<% if job['retry_count'] && job['retry_count'] > 0 %>
<tr>
<th>JID</th>
<td>
<code><%= job.jid %></code>
</td>
</tr>
<tr>
<th><%= t('Enqueued') %></th>
<td><%= relative_time(job.enqueued_at) %></td>
</tr>
<% unless retry_extra_items(job).empty? %>
<tr>
<th><%= t('RetryCount') %></th>
<td><%= job['retry_count'] %></td>
<th><%= t('Extras') %></th>
<td>
<code>
<%= retry_extra_items(job).inspect %>
</code>
</td>
</tr>
<% end %>
<% if 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('LastRetry') %></th>
<td><%= relative_time(Time.at(job['retried_at'])) %></td>
<th><%= t('NextRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% else %>
<% end %>
<% if type == :scheduled %>
<tr>
<th><%= t('OriginallyFailed') %></th>
<td><%= relative_time(Time.at(job['failed_at'])) %></td>
<th><%= t('Scheduled') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<tr>
<th><%= t('NextRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<% if type == :scheduled %>
<tr>
<th><%= t('Scheduled') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<% if type == :dead %>
<tr>
<th><%= t('LastRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
</tbody>
</table>
<% if type == :dead %>
<tr>
<th><%= t('LastRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
128 changes: 66 additions & 62 deletions web/views/busy.erb
Expand Up @@ -13,72 +13,76 @@
</div>
</div>

<table class="processes table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Name') %></th>
<th><%= t('Started') %></th>
<th><%= t('Threads') %></th>
<th><%= t('Busy') %></th>
<th>&nbsp;</th>
</thead>
<% processes.each do |process| %>
<tr>
<td width="50%">
<%= "#{process['hostname']}:#{process['pid']}" %>
<span class="label label-success"><%= process.tag %></span>
<% process.labels.each do |label| %>
<span class="label label-info"><%= label %></span>
<% end %>
<br>
<b><%= "#{t('Queues')}: " %></b>
<%= process['queues'] * ", " %>
</td>
<td><%= relative_time(Time.at(process['started_at'])) %></td>
<td><%= process['concurrency'] %></td>
<td><%= process['busy'] %></td>
<td>
<div class="btn-group pull-right">
<form method="POST">
<input type="hidden" name="identity" value="<%= process['identity'] %>"/>
<button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('Quiet') %></button>
<button class="btn btn-danger" type="submit" name="stop" value="1"><%= t('Stop') %></button>
</form>
</div>
</td>
</tr>
<% end %>
</table>
<div class="table_container">
<table class="processes table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Name') %></th>
<th><%= t('Started') %></th>
<th><%= t('Threads') %></th>
<th><%= t('Busy') %></th>
<th>&nbsp;</th>
</thead>
<% processes.each do |process| %>
<tr>
<td width="50%">
<%= "#{process['hostname']}:#{process['pid']}" %>
<span class="label label-success"><%= process.tag %></span>
<% process.labels.each do |label| %>
<span class="label label-info"><%= label %></span>
<% end %>
<br>
<b><%= "#{t('Queues')}: " %></b>
<%= process['queues'] * ", " %>
</td>
<td><%= relative_time(Time.at(process['started_at'])) %></td>
<td><%= process['concurrency'] %></td>
<td><%= process['busy'] %></td>
<td>
<div class="btn-group pull-right">
<form method="POST">
<input type="hidden" name="identity" value="<%= process['identity'] %>"/>
<button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('Quiet') %></button>
<button class="btn btn-danger" type="submit" name="stop" value="1"><%= t('Stop') %></button>
</form>
</div>
</td>
</tr>
<% end %>
</table>
</div>

<div class="row header">
<div class="col-sm-7">
<h3><%= t('Jobs') %></h3>
</div>
</div>

<table class="workers table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Process') %></th>
<th><%= t('TID') %></th>
<th><%= t('JID') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Job') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Started') %></th>
</thead>
<% workers.each do |process, thread, msg| %>
<% job = Sidekiq::Job.new(msg['payload']) %>
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td><%= job.jid %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
</td>
<td><%= job.display_class %></td>
<td>
<div class="args"><%= display_args(job.display_args) %></div>
</td>
<td><%= relative_time(Time.at(msg['run_at'])) %></td>
</tr>
<% end %>
</table>
<div class="table_container">
<table class="workers table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Process') %></th>
<th><%= t('TID') %></th>
<th><%= t('JID') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Job') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Started') %></th>
</thead>
<% workers.each do |process, thread, msg| %>
<% job = Sidekiq::Job.new(msg['payload']) %>
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td><%= job.jid %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
</td>
<td><%= job.display_class %></td>
<td>
<div class="args"><%= display_args(job.display_args) %></div>
</td>
<td><%= relative_time(Time.at(msg['run_at'])) %></td>
</tr>
<% end %>
</table>
</div>
39 changes: 21 additions & 18 deletions web/views/dead.erb
@@ -1,28 +1,31 @@
<%= erb :_job_info, :locals => {:job => @dead, :type => :dead} %>

<h3><%= t('Error') %></h3>
<table class="error table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('ErrorClass') %></th>
<td>
<code><%= @dead['error_class'] %></code>
</td>
</tr>
<tr>
<th><%= t('ErrorMessage') %></th>
<td><%= h(@dead['error_message']) %></td>
</tr>
<% if !@dead['error_backtrace'].nil? %>
<div class="table_container">
<table class="error table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('ErrorBacktrace') %></th>
<th><%= t('ErrorClass') %></th>
<td>
<code><%= @dead['error_backtrace'].join("<br/>") %></code>
<code><%= @dead['error_class'] %></code>
</td>
</tr>
<% end %>
</tbody>
</table>
<tr>
<th><%= t('ErrorMessage') %></th>
<td><%= h(@dead['error_message']) %></td>
</tr>
<% if !@dead['error_backtrace'].nil? %>
<tr>
<th><%= t('ErrorBacktrace') %></th>
<td>
<code><%= @dead['error_backtrace'].join("<br/>") %></code>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

<form class="form-horizontal" action="<%= root_path %>morgue/<%= job_params(@dead, @dead.score) %>" method="post">
<a class="btn btn-default" href="<%= root_path %>morgue"><%= t('GoBack') %></a>
<input class="btn btn-primary" type="submit" name="retry" value="<%= t('RetryNow') %>" />
Expand Down

0 comments on commit eb38086

Please sign in to comment.