rocketjob_mission_control 6.0.3 → 6.0.7

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: ee3de74ff7aef46373fef456bc82a5132d26426623ef6368cf3023e42b77ef33
4
- data.tar.gz: ce788f2b01b7d4599f11affffadb4ff603430726e802fdd1319ec835e1ca43e3
3
+ metadata.gz: acfef3f0baeb7f77456017eea56cf2603d07a4b0a67680dae56a4c85538b03aa
4
+ data.tar.gz: 19838dd8a5a4c52ef3a3e1845385177a0be0767fbc615e1e2273d94dbcfad302
5
5
  SHA512:
6
- metadata.gz: ed24f68177bd702dd64c788dce94a1f2e72d685b5fd560b579dde45deff86b42c49ab5d469fb63f143bf0f52fbaea0f3c2571e99de8f348c4ecb25e1ea981f84
7
- data.tar.gz: 02a1b7a5e4e8988b6fed0d538636ac7516258e5b166d0a780c10c80f73af7c1b98f1a95ba869ac94ecaa8146ceea5ce9637e3bc0e705cda605abe37eec836755
6
+ metadata.gz: 355c93354dcf70b252b095c6e1b88110fe5de17a66a44b474c1a2aee410defdbc6f281cdd41c4492233336746846f1dda12daa6b33783b603169f667cbb0bc4a
7
+ data.tar.gz: 62ff5912802c435937c5573d62db9dd7a226f4f462cd330dd84e4b3b453c5aedf06ee13a05d882d8fae86f641759148ec9485fe5fe334952d741a40816eb61ca
@@ -20,7 +20,7 @@ module RocketJobMissionControl
20
20
  else
21
21
  {roles: %i[admin]}
22
22
  end
23
- AccessPolicy.new(Authorization.new(**@args))
23
+ RocketJobMissionControl::AccessPolicy.new(Authorization.new(**@args))
24
24
  end
25
25
  end
26
26
 
@@ -87,9 +87,14 @@ module RocketJobMissionControl
87
87
  dirmon_entry_replicate.properties = JobSanitizer.sanitize(properties, dirmon_entry_replicate.job_class, @dirmon_entry, false)
88
88
  end
89
89
 
90
- if dirmon_entry_replicate.errors.empty? && dirmon_entry_replicate.valid? && dirmon_entry_replicate.update_attributes(dirmon_params)
90
+ if dirmon_entry_replicate.update_attributes(dirmon_params)
91
91
  redirect_to(rocket_job_mission_control.dirmon_entry_path(dirmon_entry_replicate))
92
92
  else
93
+ dirmon_params.each { |k,v| @dirmon_entry.send("#{k}=", v) }
94
+ @dirmon_entry.properties = dirmon_entry_replicate.properties
95
+ dirmon_entry_replicate.errors.messages.each_pair do |field, message|
96
+ @dirmon_entry.errors.add(field, message)
97
+ end
93
98
  render :copy
94
99
  end
95
100
  end
@@ -93,7 +93,7 @@ module RocketJobMissionControl
93
93
  f.text_field(field_name, value: value ? value.to_json : "", class: "form-control", placeholder: '{"key1":"value1", "key2":"value2", "key3":"value3"}')
94
94
  when "Array"
95
95
  options = value.present? ? Array(value) : []
96
- f.select(field_name, options_for_select(options, options), {}, {class: "selectize form-control", multiple: true})
96
+ f.select(field_name, options_for_select(options, options), {include_hidden: true}, {class: "selectize form-control", multiple: true})
97
97
  else
98
98
  "[#{field.type.name}]".html_safe +
99
99
  f.text_field(field_name, value: value, class: "form-control", placeholder: placeholder)
@@ -36,6 +36,11 @@ module RocketJobMissionControl
36
36
  target.errors.add(:properties, e.message)
37
37
  value = nil
38
38
  end
39
+ when "Array"
40
+ # remove blank entries from rails converted arrays when using multi-select input
41
+ if !value.blank?
42
+ value.reject! { |v| v.empty? }
43
+ end
39
44
  end
40
45
 
41
46
  if value.blank? && !value.is_a?(Hash)
