sidekiq_adhoc_job 0.2.1 → 0.2.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: c21a2663558c918e59402c9180737fdc70f7520003413770eecaa73cabf86db8
4
- data.tar.gz: f0eb1fd9b4c6e9d7b7fd52eaa157bd468bc02585438413c27b42a933097b5ca9
3
+ metadata.gz: 8c0e73d782590b6b44e800550261cb9c64414eac41a516542beeee8f77345b0a
4
+ data.tar.gz: 063c9caff1f9b63a7fac67bb8e033153a60531c9bbde195bc1aeb2d509dcd9b9
5
5
  SHA512:
6
- metadata.gz: cc04bca685843cdc4f68758fbef688bfaaca75ab64deaaece3cb3e082dd54c028230753e1c8d7d2b8001089584c8b6a4fb578fbb2582f22fd604c0a30b492bb9
7
- data.tar.gz: 5c3bb8282be7d70ff5a5937b41e7be4db4d4ab4568b302030aef2da554ede3a89e8d9b45afafbd5820b4bc68fc22b75bebb7ffbce183c9c8c773878c5bbb8fa0
6
+ metadata.gz: 27604c34ae4f16f120ed722dcb92fe4d5e8ce271f2353260f4265212bbd89b7e0ab28a1d5ac606cbfd2b66afab1ed0abeefb61ff2790dc52e09f0d6ff9b5f19a
7
+ data.tar.gz: 9056e87feb58fb3d38e70eb8a0d7689123bc98ee6e22d0d83f5fcdfb14497533859dd45c7bf8e58dfb8e25514205d27081e74bb3ff5e8c178e3185a82f596f89
@@ -25,7 +25,9 @@ module SidekiqAdhocJob
25
25
  :allowed_params, :worker_params
26
26
 
27
27
  def parse_params
28
- @worker_params = allowed_params.map { |key| StringUtil.parse(request_params[key], symbolize: true) }
28
+ @worker_params = allowed_params
29
+ .reject { |key| request_params[key].empty? }
30
+ .map { |key| StringUtil.parse(request_params[key], symbolize: true) }
29
31
  if !!request_params[:rest_args] && !request_params[:rest_args].empty?
30
32
  @worker_params << StringUtil.parse_json(request_params[:rest_args].strip, symbolize: true)
31
33
  end
@@ -1,3 +1,3 @@
1
1
  module SidekiqAdhocJob
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -4,7 +4,7 @@ module SidekiqAdhocJob
4
4
  class JobPresenter
5
5
  include Sidekiq::WebHelpers
6
6
 
7
- attr_reader :name, :path_name, :queue, :has_rest_args, :args
7
+ attr_reader :name, :path_name, :queue, :required_args, :optional_args, :has_rest_args
8
8
 
9
9
  StringUtil ||= ::SidekiqAdhocJob::Utils::String
10
10
 
@@ -16,7 +16,6 @@ module SidekiqAdhocJob
16
16
  @required_args = args[:req] || []
17
17
  @optional_args = args[:opt] || []
18
18
  @has_rest_args = !!args[:rest]
19
- @args = @required_args + @optional_args
20
19
  end
21
20
 
22
21
  # Builds the presenter instances for the schedule hash
@@ -1,7 +1,8 @@
1
1
  en:
2
2
  adhoc_jobs: Adhoc Jobs
3
3
  adhoc_jobs_actions: Actions
4
- adhoc_jobs_arguments: Required Arguments
4
+ adhoc_jobs_required_arguments: Required Arguments
5
+ adhoc_jobs_optional_arguments: Optional Arguments
5
6
  adhoc_jobs_go_back: Go Back
6
7
  adhoc_jobs_has_rest_arguments: Has Rest Arguments
7
8
  adhoc_jobs_name: Job Name
@@ -6,7 +6,8 @@
6
6
  <tr>
7
7
  <th><%= t('adhoc_jobs_name') %></th>
8
8
  <th><%= t('adhoc_jobs_queue') %></th>
9
- <th><%= t('adhoc_jobs_arguments') %></th>
9
+ <th><%= t('adhoc_jobs_required_arguments') %></th>
10
+ <th><%= t('adhoc_jobs_optional_arguments') %></th>
10
11
  <th><%= t('adhoc_jobs_has_rest_arguments') %></th>
11
12
  <th><%= t('adhoc_jobs_actions') %></th>
12
13
  </tr>
@@ -17,7 +18,8 @@
17
18
  <tr>
18
19
  <td><%= job.name %></td>
19
20
  <td><%= job.queue %></td>
20
- <td><%= job.args.join(', ') %></td>
21
+ <td><%= job.required_args.join(', ') %></td>
22
+ <td><%= job.optional_args.join(', ') %></td>
21
23
  <td><%= job.has_rest_args %></td>
22
24
  <td class="text-center">
23
25
  <a class="btn btn-warn btn-xs" href="<%= root_path %>adhoc-jobs/<%= URI.escape(job.path_name) %>">
@@ -4,10 +4,10 @@
4
4
 
5
5
  <form method="POST" action="<%= root_path %>adhoc-jobs/<%= URI.escape(@presented_job.path_name) %>/schedule">
6
6
  <input type="hidden" name="authenticity_token" value="<%= @csrf_token %>" />
7
- <% if @presented_job.args.empty? && !@presented_job.has_rest_args %>
7
+ <% if @presented_job.required_args.empty? && @presented_job.optional_args.empty? && !@presented_job.has_rest_args %>
8
8
  <p>No job arguments</p>
9
9
  <% else %>
10
- <% @presented_job.args.each do |arg| %>
10
+ <% @presented_job.required_args.each do |arg| %>
11
11
  <div class="form-group row">
12
12
  <label class="col-sm-2 col-form-label" for="<%= arg %>">*<%= arg %>:</label>
13
13
  <div class="col-sm-4">
@@ -15,6 +15,14 @@
15
15
  </div>
16
16
  </div>
17
17
  <% end %>
18
+ <% @presented_job.optional_args.each do |arg| %>
19
+ <div class="form-group row">
20
+ <label class="col-sm-2 col-form-label" for="<%= arg %>"><%= arg %>:</label>
21
+ <div class="col-sm-4">
22
+ <input class="form-control" type="text" name="<%= arg %>" id="<%= arg %>"/>
23
+ </div>
24
+ </div>
25
+ <% end %>
18
26
  <% if @presented_job.has_rest_args %>
19
27
  <div class="form-group row">
20
28
  <label class="col-sm-2 col-form-label" for="rest_args">*Rest arguments (please provide a json string representing the arguments):</label>
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: 0.2.1
4
+ version: 0.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: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry