Polish job tags with Sidekiq Pro filtering support

This commit is contained in:
Mike Perham 2019-09-23 14:52:15 -07:00
parent c428383523
commit 7864fdbeb3
9 changed files with 31 additions and 24 deletions

View File

@ -5,14 +5,15 @@
HEAD
---------
- Support ad-hoc job tags. You can tag your jobs with, for example, subdomain, tenant, country, locale, application,
version, user/client, "alpha/beta/pro/ent", types of jobs, teams/people responsible for jobs,
additional metadata, etc.
Tags are shown on different pages with job listings [fatkodima, #4280]
- Support ad-hoc job tags. You can tag your jobs with, e.g, subdomain, tenant, country,
locale, application, version, user/client, "alpha/beta/pro/ent", types of jobs,
teams/people responsible for jobs, additional metadata, etc.
Tags are shown on different pages with job listings. Sidekiq Pro users
can filter based on them [fatkodima, #4280]
```ruby
class MyWorker
include Sidekiq::Worker
sidekiq_options tags: ['foo', 'bar']
sidekiq_options tags: ['bank-ops', 'alpha']
...
end
```

View File

@ -115,6 +115,12 @@ module Sidekiq
end
end
def display_tags(job)
job.tags.map { |tag|
"<span class='jobtag label label-info'>#{::Rack::Utils.escape_html(tag)}</span>"
}.join(" ")
end
# mperham/sidekiq#3243
def unfiltered?
yield unless env["PATH_INFO"].start_with?("/filter/")

View File

@ -201,6 +201,15 @@ td form {
padding: 0;
}
.jobtag a {
color: white;
}
.jobtag a:hover {
color: white;
text-decoration: underline;
}
table .table-checkbox label {
height: 100%;
width: 100%;

View File

@ -14,12 +14,8 @@
<tr>
<th><%= t('Job') %></th>
<td>
<code>
<%= job.display_class %>
<% job.tags.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
</code>
<%= job.display_class %>
<%= display_tags(job) %>
</td>
</tr>
<tr>

View File

@ -89,9 +89,7 @@
</td>
<td>
<%= job.display_class %>
<% job.tags.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
<%= display_tags(job, nil) %>
</td>
<td>
<div class="args"><%= display_args(job.display_args) %></div>

View File

@ -44,9 +44,7 @@
</td>
<td>
<%= entry.display_class %>
<% entry.tags.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
<%= display_tags(entry, "morgue") %>
</td>
<td>
<div class="args"><%= display_args(entry.display_args) %></div>

View File

@ -29,9 +29,7 @@
<% end %>
<td>
<%= h(msg.display_class) %>
<% msg.tags.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
<%= display_tags(msg, nil) %>
</td>
<td>
<% a = msg.display_args %>

View File

@ -44,7 +44,10 @@
<td>
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
</td>
<td><%= entry.display_class %></td>
<td>
<%= entry.display_class %>
<%= display_tags(entry, "retries") %>
</td>
<td>
<div class="args"><%= display_args(entry.display_args) %></div>
</td>

View File

@ -40,9 +40,7 @@
</td>
<td>
<%= entry.display_class %>
<% entry.tags.each do |tag| %>
<span class="label label-info"><%= tag %></span>
<% end %>
<%= display_tags(entry, "scheduled") %>
</td>
<td>
<div class="args"><%= display_args(entry.display_args) %></div>