sidekiq_adhoc_job 2.2.0 → 2.2.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660ad86dfb526fe0eb9b473d1a86799c5f20d0f76934740e87365da5cb9bb287
|
4
|
+
data.tar.gz: 1237cc51e7ca8b2f52ca89e35969f153de5c97e72196c9134a6c1764e16c5565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3358428e19855f80d3f3b6ea468f10f4f634c3d15fd7d36e5843d1f2211af7d1dde8810e7b7e73799f6fecc47fb79532cc98f6aa9423837c752c8b9161a9b7a4
|
7
|
+
data.tar.gz: 87493129755ea165c769362b0723756155133cebcfbe53e8bfd597dfef572f23ba22313ab3946c62d347e505dcbf0d0c701f264210ab23e811c1be517a3a5f73
|
@@ -12,7 +12,8 @@ module SidekiqAdhocJob
|
|
12
12
|
:required_kw_args,
|
13
13
|
:optional_kw_args,
|
14
14
|
:has_rest_args,
|
15
|
-
:require_confirm
|
15
|
+
:require_confirm,
|
16
|
+
:confirm_prompt_message
|
16
17
|
|
17
18
|
StringUtil ||= ::SidekiqAdhocJob::Utils::String
|
18
19
|
|
@@ -27,6 +28,7 @@ module SidekiqAdhocJob
|
|
27
28
|
@optional_kw_args = args[:key] || []
|
28
29
|
@has_rest_args = !!args[:rest]
|
29
30
|
@require_confirm = require_confirm
|
31
|
+
@confirm_prompt_message = SidekiqAdhocJob.config.require_confirm_prompt_message
|
30
32
|
end
|
31
33
|
|
32
34
|
# Builds the presenter instances for the schedule hash
|
@@ -59,8 +59,14 @@
|
|
59
59
|
<% if @presented_job.require_confirm %>
|
60
60
|
<script>
|
61
61
|
document.getElementById('adhoc-jobs-submit-form').addEventListener('submit', (event) => {
|
62
|
-
|
62
|
+
const confirmPrompt = "<%= @presented_job.confirm_prompt_message %>";
|
63
|
+
const input = prompt(`Please enter "${confirmPrompt}" to confirm`);
|
64
|
+
if (input !== confirmPrompt) {
|
63
65
|
event.preventDefault();
|
66
|
+
if (input !== null) {
|
67
|
+
alert('Your confirmation input is incorrect, try again.');
|
68
|
+
}
|
69
|
+
}
|
64
70
|
})
|
65
71
|
</script>
|
66
72
|
<% end %>
|
data/lib/sidekiq_adhoc_job.rb
CHANGED
@@ -46,22 +46,38 @@ module SidekiqAdhocJob
|
|
46
46
|
:strategy_name,
|
47
47
|
:require_confirm_worker_names
|
48
48
|
|
49
|
+
attr_reader :require_confirm_prompt_message
|
50
|
+
|
49
51
|
def initialize
|
50
52
|
@load_paths = []
|
51
53
|
@module_names = []
|
52
54
|
@strategy_name = :default
|
55
|
+
@require_confirm_prompt_message = 'confirm'
|
53
56
|
end
|
54
57
|
|
55
58
|
def module_names
|
56
59
|
Array(@module_names).map(&:to_s)
|
57
60
|
end
|
58
61
|
|
59
|
-
def
|
60
|
-
@
|
62
|
+
def require_confirm_proc
|
63
|
+
@require_confirm_proc ||= \
|
64
|
+
if @require_confirm_worker_names.respond_to?(:call)
|
65
|
+
@require_confirm_worker_names
|
66
|
+
else
|
67
|
+
shortlisted_workers = Array(@require_confirm_worker_names).map(&:to_s)
|
68
|
+
|
69
|
+
->(worker_name) { shortlisted_workers.include?(worker_name) }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def require_confirm_prompt_message=(message)
|
74
|
+
raise 'require_confirm_prompt_message must be string' unless message.is_a? String
|
75
|
+
|
76
|
+
@require_confirm_prompt_message = message
|
61
77
|
end
|
62
78
|
|
63
79
|
def require_confirmation?(worker_name)
|
64
|
-
|
80
|
+
require_confirm_proc.call(worker_name)
|
65
81
|
end
|
66
82
|
|
67
83
|
def strategy
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq_adhoc_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Goh Khoon Hiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|