@@ -0,0 +1,33 @@
1
+ <div class='lead'>Details:</div>
2
+ <div class='row'>
3
+ <div class='col-md-12 job-status'>
4
+ <table>
5
+ <tr>
6
+ <td><label>State:</label></td>
7
+ <td>
8
+ <div class='job-state inline-block'>
9
+ <div class='left'>State</div>
10
+ <div class="<%= @dirmon_entry.state %> right"><%= @dirmon_entry.state %></div>
11
+ </div>
12
+ </td>
13
+ </tr>
14
+ <tr>
15
+ <td><label>Job Class:</label></td>
16
+ <td><%= @dirmon_entry.job_class_name %></td>
17
+ </tr>
18
+ <tr>
19
+ <td><label>Pattern:</label></td>
20
+ <td><%= @dirmon_entry.pattern %></td>
21
+ </tr>
22
+ <tr>
23
+ <td><label>Archive Directory:</label></td>
24
+ <td><%= @dirmon_entry.archive_directory %></td>
25
+ </tr>
26
+ <tr>
27
+ <td><label>ID:</label></td>
28
+ <td><%= @dirmon_entry.id %></td>
29
+ </tr>
30
+ </table>
31
+ </div>
32
+ </div>
33
+ <br/>
@@ -0,0 +1,22 @@
1
+ <div class='lead'>Exception:</div>
2
+ <div class='row'>
3
+ <div class='col-md-12'>
4
+ <table>
5
+ <tr>
6
+ <td><label>Exception:</label></td>
7
+ <td><%= @dirmon_entry.exception.class_name %></td>
8
+ </tr>
9
+ <tr>
10
+ <td><label>Message:</label></td>
11
+ <td><%= @dirmon_entry.exception.message %></td>
12
+ </tr>
13
+ <% if @dirmon_entry.exception.backtrace.present? %>
14
+ <tr>
15
+ <td><label>Backtrace:</label></td>
16
+ <td><%= @dirmon_entry.exception.backtrace.ai(html: true, plain: true) %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+ </div>
21
+ </div>
22
+ <br/>
@@ -0,0 +1,28 @@
1
+ <div class='lead'>Properties:</div>
2
+ <div class='row'>
3
+ <div class='col-md-12'>
4
+ <table>
5
+ <% @dirmon_entry.properties.keys.sort.each do |key| %>
6
+ <%
7
+ value = @dirmon_entry.properties[key]
8
+ key = key.to_s.titleize
9
+ %>
10
+ <tr>
11
+ <td><label><%= key %>:</label></td>
12
+ <% if value.nil? %>
13
+ <td><label>nil</label></td>
14
+ <% else %>
15
+ <td>
16
+ <% if value.is_a?(String) %>
17
+ <pre><code><%= simple_format(value) %></code></pre>
18
+ <% else %>
19
+ <%= value.ai(html: true, plain: true) %>
20
+ <% end %>
21
+ </td>
22
+ <% end %>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ </div>
27
+ </div>
28
+ <br/>
@@ -1,43 +1,36 @@
1
- <div class='col-md-12 job-status'>
1
+ <div class='row'>
2
2
  <div id='job'>
3
- <div class='lead'><%= @dirmon_entry.name %></div>
4
-
5
- <div class='job-state inline-block'>
6
- <div class='left'>status</div>
7
- <div class="<%= @dirmon_entry.state %> right"><%= @dirmon_entry.state %></div>
8
- </div>
9
-
10
- <div class='btn-toolbar job-actions'>
11
- <div class='btn-group'>
12
- <% if (@dirmon_entry.disabled? || @dirmon_entry.pending?) && can?(:enable, @dirmon_entry) %>
13
- <%= link_to 'Enable', enable_dirmon_entry_path(@dirmon_entry.id), method: :put, class: 'btn btn-default' %>
14
- <% end %>
15
- <% if @dirmon_entry.enabled? && can?(:disable, @dirmon_entry)%>
16
- <%= link_to 'Disable', disable_dirmon_entry_path(@dirmon_entry.id), method: :put, class: 'btn btn-default', data: { confirm: 'Are you sure?' } %>
17
- <% end %>
18
- </div>
3
+ <div class='lead'><%= image_tag('rocket_job_mission_control/rocket-icon-64x64.png') %><%= @dirmon_entry.name %>
19
4
 
