sidekiq_monitor 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -122,6 +122,49 @@ The UI uses polling to update its data. By default, the polling interval is 3000
122
122
  Sidekiq::Monitor.options[:poll_interval] = 5000
123
123
  ```
124
124
 
125
+ ### UI Customization
126
+
127
+ #### Custom Statuses
128
+
129
+ The UI's status filter and histograms show the most common job statuses, but if you'd like to add additional statuses to them (for example, if you want to show "interrupted" jobs or have added custom statuses through middleware), you can make the UI include them like so:
130
+
131
+ ```ruby
132
+ # config/initializers/sidekiq_monitor.rb
133
+ Sidekiq::Monitor::Job.add_status('interrupted')
134
+ ```
135
+
136
+ #### Custom Job Views
137
+
138
+ When you click on a job, a modal showing its properties is displayed. You can add subviews to this modal by creating a view in your app and calling `Sidekiq::Monitor::CustomViews.add`, passing it the subview's title, the subview's filepath, and a block. The subview is only rendered if the block evaluates to true for the given job.
139
+
140
+ If you need to add JavaScript for the subview, you can do so by adding an asset path to `Sidekiq::Monitor.options[:javascripts]`.
141
+
142
+ For example, the following code adds a subview that shows a "Retry" button for jobs with the specified statuses:
143
+
144
+ ```ruby
145
+ # config/initializers/sidekiq_monitor.rb
146
+ view_path = Rails.root.join('app', 'views', 'sidekiq', 'monitor', 'retry').to_s
147
+ Sidekiq::Monitor::CustomViews.add('My View Title', view_path) do |job|
148
+ %w{complete failed}.include?(job.status)
149
+ end
150
+ Sidekiq::Monitor.options[:javascripts] << 'sidekiq/monitor/retry'
151
+ ```
152
+
153
+ ```
154
+ / app/views/sidekiq/monitor/retry.slim
155
+ a class='btn btn-success' href='#' data-action='retry_job' data-job-id=job.id = 'Retry'
156
+ ```
157
+
158
+ ```coffee
159
+ # app/assets/javascripts/sidekiq/monitor/retry.js.coffee
160
+ $ ->
161
+ $('body').on 'click', '.job-modal [data-action=retry_job]', (e) ->
162
+ id = $(e.target).attr('data-job-id')
163
+ $.get SidekiqMonitor.settings.api_url("jobs/retry/#{id}")
164
+ alert 'Job has been retried'
165
+ false
166
+ ```
167
+
125
168
  ### Authentication
126
169
 
127
170
  You'll likely want to restrict access to this interface in a production setting. To do this, you can use routing constraints:
@@ -1,6 +1,6 @@
1
1
  module Sidekiq
2
2
  module Monitor
3
- class JobsDatatable < AjaxDatatablesRails
3
+ class JobsDatatable < RailsDatatables
4
4
  include ActionView::Helpers::DateHelper
5
5
 
6
6
  @search_filters = []
@@ -1,6 +1,6 @@
1
1
  require 'slim'
2
2
  require 'jquery-datatables-rails'
3
- require 'ajax-datatables-rails'
3
+ require 'rails-datatables'
4
4
 
5
5
  directory = File.dirname(File.absolute_path(__FILE__))
6
6
  Dir.glob("#{directory}/monitor/**/*.rb") { |file| require file }
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Monitor
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-06 00:00:00.000000000 Z
12
+ date: 2014-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -60,7 +60,7 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: ajax-datatables-rails
63
+ name: rails-datatables
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements: