delayed-web 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/delayed/web/jobs_controller.rb +0 -10
- data/app/decorators/delayed/web/active_record_decorator.rb +0 -4
- data/app/decorators/delayed/web/status_decorator.rb +1 -5
- data/app/models/delayed/web/job/double.rb +0 -4
- data/app/models/delayed/web/job/mongoid.rb +24 -0
- data/app/views/delayed/web/jobs/index.html.erb +2 -11
- data/app/views/delayed/web/jobs/show.html.erb +1 -4
- data/app/views/layouts/delayed/web/application.html.erb +0 -1
- data/config/locales/en.yml +0 -3
- data/config/routes.rb +0 -1
- data/lib/delayed/web/version.rb +1 -1
- data/spec/decorators/status_decorator_spec.rb +2 -16
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +32486 -0
- data/spec/dummy/log/test.log +927 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0332f562ff3e30cda56eb6010d3d4952 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/075cd664f24b531d19fa91317ef97eec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/14530c1c82b7977b9d8c442d5954a6b1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/209d539bd215846261a8891dd525ec4a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2b6d7fa94bd05e45215f128721db34e3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/342153d354456f6627073c2b6271db5a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3c9123c2b52806585f33904c0f3111b0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4db6b13287795e859f19978360c1fd0e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5469cff1c301f3271083dfef71ab1794 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7437b83a2bf92170949593c06096d785 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8fa08b833277f69ba9c690fccd8f5702 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a44209b0d8d5c66ceeef04dacbc7cf1b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a5108c801777656bd9063abb9849ad55 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ad4f58431d190a3f58b681aa163b5979 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ae02292af637b0ca9807b59076a87282 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b6232d3fa8288b4d714ae250bf4e7acc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ba98100d11384e930583f1385f48a94b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d6e1313228ec89666a543b748171f6b6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d8f3c4e12078655828fafa63ef446a2e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e7905ee7f75f526588d5bed6996c2cde +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ea9a9e3e949584a04377ce58b2fd61b6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/14530c1c82b7977b9d8c442d5954a6b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/209d539bd215846261a8891dd525ec4a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2b6d7fa94bd05e45215f128721db34e3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3c9123c2b52806585f33904c0f3111b0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4db6b13287795e859f19978360c1fd0e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7437b83a2bf92170949593c06096d785 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8fa08b833277f69ba9c690fccd8f5702 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a44209b0d8d5c66ceeef04dacbc7cf1b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ad4f58431d190a3f58b681aa163b5979 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ae02292af637b0ca9807b59076a87282 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b6232d3fa8288b4d714ae250bf4e7acc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d6e1313228ec89666a543b748171f6b6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d8f3c4e12078655828fafa63ef446a2e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e7905ee7f75f526588d5bed6996c2cde +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea9a9e3e949584a04377ce58b2fd61b6 +0 -0
- data/spec/features/jobs_spec.rb +0 -7
- metadata +98 -7
- data/app/assets/javascripts/delayed/web/application.js +0 -45
- data/app/assets/javascripts/jquery-1.11.1.min.js +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd66d05ef2a11a4adf4cf9e3e3de06b25662cd63
|
4
|
+
data.tar.gz: 61e2fa4a7b7f861db38fa13f04e42fed1dd31c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eac0eb772a06388b98c5649fb64a067152dab24a69f8104f66bbda9acf9b9ac7c6e40e3abd7685d3011c22cf527888a8ffd10fa806eae679bd15ab6837f6aa3e
|
7
|
+
data.tar.gz: 424138ac419742487d80f19a67acb62bd52c0cdfa664590a1da19a235b03e5ba789568b7485d44ba8d941cede50b46b31752a335056fa1d327f3377f80d0e83b
|
@@ -1,16 +1,6 @@
|
|
1
1
|
module Delayed
|
2
2
|
module Web
|
3
3
|
class JobsController < Delayed::Web::ApplicationController
|
4
|
-
def invoke
|
5
|
-
if job.can_invoke?
|
6
|
-
job.invoke!
|
7
|
-
flash[:notice] = t(:notice, scope: 'delayed/web.flashes.jobs.invoked')
|
8
|
-
else
|
9
|
-
flash[:alert] = t(:alert, scope: 'delayed/web.flashes.jobs.invoked', status: job.status)
|
10
|
-
end
|
11
|
-
redirect_to jobs_path
|
12
|
-
end
|
13
|
-
|
14
4
|
def queue
|
15
5
|
if job.can_queue?
|
16
6
|
job.queue!
|
@@ -12,16 +12,12 @@ module Delayed
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def can_invoke?
|
16
|
-
status != 'executing'
|
17
|
-
end
|
18
|
-
|
19
15
|
def can_destroy?
|
20
16
|
status != 'executing'
|
21
17
|
end
|
22
18
|
|
23
19
|
def can_queue?
|
24
|
-
status != '
|
20
|
+
status != 'executing'
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Delayed
|
2
|
+
module Web
|
3
|
+
class Job::Mongoid
|
4
|
+
|
5
|
+
def self.find *args
|
6
|
+
decorate Delayed::Job.find(*args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.all
|
10
|
+
jobs = Delayed::Job.order_by(created_at: 'desc').limit(100)
|
11
|
+
Enumerator.new do |enumerator|
|
12
|
+
jobs.each do |job|
|
13
|
+
enumerator.yield decorate(job)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.decorate job
|
19
|
+
ActiveRecordDecorator.new StatusDecorator.new(job)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -4,12 +4,6 @@
|
|
4
4
|
<h1><%= title %></h1>
|
5
5
|
</div>
|
6
6
|
|
7
|
-
Page last updated: <span id="lastUpdated"></span>
|
8
|
-
<br>
|
9
|
-
<a id="loadNow" href="#">Updated now</a>
|
10
|
-
<br>
|
11
|
-
<a id="startLoading" href="#">Start Loading</a>
|
12
|
-
<a id="stopLoading" href="#">Stop Loading</a>
|
13
7
|
<table class="table table-bordered">
|
14
8
|
<thead>
|
15
9
|
<tr>
|
@@ -19,10 +13,10 @@ Page last updated: <span id="lastUpdated"></span>
|
|
19
13
|
<th>Run At</th>
|
20
14
|
<th>Attempts</th>
|
21
15
|
<th style="width: 190px;">Last Error</th>
|
22
|
-
<th style="width:
|
16
|
+
<th style="width: 115px;">Actions</th>
|
23
17
|
</tr>
|
24
18
|
</thead>
|
25
|
-
<tbody
|
19
|
+
<tbody>
|
26
20
|
<% if jobs.any? %>
|
27
21
|
<% jobs.each do |job| %>
|
28
22
|
<tr>
|
@@ -37,9 +31,6 @@ Page last updated: <span id="lastUpdated"></span>
|
|
37
31
|
<td><%= job.attempts %></td>
|
38
32
|
<td><%= link_to_if job.last_error.present?, truncate(job.last_error), job_path(job) %></td>
|
39
33
|
<td>
|
40
|
-
<% if job.can_invoke? %>
|
41
|
-
<%= button_to 'Invoke', invoke_job_path(job), method: :put, class: 'btn btn-mini', form_class: 'btn-rails pull-left' %>
|
42
|
-
<% end %>
|
43
34
|
<% if job.can_queue? %>
|
44
35
|
<%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn btn-mini', form_class: 'btn-rails pull-left' %>
|
45
36
|
<% end %>
|
@@ -5,11 +5,8 @@
|
|
5
5
|
<%= link_to 'Jobs', jobs_path %> / <%= title %>
|
6
6
|
</h1>
|
7
7
|
<div class="btn-group">
|
8
|
-
<% if job.can_invoke? %>
|
9
|
-
<%= button_to 'Invoke', invoke_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails pull-left' %>
|
10
|
-
<% end %>
|
11
8
|
<% if job.can_queue? %>
|
12
|
-
<%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails' %>
|
9
|
+
<%= button_to 'Run Next', queue_job_path(job), method: :put, class: 'btn', form_class: 'btn-rails pull-left' %>
|
13
10
|
<% end %>
|
14
11
|
<% if job.can_destroy? %>
|
15
12
|
<%= button_to 'Delete', job_path(job), method: :delete, class: 'btn btn-danger', form_class: 'btn-rails pull-right' %>
|
data/config/locales/en.yml
CHANGED
data/config/routes.rb
CHANGED
data/lib/delayed/web/version.rb
CHANGED
@@ -33,27 +33,13 @@ describe Delayed::Web::StatusDecorator do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe '#can_invoke?' do
|
37
|
-
it 'is true when failed' do
|
38
|
-
expect(failed_job.can_invoke?).to be_true
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'is true when queued' do
|
42
|
-
expect(queued_job.can_invoke?).to be_true
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'is false when executing' do
|
46
|
-
expect(executing_job.can_invoke?).to be_false
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
36
|
describe '#can_queue?' do
|
51
37
|
it 'is true when failed' do
|
52
38
|
expect(failed_job.can_queue?).to be_true
|
53
39
|
end
|
54
40
|
|
55
|
-
it 'is
|
56
|
-
expect(queued_job.can_queue?).to
|
41
|
+
it 'is true when queued' do
|
42
|
+
expect(queued_job.can_queue?).to be_true
|
57
43
|
end
|
58
44
|
|
59
45
|
it 'is false when executing' do
|
File without changes
|
File without changes
|