5
+ <div class='btn-toolbar job-actions'>
6
+ <div class='btn-group'>
7
+ <% if @dirmon_entry.may_enable? && can?(:enable, @dirmon_entry) %>
8
+ <%= link_to 'Enable', enable_dirmon_entry_path(@dirmon_entry.id), method: :put, class: 'btn btn-default', data: {confirm: 'Are you sure you want to enable this Dirmon Entry?'} %>
9
+ <% end %>
10
+ <% if @dirmon_entry.may_disable? && can?(:disable, @dirmon_entry) %>
11
+ <%= link_to 'Disable', disable_dirmon_entry_path(@dirmon_entry.id), method: :put, class: 'btn btn-default', data: {confirm: 'Are you sure you want to disable this Dirmon Entry?'} %>
12
+ <% end %>
13
+ </div>
20
14
 
21
- <div class='btn-group'>
22
- <% if can?(:destroy, @dirmon_entry)%>
23
- <%= link_to 'Destroy', dirmon_entry_path(@dirmon_entry), method: :delete, class: 'btn btn-default', data: { confirm: 'Are you sure?' } %>
24
- <% end %>
25
- </div>
26
- <%# It shows the Copy button in each Dirmon%>
27
- <div class='btn-group'>
28
- <% if can?(:copy, @dirmon_entry)%>
29
- <%= link_to 'Copy', copy_dirmon_entry_path(@dirmon_entry), class: 'btn btn-default' %>
30
- <% end %>
31
- </div>
32
- <div class='btn-group'>
33
- <% if can?(:edit, @dirmon_entry)%>
34
- <%= link_to 'Edit', edit_dirmon_entry_path(@dirmon_entry), class: 'btn btn-default' %>
35
- <% end %>
15
+ <div class='btn-group'>
16
+ <% if can?(:destroy, @dirmon_entry) %>
17
+ <%= link_to 'Destroy', dirmon_entry_path(@dirmon_entry), method: :delete, class: 'btn btn-default', data: {confirm: 'Are you sure?'} %>
18
+ <% end %>
19
+ </div>
20
+ <div class='btn-group'>
21
+ <% if can?(:copy, @dirmon_entry) %>
22
+ <%= link_to 'Copy', copy_dirmon_entry_path(@dirmon_entry), class: 'btn btn-default' %>
23
+ <% end %>
24
+ </div>
25
+ <div class='btn-group'>
26
+ <% if can?(:edit, @dirmon_entry) %>
27
+ <%= link_to 'Edit', edit_dirmon_entry_path(@dirmon_entry), class: 'btn btn-default' %>
28
+ <% end %>
29
+ </div>
36
30
  </div>
37
31
  </div>
38
-
39
- <div class='clearfix'></div>
40
-
41
- <%= render partial: 'status', locals: {dirmon_entry: @job} %>
42
32
  </div>
43
33
  </div>
34
+ <%= render partial: 'details', locals: {dirmon_entry: @dirmon_entry} %>
35
+ <%= render partial: 'properties', locals: {dirmon_entry: @dirmon_entry} %>
36
+ <%= render partial: 'exception', locals: {dirmon_entry: @dirmon_entry} if @dirmon_entry.exception %>
@@ -1,3 +1,3 @@
1
1
  module RocketJobMissionControl
2
- VERSION = "6.0.3".freeze
2
+ VERSION = "6.0.7".freeze
3
3
  end
@@ -15,9 +15,9 @@ module RocketJobMissionControl
15
15
 
16
16
  let :existing_dirmon_entry do
17
17
  RocketJob::DirmonEntry.create!(
18
- name: "Test",
18
+ name: "Existing path test",
19
19
  job_class_name: job_class_name,
20
- pattern: "the_path"
20
+ pattern: "existing_path"
21
21
  )
22
22
  end
23
23
 
@@ -26,9 +26,9 @@ module RocketJobMissionControl
26
26
  let :one_dirmon_entry_for_every_state do
27
27
  dirmon_entry_states.collect do |state|
28
28
  RocketJob::DirmonEntry.create!(
29
- name: "Test",
29
+ name: "Test_for_state_#{state}",
30
30
  job_class_name: job_class_name,
31
- pattern: "the_path",
31
+ pattern: "path_for_state_#{state}",
32
32
  state: state
33
33
  )
34
34
  end
@@ -375,27 +375,27 @@ module RocketJobMissionControl
375
375
  json = JSON.parse(response.body)
