sidekiq-belt 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -2
- 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/ent/periodic_pause.rb +14 -2
- 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: c5e4649a97ccde536e22d2449ec678ccde0b955c0788c223fecd16487e7e9880
|
4
|
+
data.tar.gz: 690b2b57d00bba771275d7143c2104f9b139fc2b883600bf4a95bfbd8b6591b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3e644e8fb40e12809cd5de2744640a46df7695ad2146d7333ac09a7bcc3460168a23ff891d0e60b54fed06986240242f816f2e344d45fc86ead4c9399e350b
|
7
|
+
data.tar.gz: 61dc37a8dd5f5e3b29d7410275b3c2776063ac6e2944a72b01619cbb713e8c24d55dbf21c301781865cc9b8b030d7278d1e521e115742b1d6938fc103d65d377
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.
|
3
|
+
## [0.3.1] - 2023-11-01
|
4
|
+
|
5
|
+
- Added style to pause button
|
6
|
+
|
7
|
+
## [0.3.0] - 2023-10-28
|
8
|
+
|
9
|
+
- Feature to add button to remove failed batches
|
10
|
+
|
11
|
+
## [0.2.0] - 2023-10-14
|
4
12
|
|
5
13
|
- Feature to Pause/Unpause Periodic Jobs
|
6
14
|
|
7
|
-
## [0.1.0] - 2023-10-
|
15
|
+
## [0.1.0] - 2023-10-12
|
8
16
|
|
9
17
|
- Feature to run manualy Periodic Jobs
|
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
|
+

|
71
|
+

|
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
|
+

|
68
82
|
|
69
|
-
It will be implemented in upcoming versions.
|
70
83
|
|
71
84
|
## Development
|
72
85
|
|
@@ -22,7 +22,7 @@ module Sidekiq
|
|
22
22
|
PAUSE_BUTTON = <<~ERB
|
23
23
|
<form action="<%= root_path %>loops/<%= loup.lid %>/pause" method="post">
|
24
24
|
<%= csrf_tag %>
|
25
|
-
<input class="btn btn-danger" type="submit" name="pause" value="<%= t('Pause') %>"
|
25
|
+
<input class="btn btn-danger btn-pause" type="submit" name="pause" value="<%= t('Pause') %>"
|
26
26
|
data-confirm="Pause the job <%= loup.klass %>? <%= t('AreYouSure') %>" />
|
27
27
|
</form>
|
28
28
|
ERB
|
@@ -30,13 +30,25 @@ module Sidekiq
|
|
30
30
|
UNPAUSE_BUTTON = <<~ERB
|
31
31
|
<form action="<%= root_path %>loops/<%= loup.lid %>/unpause" method="post">
|
32
32
|
<%= csrf_tag %>
|
33
|
-
<input class="btn btn-danger" type="submit" name="pause" value="<%= t('Unpause') %>"
|
33
|
+
<input class="btn btn-danger btn-unpause" type="submit" name="pause" value="<%= t('Unpause') %>"
|
34
34
|
data-confirm="Unpause the job <%= loup.klass %>? <%= t('AreYouSure') %>" />
|
35
35
|
</form>
|
36
36
|
ERB
|
37
37
|
|
38
38
|
def self.registered(app)
|
39
39
|
app.replace_content("/loops") do |content|
|
40
|
+
content.gsub!("</header>", "</header>
|
41
|
+
<style>
|
42
|
+
.btn-unpause {
|
43
|
+
color: #000;
|
44
|
+
background-image: none;
|
45
|
+
background-color: #ddd;
|
46
|
+
}
|
47
|
+
.btn-unpause:hover {
|
48
|
+
border: 1px solid;
|
49
|
+
}
|
50
|
+
</style>")
|
51
|
+
|
40
52
|
# Add the top of the table
|
41
53
|
content.gsub!("</th>\n </tr>", "</th><th><%= t('Pause/Unpause') %></th></th>\n </tr>")
|
42
54
|
|
@@ -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.1
|
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-
|
11
|
+
date: 2023-11-01 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
|