sidekiq-belt 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e20fc5c538638c6ec3efcc44f96a75e8a6a3a15906738e78990add18f15ff5a
4
- data.tar.gz: e21c25aad43211fa210785d92c7d1e182efbec71471feb7aa48d1cc5dd802cad
3
+ metadata.gz: e1d58a367e0ec0d41fb826a95a5b61cc59c6431fd5d50f235786cb3521e1ac69
4
+ data.tar.gz: 2cf1947d6e5ca5b54fe9989ec5a30e09923474412bce3d65475a13aa693d29fd
5
5
  SHA512:
6
- metadata.gz: 857d47d6d0dfbe7ffb7b2e97049c5a718877525212508afa787c506aa5497a4ac172a92bf9ee9218673f83bad99efbb076f7460a3b71d63cf2f9431bd34dfb2b
7
- data.tar.gz: e14112f7c11dde264d54a5143e4d555a54206528effd0c7ae0679ef5106026b942e4e17b3d539214594b8c00e03317acd74f4514f106a526b967f17f635ee1b9
6
+ metadata.gz: 8f8b2a0e54438fc416a638c3de38bcdccd187eea0363863d33ec04a2aa97dfc97983548445ab1f7f15148837123dccdad11cc47274ac59287e473c1223189b78
7
+ data.tar.gz: 6467a245b671d70c33b759b579f1ea12d4adf48c0bde494979e39d8c6663468859fc147f9f9add16ac967a9249e3ae6ac50476078fb59629167a14d5aeffa610
data/CHANGELOG.md CHANGED
@@ -1,13 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.3.0] - 2023-10-07
3
+ ## [0.3.2] - 2024-01-07
4
+
5
+ - Feature to sort periodic list by class name
6
+
7
+ ## [0.3.1] - 2023-11-01
8
+
9
+ - Added style to pause button
10
+
11
+ ## [0.3.0] - 2023-10-28
4
12
 
5
13
  - Feature to add button to remove failed batches
6
14
 
7
- ## [0.2.0] - 2023-10-07
15
+ ## [0.2.0] - 2023-10-14
8
16
 
9
17
  - Feature to Pause/Unpause Periodic Jobs
10
18
 
11
- ## [0.1.0] - 2023-10-07
19
+ ## [0.1.0] - 2023-10-12
12
20
 
13
21
  - Feature to run manualy Periodic Jobs
@@ -4,6 +4,7 @@ require "sidekiq"
4
4
 
5
5
  require_relative "periodic_pause"
6
6
  require_relative "periodic_run"
7
+ require_relative "periodic_sort"
7
8
 
8
9
  module Sidekiq
9
10
  module Belt
@@ -12,13 +13,16 @@ module Sidekiq
12
13
  def self.use!(options = [:all])
13
14
  return unless Sidekiq.ent?
14
15
 
15
- all = options.include?(:all)
16
-
17
- Sidekiq::Belt::Ent::PeriodicPause.use! if all || options.include?(:periodic_pause)
18
- Sidekiq::Belt::Ent::PeriodicRun.use! if all || options.include?(:periodic_run)
16
+ Sidekiq::Belt::Ent::PeriodicPause.use! if should_use?(:periodic_pause, options)
17
+ Sidekiq::Belt::Ent::PeriodicRun.use! if should_use?(:periodic_run, options)
18
+ Sidekiq::Belt::Ent::PeriodicSort.use! if should_use?(:periodic_sort, options)
19
19
 
20
20
  true
21
21
  end
22
+
23
+ def self.should_use?(key, options)
24
+ options.include?(:all) || options.include?(key)
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -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,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sidekiq/web/helpers"
4
+
5
+ module Sidekiq
6
+ module Belt
7
+ module Ent
8
+ module PeriodicSort
9
+ module SidekiqLoopsPeriodicSort
10
+ def each(&block)
11
+ @lids.map { |lid| Sidekiq::Periodic::Loop.new(lid) }.sort_by(&:klass).each(&block)
12
+ end
13
+ end
14
+
15
+ def self.use!
16
+ require("sidekiq-ent/periodic")
17
+ require("sidekiq-ent/periodic/static_loop")
18
+
19
+ Sidekiq::Periodic::LoopSet.prepend(Sidekiq::Belt::Ent::PeriodicSort::SidekiqLoopsPeriodicSort)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Belt
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
@@ -14,7 +14,9 @@ module Sidekiq
14
14
 
15
15
  path_info ||= ::Rack::Utils.unescape(env["PATH_INFO"])
16
16
 
17
- Sidekiq::Config::DEFAULTS[:replace_views].fetch(path_info.to_s, []).each do |content_block|
17
+ replace_views = Sidekiq::Config::DEFAULTS[:replace_views] || {}
18
+
19
+ replace_views.fetch(path_info.to_s, []).each do |content_block|
18
20
  content_block.call(content)
19
21
  end
20
22
 
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.0
4
+ version: 0.3.2
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-28 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -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/ent/periodic_sort.rb
48
49
  - lib/sidekiq/belt/pro/failed_batch_remove.rb
49
50
  - lib/sidekiq/belt/pro/files.rb
50
51
  - lib/sidekiq/belt/version.rb