376
376
  expected_data = {
377
377
  pending: {
378
- "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.pending.first.id}\">\n <i class=\"fas fa-inbox pending\" style=\"font-size: 75%\" title=\"pending\"></i>\n Test\n </a>\n",
378
+ "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.pending.first.id}\">\n <i class=\"fas fa-inbox pending\" style=\"font-size: 75%\" title=\"pending\"></i>\n Test_for_state_pending\n </a>\n",
379
379
  "1" => "RocketJob::Jobs::SimpleJob",
380
- "2" => "the_path",
380
+ "2" => "path_for_state_pending",
381
381
  "DT_RowClass" => "card callout callout-pending"
382
382
  },
383
383
  enabled: {
384
- "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.enabled.first.id}\">\n <i class=\"fas fa-check enabled\" style=\"font-size: 75%\" title=\"enabled\"></i>\n Test\n </a>\n",
384
+ "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.enabled.first.id}\">\n <i class=\"fas fa-check enabled\" style=\"font-size: 75%\" title=\"enabled\"></i>\n Test_for_state_enabled\n </a>\n",
385
385
  "1" => "RocketJob::Jobs::SimpleJob",
386
- "2" => "the_path",
386
+ "2" => "path_for_state_enabled",
387
387
  "DT_RowClass" => "card callout callout-enabled"
388
388
  },
389
389
  failed: {
390
- "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.failed.first.id}\">\n <i class=\"fas fa-exclamation-triangle failed\" style=\"font-size: 75%\" title=\"failed\"></i>\n Test\n </a>\n",
390
+ "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.failed.first.id}\">\n <i class=\"fas fa-exclamation-triangle failed\" style=\"font-size: 75%\" title=\"failed\"></i>\n Test_for_state_failed\n </a>\n",
391
391
  "1" => "RocketJob::Jobs::SimpleJob",
392
- "2" => "the_path",
392
+ "2" => "path_for_state_failed",
393
393
  "DT_RowClass" => "card callout callout-failed"
394
394
  },
395
395
  disabled: {
396
- "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.disabled.first.id}\">\n <i class=\"fas fa-stop disabled\" style=\"font-size: 75%\" title=\"disabled\"></i>\n Test\n </a>\n",
396
+ "0" => " <a href=\"/dirmon_entries/#{RocketJob::DirmonEntry.disabled.first.id}\">\n <i class=\"fas fa-stop disabled\" style=\"font-size: 75%\" title=\"disabled\"></i>\n Test_for_state_disabled\n </a>\n",
397
397
  "1" => "RocketJob::Jobs::SimpleJob",
398
- "2" => "the_path",
398
+ "2" => "path_for_state_disabled",
399
399
  "DT_RowClass" => "card callout callout-disabled"
400
400
  }
401
401
  }
@@ -404,7 +404,7 @@ module RocketJobMissionControl
404
404
  assert_equal 0, json["draw"]
405
405
  assert_equal 4, json["recordsTotal"]
406
406
  assert_equal 4, json["recordsFiltered"]
407
- assert_equal [expected_data[:pending], expected_data[:enabled], expected_data[:failed], expected_data[:disabled]], json["data"]
407
+ assert_equal [expected_data[:disabled], expected_data[:enabled], expected_data[:failed], expected_data[:pending]], json["data"]
408
408
  else
409
409
  assert_equal 0, json["draw"]
410
410
  assert_equal 1, json["recordsTotal"]
@@ -92,6 +92,15 @@ class JobSanitizerTest < Minitest::Test
92
92
  assert_equal 0, @job.errors.count
93
93
  assert_equal({hash_field: {}}, cleansed)
94
94
  end
95
+
96
+ it "removes blank entries from rails converted arrays when using multi-select input" do
97
+ properties = {
98
+ array: ["", "rf@exp.com", "rm@exp.com", "lb@exp.com"]
99
+ }
100
+ cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
101
+ assert_equal 0, @job.errors.count
102
+ assert_equal({array: ["rf@exp.com", "rm@exp.com", "lb@exp.com"]}, cleansed)
103
+ end
95
104
  end
96
105
  end
97
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob_mission_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.3
4
+ version: 6.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Cloutier
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-10-12 00:00:00.000000000 Z
14
+ date: 2022-02-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: access-granted
@@ -166,13 +166,15 @@ files:
166
166
  - app/views/layouts/rocket_job_mission_control/partials/_header.html.erb
167
167
  - app/views/layouts/rocket_job_mission_control/partials/_sidebar.html.erb
168
168
  - app/views/rocket_job_mission_control/active_workers/index.html.erb
