sidekiq-belt 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/CHANGELOG.md +4 -0
- data/README.md +16 -3
- data/lib/sidekiq/belt/community/files.rb +2 -0
- data/lib/sidekiq/belt/ent/files.rb +2 -0
- data/lib/sidekiq/belt/pro/failed_batch_remove.rb +44 -0
- data/lib/sidekiq/belt/pro/files.rb +6 -4
- data/lib/sidekiq/belt/version.rb +1 -1
- data/lib/sidekiq/web_action_helper.rb +1 -5
- data/lib/sidekiq/web_router_helper.rb +3 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e20fc5c538638c6ec3efcc44f96a75e8a6a3a15906738e78990add18f15ff5a
|
4
|
+
data.tar.gz: e21c25aad43211fa210785d92c7d1e182efbec71471feb7aa48d1cc5dd802cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857d47d6d0dfbe7ffb7b2e97049c5a718877525212508afa787c506aa5497a4ac172a92bf9ee9218673f83bad99efbb076f7460a3b71d63cf2f9431bd34dfb2b
|
7
|
+
data.tar.gz: e14112f7c11dde264d54a5143e4d555a54206528effd0c7ae0679ef5106026b942e4e17b3d539214594b8c00e03317acd74f4514f106a526b967f17f635ee1b9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Sidekiq::Belt
|
2
2
|
|
3
|
+
|
4
|
+
<a href='http://badge.fury.io/rb/sidekiq-belt'>
|
5
|
+
<img src="https://badge.fury.io/rb/sidekiq-belt.png" alt="Gem Version" />
|
6
|
+
</a>
|
7
|
+
<a href='https://github.com/dannnylo/sidekiq-belt/workflows/CI/badge.svg'>
|
8
|
+
<img src="https://github.com/dannnylo/sidekiq-belt/workflows/CI/badge.svg" alt="Build Status" />
|
9
|
+
</a>
|
10
|
+
|
3
11
|
This Ruby gem enhances the capabilities of Sidekiq, Sidekiq Pro, and Sidekiq Enterprise by adding essential utilities.
|
4
12
|
|
5
13
|
## Installation
|
@@ -59,14 +67,19 @@ To enable this feature, pass the `periodic_pause` option:
|
|
59
67
|
```ruby
|
60
68
|
Sidekiq::Belt.use!([:periodic_pause])
|
61
69
|
```
|
70
|
+
![periodic_pause](https://github.com/dannnylo/sidekiq-belt/assets/20794/41fbcee4-9c5b-45cd-b6f7-c359a22f3979)
|
71
|
+
![periodic_unpause](https://github.com/dannnylo/sidekiq-belt/assets/20794/ea06ae37-068e-4f66-ab10-d83970545a59)
|
62
72
|
|
63
73
|
### Delete an Unfinished Batch (sidekiq-pro)
|
64
74
|
|
65
|
-
This
|
75
|
+
This option adds a button to remove failed batches.
|
66
76
|
|
67
|
-
|
77
|
+
To enable this feature, pass the `failed_batch_remove` option:
|
78
|
+
```ruby
|
79
|
+
Sidekiq::Belt.use!([:failed_batch_remove])
|
80
|
+
```
|
81
|
+
![failed_batch_remove](https://github.com/dannnylo/sidekiq-belt/assets/20794/e285a8b2-4626-48e1-b04a-5190ae51d43b)
|
68
82
|
|
69
|
-
It will be implemented in upcoming versions.
|
70
83
|
|
71
84
|
## Development
|
72
85
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sidekiq/web/helpers"
|
4
|
+
|
5
|
+
module Sidekiq
|
6
|
+
module Belt
|
7
|
+
module Pro
|
8
|
+
module FailedBatchRemove
|
9
|
+
module SidekiqFailedBatchRemove
|
10
|
+
REMOVE_BUTTON = <<~ERB
|
11
|
+
<form action="<%= root_path %>batches/<%= bid %>/remove" method="post">
|
12
|
+
<%= csrf_tag %>
|
13
|
+
<input class="btn btn-danger" type="submit" name="remove" value="<%= t('Remove') %>"
|
14
|
+
data-confirm="Do you want to remove batch <%= bid %>? <%= t('AreYouSure') %>" />
|
15
|
+
</form>
|
16
|
+
ERB
|
17
|
+
|
18
|
+
def self.registered(app)
|
19
|
+
app.replace_content("/batches") do |content|
|
20
|
+
content.gsub!("</th>\n <%", "</th><th><%= t('Delete') %></th>\n <%")
|
21
|
+
|
22
|
+
content.gsub!(
|
23
|
+
"</td>\n </tr>\n <% end %>",
|
24
|
+
"</td>\n<td>#{REMOVE_BUTTON}</td>\n </tr>\n <% end %>"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
app.post("/batches/:bid/remove") do
|
29
|
+
Sidekiq::Batch::Status.new(params[:bid]).delete
|
30
|
+
|
31
|
+
return redirect "#{root_path}batches"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.use!
|
37
|
+
require("sidekiq/web")
|
38
|
+
|
39
|
+
Sidekiq::Web.register(Sidekiq::Belt::Pro::FailedBatchRemove::SidekiqFailedBatchRemove)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -2,18 +2,20 @@
|
|
2
2
|
|
3
3
|
require "sidekiq"
|
4
4
|
|
5
|
-
|
5
|
+
require_relative "failed_batch_remove"
|
6
6
|
|
7
7
|
module Sidekiq
|
8
8
|
module Belt
|
9
9
|
module Pro
|
10
10
|
module Files
|
11
|
-
def self.use!(
|
11
|
+
def self.use!(options = [:all])
|
12
12
|
return unless Sidekiq.pro?
|
13
13
|
|
14
|
+
all = options.include?(:all)
|
15
|
+
|
16
|
+
Sidekiq::Belt::Pro::FailedBatchRemove.use! if all || options.include?(:failed_batch_remove)
|
17
|
+
|
14
18
|
true
|
15
|
-
# all = options.include?(:all)
|
16
|
-
# Sidekiq::Belt::Pro::Feature.load! if all || options.include?(:feature)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/sidekiq/belt/version.rb
CHANGED
@@ -5,10 +5,6 @@ require "sidekiq/web/action"
|
|
5
5
|
|
6
6
|
module Sidekiq
|
7
7
|
module WebActionHelper
|
8
|
-
def self.blocks
|
9
|
-
@blocks ||= {}
|
10
|
-
end
|
11
|
-
|
12
8
|
def render(engine, content, options = {})
|
13
9
|
begin
|
14
10
|
path_info = /"([^"]*)"/.match(block.source.to_s)[1]
|
@@ -18,7 +14,7 @@ module Sidekiq
|
|
18
14
|
|
19
15
|
path_info ||= ::Rack::Utils.unescape(env["PATH_INFO"])
|
20
16
|
|
21
|
-
Sidekiq::
|
17
|
+
Sidekiq::Config::DEFAULTS[:replace_views].fetch(path_info.to_s, []).each do |content_block|
|
22
18
|
content_block.call(content)
|
23
19
|
end
|
24
20
|
|
@@ -7,8 +7,9 @@ require_relative "web_action_helper"
|
|
7
7
|
module Sidekiq
|
8
8
|
module WebRouterHelper
|
9
9
|
def replace_content(path, &block)
|
10
|
-
Sidekiq::
|
11
|
-
Sidekiq::
|
10
|
+
Sidekiq::Config::DEFAULTS[:replace_views] ||= {}
|
11
|
+
Sidekiq::Config::DEFAULTS[:replace_views][path.to_s] ||= []
|
12
|
+
Sidekiq::Config::DEFAULTS[:replace_views][path.to_s] << block
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
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.
|
4
|
+
version: 0.3.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: 2023-10-
|
11
|
+
date: 2023-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.1.4
|
27
27
|
description: This Ruby gem enhances the capabilities of Sidekiq, Sidekiq Pro, and
|
28
28
|
Sidekiq Enterprise by adding essential utilities.
|
29
29
|
email:
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/sidekiq/belt/ent/files.rb
|
46
46
|
- lib/sidekiq/belt/ent/periodic_pause.rb
|
47
47
|
- lib/sidekiq/belt/ent/periodic_run.rb
|
48
|
+
- lib/sidekiq/belt/pro/failed_batch_remove.rb
|
48
49
|
- lib/sidekiq/belt/pro/files.rb
|
49
50
|
- lib/sidekiq/belt/version.rb
|
50
51
|
- lib/sidekiq/web_action_helper.rb
|