mcmire-delayed_job_web 1.1.3.rc3 → 1.1.3.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,8 @@
1
- About this Fork
1
+ About This Fork
2
2
  ===============
3
3
 
4
- This fork by [@mcmire][2] adds Rails 2.x support, and also removes the
5
- "enqueued" tab from the UI (because I didn't see a need for it). I also updated
6
- the README below.
4
+ This fork by [@mcmire][2] adds Rails 2.x support, and also repurposes the
5
+ "enqueued" tab as an "all jobs" tab. I also updated the README below.
7
6
 
8
7
  ---
9
8
 
@@ -15,33 +14,33 @@ written to work with Rails 2 and 3 applications using activerecord.
15
14
 
16
15
  Some features:
17
16
 
18
- * Easily view pending, working, and failed jobs.
17
+ * Easily view pending, working, failed, and all jobs.
19
18
  * Queue any single job, or all pending jobs, to run immediately.
20
19
  * Remove a failed job, or easily remove all failed jobs.
21
20
 
22
21
  Quick Start For Rails 3 Applications
23
22
  ------------------------------------
24
23
 
25
- Add the dependency to your Gemfile
24
+ Add the dependency to your Gemfile:
26
25
 
27
26
  ```ruby
28
27
  gem "delayed_job_web"
29
28
  ```
30
29
 
31
- Install it...
30
+ Install it:
32
31
 
33
32
  ```ruby
34
33
  bundle
35
34
  ```
36
35
 
37
- Add a route to your application for accessing the interface
36
+ Add a route to your application for accessing the interface:
38
37
 
39
38
  ```ruby
40
- match "/delayed_job" => DelayedJobWeb, :anchor => false
39
+ mount DelayedJobWeb => '/delayed_job'
41
40
  ```
42
41
 
43
- You probably want to password protect the interface, an easy way is to add
44
- something like this your config.ru file
42
+ Finally, you'll probably want to password-protect the interface. An easy way to
43
+ do this is to add something like this to your config.ru file:
45
44
 
46
45
  ```ruby
47
46
  if Rails.env.production?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3.rc3
1
+ 1.1.3.rc4
@@ -96,6 +96,11 @@ class DelayedJobWeb < Sinatra::Base
96
96
  redirect back
97
97
  end
98
98
 
99
+ post "/clear" do
100
+ remove_jobs
101
+ redirect back
102
+ end
103
+
99
104
  def find_all_jobs(type, opts={})
100
105
  conditions = delayed_job_sql(type)
101
106
  if Rails.version.to_s =~ /^2/
@@ -133,8 +138,12 @@ class DelayedJobWeb < Sinatra::Base
133
138
  find_job(id).delete
134
139
  end
135
140
 
136
- def remove_jobs(type)
137
- delayed_job.destroy_all(delayed_job_sql(type))
141
+ def remove_jobs(type=nil)
142
+ if type
143
+ delayed_job.destroy_all(delayed_job_sql(type))
144
+ else
145
+ delayed_job.destroy_all
146
+ end
138
147
  end
139
148
 
140
149
  def requeue_failed_jobs
@@ -61,4 +61,8 @@ $(function() {
61
61
 
62
62
  return false
63
63
  })
64
+
65
+ $('.btn.confirm').click(function() {
66
+ return window.confirm($(this).data('message'));
67
+ })
64
68
  })
@@ -1,5 +1,7 @@
1
- %h1
2
- All Jobs
1
+ %h1 All Jobs
2
+ - if @jobs.any?
3
+ %form{:method => 'POST', :action => u('clear')}
4
+ %input{:type => 'submit', :value => 'Clear All Jobs', :class => 'btn confirm', :'data-message' => 'Are you sure you want to clear all jobs? This cannot be undone.'}
3
5
  %p.sub
4
6
  The list below contains all jobs which are in the delayed_jobs table.
5
7
  %p.sub
@@ -1,7 +1,7 @@
1
1
  %h1 Failed Jobs
2
2
  - if @jobs.any?
3
3
  %form{:method => 'POST', :action => u('failed/clear')}
4
- %input{:type => 'submit', :value => 'Clear Failed Jobs'}
4
+ %input{:type => 'submit', :value => 'Clear Failed Jobs', :class => 'btn confirm', :'data-message' => 'Are you sure you want to clear all failed jobs? This cannot be undone.'}
5
5
  %form{:method => 'POST', :action => u('requeue/all')}
6
6
  %input{:type => 'submit', :value => 'Retry Failed Jobs'}
7
7
 
@@ -2,9 +2,9 @@
2
2
  Pending
3
3
  - if @jobs.any?
4
4
  %form{:method => 'POST', :action => u('requeue/all')}
5
- %input{:type => 'submit', :value => 'Enqueue All Immediately'}
5
+ %input{:type => 'submit', :value => 'Re-enqueue Pending Jobs'}
6
6
  %p.sub
7
- The list below contains jobs which are waiting to be processed.
7
+ The list below contains jobs which are waiting to be run.
8
8
  %p.sub= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} pending jobs."
9
9
  %ul.job
10
10
  - @jobs.each do |job|
@@ -1,7 +1,7 @@
1
1
  %h1
2
2
  Working
3
3
  %p.sub
4
- The list below contains jobs currently being processed.
4
+ The list below contains jobs which are currently being run.
5
5
  %p.sub= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} working jobs."
6
6
  %ul.job
7
7
  - @jobs.each do |job|
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mcmire-delayed_job_web}
8
- s.version = "1.1.3.rc3"
8
+ s.version = "1.1.3.rc4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erick Schmitt", "Elliot Winkler"]
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcmire-delayed_job_web
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424059
4
+ hash: 15424053
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - 3
10
10
  - rc
11
- - 3
12
- version: 1.1.3.rc3
11
+ - 4
12
+ version: 1.1.3.rc4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Erick Schmitt