169
+ - app/views/rocket_job_mission_control/dirmon_entries/_details.html.erb
170
+ - app/views/rocket_job_mission_control/dirmon_entries/_exception.html.erb
169
171
  - app/views/rocket_job_mission_control/dirmon_entries/_form.html.erb
170
172
  - app/views/rocket_job_mission_control/dirmon_entries/_input_categories.html.erb
171
173
  - app/views/rocket_job_mission_control/dirmon_entries/_input_category_fields.html.erb
172
174
  - app/views/rocket_job_mission_control/dirmon_entries/_output_categories.html.erb
173
175
  - app/views/rocket_job_mission_control/dirmon_entries/_output_category_fields.html.erb
176
+ - app/views/rocket_job_mission_control/dirmon_entries/_properties.html.erb
174
177
  - app/views/rocket_job_mission_control/dirmon_entries/_sidebar.html.erb
175
- - app/views/rocket_job_mission_control/dirmon_entries/_status.html.erb
176
178
  - app/views/rocket_job_mission_control/dirmon_entries/copy.html.erb
177
179
  - app/views/rocket_job_mission_control/dirmon_entries/edit.html.erb
178
180
  - app/views/rocket_job_mission_control/dirmon_entries/index.html.erb
@@ -240,22 +242,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
242
  - !ruby/object:Gem::Version
241
243
  version: '0'
242
244
  requirements: []
243
- rubygems_version: 3.2.22
245
+ rubygems_version: 3.1.6
244
246
  signing_key:
245
247
  specification_version: 4
246
248
  summary: Ruby's missing batch system.
247
249
  test_files:
250
+ - test/models/rocket_job_mission_control/dirmon_sanitizer_test.rb
251
+ - test/models/rocket_job_mission_control/job_sanitizer_test.rb
252
+ - test/models/rocket_job_mission_control/query_test.rb
248
253
  - test/compare_hashes.rb
249
- - test/controllers/rocket_job_mission_control/application_controller_test.rb
250
- - test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb
254
+ - test/test_helper.rb
251
255
  - test/controllers/rocket_job_mission_control/jobs_controller_test.rb
256
+ - test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb
252
257
  - test/controllers/rocket_job_mission_control/servers_controller_test.rb
258
+ - test/controllers/rocket_job_mission_control/application_controller_test.rb
253
259
  - test/helpers/rocket_job_mission_control/application_helper_test.rb
254
- - test/helpers/rocket_job_mission_control/jobs_helper_test.rb
255
- - test/helpers/rocket_job_mission_control/pagination_helper_test.rb
256
260
  - test/helpers/rocket_job_mission_control/servers_helper_test.rb
261
+ - test/helpers/rocket_job_mission_control/jobs_helper_test.rb
257
262
  - test/helpers/rocket_job_mission_control/slices_helper_test.rb
258
- - test/models/rocket_job_mission_control/dirmon_sanitizer_test.rb
259
- - test/models/rocket_job_mission_control/job_sanitizer_test.rb
260
- - test/models/rocket_job_mission_control/query_test.rb
261
- - test/test_helper.rb
263
+ - test/helpers/rocket_job_mission_control/pagination_helper_test.rb
@@ -1,26 +0,0 @@
1
- <div class='row'>
2
- <div class='col-md-12'>
3
- <div><label>Job Class:</label><%= @dirmon_entry.job_class_name %></div>
4
- <div><label>Pattern:</label><%= @dirmon_entry.pattern %></div>
5
- <div><label>Archive Directory:</label><%= @dirmon_entry.archive_directory %></div>
6
- <div class='id'><label>ID:</label><%= @dirmon_entry.id %></div>
7
- </div>
8
- </div>
9
-
10
- <div class='lead'>Properties</div>
11
- <div class='row'>
12
- <div class='col-md-12'>
13
- <% @dirmon_entry.properties.keys.sort.each do |name| %>
14
- <% value = @dirmon_entry.properties[name] %>
15
- <div class='parameters'>
16
- <label><%= name.to_s.titleize %>:</label>
17
-
18
- <% if value.is_a?(Array) || value.is_a?(Hash) %>
19
- <pre><code><%= pretty_print_array_or_hash(value) %></code></pre>
20
- <% else %>
21
- <%= value %>
22
- <% end %>
23
- </div>
24
- <% end %>
25
- </div>
26
- </div>