queue_classic_admin 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/app/controllers/queue_classic_admin/queue_classic_jobs_controller.rb +9 -0
- data/app/views/queue_classic_admin/shared/_job_list.html.erb +3 -0
- data/config/routes.rb +3 -2
- data/lib/queue_classic_admin.rb +9 -0
- data/lib/queue_classic_admin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af95fec31c551ee622afcd21173a788c7e093716
|
4
|
+
data.tar.gz: 8f85b826302294507b1a5caff71540e26787d5c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5241615b90d16507a74435600b498076c336805468d5ef8edf4c14e48a27fe7bca574e33a02c9d9c77636e5a0138a823c3d2a4d48df98eab4fd4f1004dd653
|
7
|
+
data.tar.gz: 22ce862ea78f2bc6cbaa98b0506e7af5abe5f86d719e0fd7e854cdbb84054d9f0dec287779121e53115f869641cb300db4adc591a6ec0591af3cb4b4dc3a885c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Queue Classic Admin
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/QueueClassic/queue_classic_admin.png)](https://travis-ci.org/QueueClassic/queue_classic_admin)
|
4
4
|
|
5
5
|
An admin interface for the [queue_classic](https://github.com/ryandotsmith/queue_classic) and [queue_classic-later](https://github.com/dpiddy/queue_classic-later) gems.
|
6
6
|
|
@@ -54,6 +54,14 @@ QueueClassicAdmin.add_custom_action "Retry" do |job|
|
|
54
54
|
end
|
55
55
|
```
|
56
56
|
|
57
|
+
## Custom action on matching jobs
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
QueueClassicAdmin.add_bulk_custom_action "Retry" do |jobs|
|
61
|
+
jobs.update_all(q_name: "low")
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
57
65
|
# Development
|
58
66
|
|
59
67
|
```bash
|
@@ -23,6 +23,15 @@ module QueueClassicAdmin
|
|
23
23
|
redirect_to queue_classic_jobs_url
|
24
24
|
end
|
25
25
|
|
26
|
+
def bulk_custom_action
|
27
|
+
jobs = filter_jobs(QueueClassicJob)
|
28
|
+
|
29
|
+
custom_action = QueueClassicAdmin.custom_bulk_actions[params[:custom_action]]
|
30
|
+
custom_action.action.call(jobs)
|
31
|
+
|
32
|
+
redirect_to queue_classic_jobs_url
|
33
|
+
end
|
34
|
+
|
26
35
|
def unlock
|
27
36
|
@queue_classic_job.locked_at = nil
|
28
37
|
@queue_classic_job.save
|
@@ -41,6 +41,9 @@
|
|
41
41
|
link_to "Unlock Matching > 5 mins", url_for(params.merge(action: 'unlock_all')), class: 'btn btn-danger', data: {confirm: "Are you sure?", method: :put}
|
42
42
|
%>
|
43
43
|
<% end %>
|
44
|
+
<% QueueClassicAdmin.custom_bulk_actions.each do |slug, action| %>
|
45
|
+
<%= link_to action.name, bulk_custom_action_queue_classic_jobs_path(params.merge(custom_action: slug)), class: 'btn btn-danger', data: {confirm: "Are you sure?"} %>
|
46
|
+
<% end %>
|
44
47
|
</th>
|
45
48
|
</tr>
|
46
49
|
</thead>
|
data/config/routes.rb
CHANGED
@@ -8,13 +8,14 @@ QueueClassicAdmin::Engine.routes.draw do
|
|
8
8
|
resources :queue_classic_jobs do
|
9
9
|
collection do
|
10
10
|
delete :destroy_all
|
11
|
-
put
|
11
|
+
put :unlock_all
|
12
|
+
post :bulk_custom_action
|
12
13
|
end
|
13
14
|
|
14
15
|
member do
|
15
16
|
post :unlock
|
16
17
|
post :custom
|
17
|
-
get
|
18
|
+
get :show
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
data/lib/queue_classic_admin.rb
CHANGED
@@ -14,5 +14,14 @@ module QueueClassicAdmin
|
|
14
14
|
action = CustomAction.new(name, &block)
|
15
15
|
custom_actions[action.slug] = action
|
16
16
|
end
|
17
|
+
|
18
|
+
def self.custom_bulk_actions
|
19
|
+
@@custom_actions ||= {}
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.add_custom_bulk_action(name, &block)
|
23
|
+
action = CustomAction.new(name, &block)
|
24
|
+
custom_actions[action.slug] = action
|
25
|
+
end
|
17
26
|
end
|
18
27
|
|