sidekiq-belt 0.3.7 → 1.0.0

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
  SHA256:
3
- metadata.gz: 9378b2263842e78c94a366b421fc26062c1ca3c38587543c96ebb3760701be9f
4
- data.tar.gz: 605d1139e12eb82ac048a790802313338906c452f2c171a7c6bcee48cb6cc7cc
3
+ metadata.gz: edb3a875c6a19a21d87d63f32b116f44fdba5c55dcb62577a94e6b1727449d0b
4
+ data.tar.gz: de58057b262d16db28fd45ff42f888361e9692158d1c906ffa3566dc38081c01
5
5
  SHA512:
6
- metadata.gz: 10989d5396c5bdaf8435849dbb8ed1c5a4fd69331d4fae57f56a38b30c51d692bf86a9c1ef8503029ee20eb52f82e294b43c0957ec08f0a5b5d62677a5200ca4
7
- data.tar.gz: 89323ca938d21925726c6fcc8c532160172a094e3c9bee2c7c56f493dcb914ae79dc4dfd4ca5bef5529520ced2ece334713ba8f0c24c8e7526c8c55ac9c13058
6
+ metadata.gz: 25897766813a45a51454e7b43a4737e9acb223d2e89490f657a02afe90f295e9edff9b240021ab8e3aaa978064bbde966d4713ed1c1385c5d4274f51c4cce64c
7
+ data.tar.gz: 1da39ce3c83f28daac2f8c1b598ac8c7c8c587e6d6dfb08ba3258deceacc96b65772cdde00ca9eb3440fc486a298f9e62152b9d67e5716f0f746a63ea25337ed
@@ -21,7 +21,7 @@ module Sidekiq
21
21
 
22
22
  content.gsub!(
23
23
  "</td>\n </tr>\n <% end %>",
24
- "</td>\n<td>#{REMOVE_BUTTON}</td>\n </tr>\n <% end %>"
24
+ "</td>\n<td>#{REMOVE_BUTTON}</td>\n </tr>\n <% end %>"
25
25
  )
26
26
  end
27
27
 
@@ -3,6 +3,7 @@
3
3
  require "sidekiq"
4
4
 
5
5
  require_relative "failed_batch_remove"
6
+ require_relative "force_batch_callback"
6
7
 
7
8
  module Sidekiq
8
9
  module Belt
@@ -14,6 +15,7 @@ module Sidekiq
14
15
  all = options.include?(:all)
15
16
 
16
17
  Sidekiq::Belt::Pro::FailedBatchRemove.use! if all || options.include?(:failed_batch_remove)
18
+ Sidekiq::Belt::Pro::ForceBatchCallback.use! if all || options.include?(:force_batch_callback)
17
19
 
18
20
  true
19
21
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sidekiq/web/helpers"
4
+
5
+ module Sidekiq
6
+ module Belt
7
+ module Pro
8
+ module ForceBatchCallback
9
+ module SidekiqForceBatchCallback
10
+ def self.action_button(action)
11
+ <<~ERB
12
+ <form action="<%= root_path %>batches/<%= @batch.bid %>/force_callback/#{action}" method="post">
13
+ <%= csrf_tag %>
14
+ <input class="btn btn-danger" type="submit" name="force_#{action}" value="<%= t('#{action.capitalize}') %>"
15
+ data-confirm="Do you want to force the #{action} callback for batch <%= @batch.bid %>? <%= t('AreYouSure') %>" />
16
+ </form>
17
+ ERB
18
+ end
19
+
20
+ def self.registered(app)
21
+ app.replace_content("/batches/:bid") do |content|
22
+ content.sub!(%r{(</tbody>)}) do |match|
23
+ <<-HTML
24
+ <tr>
25
+ <th><%= t("Force Action") %></th>
26
+ <td>
27
+ <div style="display: flex;">
28
+ #{action_button("success")}
29
+ #{action_button("complete")}
30
+ #{action_button("death")}
31
+ </div>
32
+ </td>
33
+ </tr>
34
+ #{match}
35
+ HTML
36
+ end
37
+ end
38
+
39
+ app.post("/batches/:bid/force_callback/:action") do
40
+ Sidekiq::Batch::Callback.perform_inline(params[:action], params[:bid])
41
+
42
+ return redirect "#{root_path}batches"
43
+ end
44
+ end
45
+ end
46
+
47
+ def self.use!
48
+ require("sidekiq/web")
49
+
50
+ Sidekiq::Web.register(Sidekiq::Belt::Pro::ForceBatchCallback::SidekiqForceBatchCallback)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Belt
5
- VERSION = "0.3.7"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -52,6 +52,7 @@ files:
52
52
  - lib/sidekiq/belt/ent/periodic_sort.rb
53
53
  - lib/sidekiq/belt/pro/failed_batch_remove.rb
54
54
  - lib/sidekiq/belt/pro/files.rb
55
+ - lib/sidekiq/belt/pro/force_batch_callback.rb
55
56
  - lib/sidekiq/belt/version.rb
56
57
  - lib/sidekiq/web_action_helper.rb
57
58
  - lib/sidekiq/web_router_helper.rb
@@ -78,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
79
  - !ruby/object:Gem::Version
79
80
  version: '0'
80
81
  requirements: []
81
- rubygems_version: 3.5.16
82
+ rubygems_version: 3.5.23
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: This Ruby gem enhances the capabilities of Sidekiq, Sidekiq Pro, and Sidekiq