sidekiq-belt 0.3.6 → 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: 0620ca72d8c203a723b37c5b557e3cb7ddb836572b3e55c13f915b08ade54690
4
- data.tar.gz: 43554ce2b06473406080e4973614e93828ec814a6d4ed410e6fabd97e7d94971
3
+ metadata.gz: edb3a875c6a19a21d87d63f32b116f44fdba5c55dcb62577a94e6b1727449d0b
4
+ data.tar.gz: de58057b262d16db28fd45ff42f888361e9692158d1c906ffa3566dc38081c01
5
5
  SHA512:
6
- metadata.gz: 8de6db5e1e246a279e586378afbaf72aba5527b501642bb3e09e1b75413d2ac8b2f3242058f27155728e6627891f0e166e296ab735e6c895fba6428a4a524397
7
- data.tar.gz: 14d4d139eef62eec7270794bcdeb73f19ea24a64980878b06b09ba2366dc9b8ad1bba77796da046962dfb648c5cfb8bdb1ac063b72d9bf6fa7c1c1497d7aeb2f
6
+ metadata.gz: 25897766813a45a51454e7b43a4737e9acb223d2e89490f657a02afe90f295e9edff9b240021ab8e3aaa978064bbde966d4713ed1c1385c5d4274f51c4cce64c
7
+ data.tar.gz: 1da39ce3c83f28daac2f8c1b598ac8c7c8c587e6d6dfb08ba3258deceacc96b65772cdde00ca9eb3440fc486a298f9e62152b9d67e5716f0f746a63ea25337ed
data/README.md CHANGED
@@ -116,7 +116,7 @@ Sidekiq::Belt.configure do |config|
116
116
  end
117
117
  ```
118
118
 
119
- ### Add to your web sidekiq a top label by enviroment (sidekiq)
119
+ ### Add to your web sidekiq a top label by environment (sidekiq)
120
120
 
121
121
  This feature adds a little line on top of Sidekiq web that shows a configurable message.
122
122
 
@@ -133,7 +133,7 @@ Sidekiq::Belt.configure do |config|
133
133
  config.top_label = {
134
134
  production: {
135
135
  background_color: 'red',
136
- text: 'Be carefull',
136
+ text: 'Be careful',
137
137
  color: 'white'
138
138
  },
139
139
  development: {
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "sidekiq/web"
4
4
  require "sidekiq/web/helpers"
5
- require "byebug"
6
5
 
7
6
  module Sidekiq
8
7
  module Belt
@@ -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.6"
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.6
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-12 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