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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e5b7743858486ed9457200af9bdd0c0e3283d1f
4
- data.tar.gz: 26abd36345a9fba5a6e5c0e4df1a251aacca1fec
3
+ metadata.gz: af95fec31c551ee622afcd21173a788c7e093716
4
+ data.tar.gz: 8f85b826302294507b1a5caff71540e26787d5c6
5
5
  SHA512:
6
- metadata.gz: ebf053f10232eb6db30d22e13608eab1c7f15e7a5805f07b71f047d08fae096cc38c97063f555e39fb309fcaf30b4f882555b2e5fb48ab67eb898e5a4cbf487e
7
- data.tar.gz: c3d1c9d80a2b431fe6e45acb559f9fa177be4d64093f71812acf9318ca93e7f01c9f7eaa0b7712256e71d3fb83c7b6aeb16c90727f69a7fa4f04dd7914c22aca
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/rainforestapp/queue_classic_admin.png)](https://travis-ci.org/rainforestapp/queue_classic_admin)
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 :unlock_all
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 :show
18
+ get :show
18
19
  end
19
20
  end
20
21
 
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module QueueClassicAdmin
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queue_classic_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Mathieu