sidekiq-history 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e51068753b6e406f8d5378dcfb12b3040fd3d882
4
- data.tar.gz: 2e292dff38c5539fd951371066725e7e61f20d6a
3
+ metadata.gz: e711beba2411f9370535f25a55b155b4d0a8c9e3
4
+ data.tar.gz: 4faacedaa5eea21af2f434241a347204399e4d99
5
5
  SHA512:
6
- metadata.gz: a4f027d7d5249eadb4eb8a2107613ad76ee7e8f344850faa87533ea1ae767ae17674959f0f2f4ea2d9cd7ace61f2d3cd4ae073d7735d82669fbcf96d72f91192
7
- data.tar.gz: 97a01c870e647010866ac60b418bc4eb30b1b0b4267a0240dec08703bb4df37e2b10f6be87919ba202c344c9c63774040f6be8b39889fd5f7668b033aee22dd0
6
+ metadata.gz: e6683e24506da4e4ee7ee784a56a898efc1d168b1cad95cfc2ba8c6a30f9026c2c992dfb94bf3b6ea316205a0cdf49380cb340f3207649566786125b37abad9b
7
+ data.tar.gz: f999ee580abacebe22811b5b057eb6cb1c84a5c92977d0b44c35f10612728342da7e8ce7a167863575f296ad1668fe41149aed25fa50b635ac786915e7dc4d26
data/README.md CHANGED
@@ -18,7 +18,11 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Nothing left to do. Mount sidekiq, and go to the web interface. You'll see a shiny new History tab!
22
+
23
+ ## Screenshot
24
+
25
+ ![Web UI](https://github.com/russ/sidekiq-history/raw/master/examples/screenshot.png)
22
26
 
23
27
  ## Contributing
24
28
 
Binary file
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module History
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -1,21 +1,23 @@
1
1
  module Sidekiq
2
2
  module History
3
3
  module WebExtension
4
+ ROOT = File.expand_path('../../../../web', __FILE__)
5
+
4
6
  def self.registered(app)
5
7
  app.get '/history' do
6
- view_path = File.join(File.expand_path('..', __FILE__), 'views')
7
-
8
8
  @count = (params[:count] || 25).to_i
9
9
  (@current_page, @total_size, @messages) = page('history', params[:page], @count)
10
- @messages = @messages.map { |msg| Sidekiq.load_json(msg) }
10
+ @messages = @messages.map { |msg, score| Sidekiq::SortedEntry.new(nil, score, msg) }
11
11
 
12
- render(:erb, File.read(File.join(view_path, 'history.erb')))
12
+ render(:erb, File.read("#{ROOT}/views/history.erb"))
13
13
  end
14
14
 
15
15
  app.post "/history/remove" do
16
16
  Sidekiq::History.reset_history(counter: params['counter'])
17
17
  redirect("#{root_path}history")
18
18
  end
19
+
20
+ app.settings.locales << File.expand_path('locales', ROOT)
19
21
  end
20
22
  end
21
23
  end
@@ -0,0 +1,4 @@
1
+ en:
2
+ History: History
3
+ ResetHistoryCounter: reset history counter
4
+ NoJobsFound: No jobs found
@@ -0,0 +1,52 @@
1
+ <header class="row">
2
+ <div class="col-sm-5">
3
+ <h3><%= t('History') %></h3>
4
+ </div>
5
+ <% if @messages.size > 0 && @total_size > @count %>
6
+ <div class="col-sm-4">
7
+ <%= erb :_paging, :locals => { :url => "#{root_path}history" } %>
8
+ </div>
9
+ <% end %>
10
+ </header>
11
+
12
+ <% if @messages.size > 0 %>
13
+ <table class="table table-striped table-bordered table-white">
14
+ <thead>
15
+ <th><%= t('Started') %></th>
16
+ <th><%= t('Queue') %></th>
17
+ <th><%= t('Job') %></th>
18
+ <th><%= t('Arguments') %></th>
19
+ <th><%= t('Process') %></th>
20
+ </thead>
21
+ <% @messages.each do |entry| %>
22
+ <tr>
23
+ <td>
24
+ <%= relative_time(Time.parse(entry['started_at'])) %>
25
+ </td>
26
+ <td><%= entry.queue %></td>
27
+ <td>
28
+ <%= entry['payload']['class'] %>
29
+ </td>
30
+ <td>
31
+ <div class="args"><%= display_args(entry['payload']['args']) %></div>
32
+ </td>
33
+ <td>
34
+ <%= entry['processor'] %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </table>
39
+ <div class="row">
40
+ <div class="col-sm-5">
41
+ <form class="form-inline" action="<%= "#{root_path}history/remove" %>" method="post" style="margin: 20px 0">
42
+ <input class="btn btn-danger btn-xs" type="submit" name="delete" value="Clear All" />
43
+ <label class="checkbox">
44
+ <input type="checkbox" name="counter" value="true" />
45
+ <%= t('ResetHistoryCounter') %>
46
+ </label>
47
+ </form>
48
+ </div>
49
+ </div>
50
+ <% else %>
51
+ <div class="alert alert-success"><%= t('NoJobsFound') %></div>
52
+ <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russ Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -106,12 +106,14 @@ files:
106
106
  - LICENSE.txt
107
107
  - README.md
108
108
  - Rakefile
109
+ - examples/screenshot.png
109
110
  - lib/sidekiq/history.rb
110
111
  - lib/sidekiq/history/middleware.rb
111
112
  - lib/sidekiq/history/version.rb
112
- - lib/sidekiq/history/views/history.erb
113
113
  - lib/sidekiq/history/web_extension.rb
114
114
  - sidekiq-history.gemspec
115
+ - web/locales/en.yml
116
+ - web/views/history.erb
115
117
  homepage: ''
116
118
  licenses:
117
119
  - MIT
@@ -132,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  version: '0'
133
135
  requirements: []
134
136
  rubyforge_project:
135
- rubygems_version: 2.2.0
137
+ rubygems_version: 2.4.5
136
138
  signing_key:
137
139
  specification_version: 4
138
140
  summary: History for sidekiq jobs.
139
141
  test_files: []
140
- has_rdoc:
@@ -1,50 +0,0 @@
1
- <header class="row">
2
- <div class="span5">
3
- <h3>History</h3>
4
- </div>
5
- <div class="span4">
6
- <% if @messages.size > 0 %>
7
- <%= erb :_paging, :locals => { :url => "#{root_path}history#@name" } %>
8
- <% end %>
9
- </div>
10
- </header>
11
-
12
- <% if @messages.size > 0 %>
13
- <table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;">
14
- <thead>
15
- <th style="width: 25%">Worker, Args</th>
16
- <th style="width: 10%">Queue</th>
17
- <th style="width: 15%">Started At</th>
18
- <th style="width: 50%">Processor</th>
19
- </thead>
20
- <% @messages.each do |msg| %>
21
- <tr>
22
- <td style="overflow: hidden; text-overflow: ellipsis;">
23
- <%= msg['worker'] %>
24
- <br />
25
- <%= msg['payload']['args'].inspect[0..100] %>
26
- </td>
27
- <td><%= msg['queue'] %></td>
28
- <td>
29
- <%= relative_time(Time.parse(msg['started_at'])) %>
30
- </td>
31
- <td style="overflow: auto; padding: 10px;">
32
- Processor: <%= msg['processor'] %>
33
- </td>
34
- </tr>
35
- <% end %>
36
- </table>
37
- <div class="row">
38
- <div class="span5">
39
- <form class="form-inline" action="<%= "#{root_path}history/remove" %>" method="post" style="margin: 20px 0">
40
- <input class="btn btn-danger btn-small" type="submit" name="delete" value="Clear All" />
41
- <label class="checkbox">
42
- <input type="checkbox" name="counter" value="true" />
43
- reset history counter
44
- </label>
45
- </form>
46
- </div>
47
- </div>
48
- <% else %>
49
- <div class="alert alert-success">No jobs found.</div>
50
- <% end %>