rocketjob_mission_control 5.0.1 → 6.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/config/manifest.js +3 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/javascripts/rocket_job_mission_control/application.js +10 -11
- data/app/assets/javascripts/rocket_job_mission_control/base.js +1 -1
- data/app/assets/javascripts/rocket_job_mission_control/bootstrap.min.js +6 -0
- data/app/assets/javascripts/rocket_job_mission_control/{datatable.js → datatable_init.js} +0 -0
- data/{vendor/assets/javascripts → app/assets/javascripts/rocket_job_mission_control}/datatables.min.js +0 -0
- data/app/assets/javascripts/rocket_job_mission_control/dirmon_entries.js +1 -1
- data/app/assets/javascripts/rocket_job_mission_control/jquery-3.5.1.min.js +2 -0
- data/app/assets/javascripts/rocket_job_mission_control/nested_fields.js +112 -0
- data/app/assets/javascripts/rocket_job_mission_control/selectize.min.js +3 -0
- data/app/assets/javascripts/rocket_job_mission_control/selectize_init.js +6 -0
- data/app/assets/stylesheets/rocket_job_mission_control/{application.scss → application.css} +9 -8
- data/app/assets/stylesheets/rocket_job_mission_control/base.css +420 -0
- data/app/assets/stylesheets/rocket_job_mission_control/bootstrap.min.css.erb +6 -0
- data/app/assets/stylesheets/rocket_job_mission_control/bootstrap.min.css.map +1 -0
- data/app/assets/stylesheets/rocket_job_mission_control/{callout.scss → callout.css} +50 -52
- data/{vendor/assets/stylesheets → app/assets/stylesheets/rocket_job_mission_control}/datatables.min.css +0 -0
- data/{vendor/assets/stylesheets → app/assets/stylesheets/rocket_job_mission_control}/fontawesome-all.min.css.erb +0 -0
- data/app/assets/stylesheets/rocket_job_mission_control/jobs.css +56 -0
- data/app/assets/stylesheets/rocket_job_mission_control/selectize.bootstrap3.css +1 -0
- data/app/assets/stylesheets/rocket_job_mission_control/selectize.css +19 -0
- data/app/assets/stylesheets/rocket_job_mission_control/worker_processes.css +7 -0
- data/app/controllers/rocket_job_mission_control/application_controller.rb +2 -0
- data/app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb +23 -23
- data/app/controllers/rocket_job_mission_control/jobs_controller.rb +57 -7
- data/app/controllers/rocket_job_mission_control/servers_controller.rb +7 -7
- data/app/datatables/rocket_job_mission_control/dirmon_entries_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/jobs_datatable.rb +1 -1
- data/app/helpers/rocket_job_mission_control/application_helper.rb +52 -27
- data/app/helpers/rocket_job_mission_control/dirmon_entries_helper.rb +12 -0
- data/app/helpers/rocket_job_mission_control/jobs_helper.rb +76 -8
- data/app/helpers/rocket_job_mission_control/servers_helper.rb +4 -0
- data/app/models/rocket_job_mission_control/dirmon_sanitizer.rb +68 -0
- data/app/models/rocket_job_mission_control/job_sanitizer.rb +38 -0
- data/app/views/layouts/rocket_job_mission_control/application.html.erb +2 -2
- data/app/views/layouts/rocket_job_mission_control/partials/_flash.html.erb +4 -4
- data/app/views/rocket_job_mission_control/dirmon_entries/_form.html.erb +78 -42
- data/app/views/rocket_job_mission_control/dirmon_entries/_input_categories.html.erb +59 -0
- data/app/views/rocket_job_mission_control/dirmon_entries/_input_category_fields.html.erb +56 -0
- data/app/views/rocket_job_mission_control/dirmon_entries/_output_categories.html.erb +44 -0
- data/app/views/rocket_job_mission_control/dirmon_entries/_output_category_fields.html.erb +36 -0
- data/app/views/rocket_job_mission_control/dirmon_entries/_status.html.erb +22 -16
- data/app/views/rocket_job_mission_control/dirmon_entries/copy.html.erb +1 -1
- data/app/views/rocket_job_mission_control/dirmon_entries/edit.html.erb +7 -3
- data/app/views/rocket_job_mission_control/dirmon_entries/show.html.erb +2 -3
- data/app/views/rocket_job_mission_control/jobs/_attributes.html.erb +28 -0
- data/app/views/rocket_job_mission_control/jobs/_dates.html.erb +35 -0
- data/app/views/rocket_job_mission_control/jobs/_details.html.erb +125 -0
- data/app/views/rocket_job_mission_control/jobs/_exception.html.erb +22 -0
- data/app/views/rocket_job_mission_control/jobs/_input_categories.html.erb +76 -0
- data/app/views/rocket_job_mission_control/jobs/_input_category_fields.html.erb +56 -0
- data/app/views/rocket_job_mission_control/jobs/_output_categories.html.erb +49 -0
- data/app/views/rocket_job_mission_control/jobs/_output_category_fields.html.erb +36 -0
- data/app/views/rocket_job_mission_control/jobs/_retryable.html.erb +16 -0
- data/app/views/rocket_job_mission_control/jobs/_status.html.erb +20 -48
- data/app/views/rocket_job_mission_control/jobs/edit.html.erb +28 -0
- data/app/views/rocket_job_mission_control/jobs/edit_slice.html.erb +2 -2
- data/app/views/rocket_job_mission_control/jobs/exception.html.erb +1 -1
- data/app/views/rocket_job_mission_control/jobs/index.html.erb +24 -18
- data/app/views/rocket_job_mission_control/jobs/show.html.erb +32 -58
- data/app/views/rocket_job_mission_control/jobs/view_slice.html.erb +6 -4
- data/config/initializers/assets.rb +3 -4
- data/lib/rocket_job_mission_control/engine.rb +2 -2
- data/lib/rocket_job_mission_control/version.rb +1 -1
- data/test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb +3 -3
- data/test/controllers/rocket_job_mission_control/jobs_controller_test.rb +7 -6
- data/test/controllers/rocket_job_mission_control/servers_controller_test.rb +3 -3
- data/test/models/rocket_job_mission_control/dirmon_sanitizer_test.rb +146 -0
- data/test/models/rocket_job_mission_control/job_sanitizer_test.rb +1 -1
- data/test/test_helper.rb +5 -11
- metadata +62 -41
- data/app/assets/javascripts/rocket_job_mission_control/selectize.js +0 -8
- data/app/assets/stylesheets/rocket_job_mission_control/base.scss +0 -436
- data/app/assets/stylesheets/rocket_job_mission_control/bootstrap_and_overrides.scss +0 -488
- data/app/assets/stylesheets/rocket_job_mission_control/jobs.scss +0 -72
- data/app/assets/stylesheets/rocket_job_mission_control/worker_processes.scss +0 -9
- data/vendor/assets/javascripts/bootstrap.min.js +0 -7
- data/vendor/assets/javascripts/microplugin.js +0 -135
- data/vendor/assets/javascripts/selectize.js +0 -3058
- data/vendor/assets/javascripts/sifter.js +0 -470
- data/vendor/assets/stylesheets/bootstrap.min.css +0 -6
- data/vendor/assets/stylesheets/bootstrap.min.css.map +0 -1
- data/vendor/assets/stylesheets/selectize.bootstrap3.css +0 -408
- data/vendor/assets/stylesheets/selectize.css +0 -317
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class='lead'>Retryable:</div>
|
2
|
+
<div class='row'>
|
3
|
+
<div class='col-md-12'>
|
4
|
+
<table>
|
5
|
+
<tr>
|
6
|
+
<td><label>Retry Limit</label></td>
|
7
|
+
<td><%= @job.retry_limit %></td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td><label>Failures</label></td>
|
11
|
+
<td><%= @job.failed_at_list.ai(html: true, plain: true) %></td>
|
12
|
+
</tr>
|
13
|
+
</table>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<br/>
|
@@ -1,58 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<% if description = status.delete('description') %>
|
8
|
-
<div class='status-message'><label>Description:</label> <%= description %></div>
|
1
|
+
<%= render partial: 'details', locals: {job: @job} %>
|
2
|
+
<%= render partial: 'dates', locals: {job: @job} %>
|
3
|
+
<% if @job.respond_to?(:failed_at_list) && @job.failed_at_list.present? %>
|
4
|
+
<%= render partial: 'retryable', locals: {job: @job} %>
|
9
5
|
<% end %>
|
10
|
-
|
11
|
-
<% if
|
12
|
-
|
6
|
+
<% @attributes = job_custom_fields(@job) %>
|
7
|
+
<% if @attributes.present? %>
|
8
|
+
<%= render partial: 'attributes', locals: {attributes: @attributes} %>
|
13
9
|
<% end %>
|
14
|
-
|
15
|
-
<% if record_count = status.delete('record_count') %>
|
16
|
-
<div class='status-message'><label>Record Count:</label> <%= record_count %></div>
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<div class='created_at'>
|
20
|
-
<label>Created At:</label> <%= status.delete('created_at') %>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<% if started_at = status.delete('started_at') %>
|
24
|
-
<div class='status-message'><label>Started At:</label> <%= started_at %></div>
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<% if percent_complete = status.delete('percent_complete') %>
|
28
|
-
<div class='status-message'><label>% Complete:</label> <%= percent_complete %></div>
|
29
|
-
<% end %>
|
30
|
-
|
31
|
-
<%
|
32
|
-
remaining = {}
|
33
|
-
status.each_pair do |key, value|
|
34
|
-
next if ((value != false) && value.blank?) || ['state', '_type', 'sub_state'].include?(key)
|
35
|
-
if value.kind_of?(Hash) || value.kind_of?(Array)
|
36
|
-
remaining[key] = value
|
37
|
-
next
|
38
|
-
end
|
39
|
-
%>
|
40
|
-
<div class='status-message'><label><%= key.to_s.titleize %>:</label> <%= value %></div>
|
41
|
-
<% end %>
|
42
|
-
|
43
|
-
<div class='clearfix'></div>
|
44
|
-
|
45
|
-
<% if job.respond_to?('input') && job.input.failed.count.positive? %>
|
46
|
-
<% status.delete('exception') %>
|
10
|
+
<% if @job.respond_to?(:input) && @job.input.failed.count.positive? %>
|
47
11
|
<div class='status-message'>
|
48
12
|
<label><%= 'Exceptions' %>:</label>
|
49
13
|
<%= render partial: 'exceptions', locals: {job: @job} %>
|
50
14
|
</div>
|
15
|
+
<% elsif @job.exception.present? %>
|
16
|
+
<%= render partial: 'exception', locals: {job: @job} %>
|
51
17
|
<% end %>
|
52
|
-
|
53
|
-
<% remaining.each_pair do |key, value| %>
|
18
|
+
<% if @job.respond_to?(:statistics) && @job.statistics.present? %>
|
54
19
|
<div class='status-message'>
|
55
|
-
<label
|
56
|
-
<
|
20
|
+
<label>Statistics:</label>
|
21
|
+
<td><%= @job.statistics.ai(html: true, plain: true, sort_keys: true) %></td>
|
57
22
|
</div>
|
23
|
+
<br/>
|
24
|
+
<% end %>
|
25
|
+
<% if @job.respond_to?(:input_categories) && @job.input_categories.present? %>
|
26
|
+
<%= render partial: 'input_categories', locals: {job: @job} %>
|
27
|
+
<% end %>
|
28
|
+
<% if @job.respond_to?(:output_categories) && @job.output_categories.present? %>
|
29
|
+
<%= render partial: 'output_categories', locals: {job: @job} %>
|
58
30
|
<% end %>
|
@@ -24,6 +24,34 @@
|
|
24
24
|
<% end %>
|
25
25
|
</div>
|
26
26
|
</div>
|
27
|
+
|
28
|
+
<% if @job.class.respond_to?(:defined_input_categories) && @job.class.respond_to?(:defined_output_categories) %>
|
29
|
+
<div class="row">
|
30
|
+
<div class="col-sm-6">
|
31
|
+
<div class="panel panel-primary">
|
32
|
+
<div class="panel-body">
|
33
|
+
<div class='lead'>Input Categories</div>
|
34
|
+
|
35
|
+
<%= f.fields_for :input_categories do |i| %>
|
36
|
+
<%= render "input_category_fields.html", f: i %>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="col-sm-6">
|
43
|
+
<div class="panel panel-success">
|
44
|
+
<div class="panel-body">
|
45
|
+
<div class='lead'>Output Categories</div>
|
46
|
+
|
47
|
+
<%= f.fields_for :output_categories do |o| %>
|
48
|
+
<%= render "output_category_fields.html", f: o %>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
27
55
|
</div>
|
28
56
|
</div>
|
29
57
|
|
@@ -6,9 +6,9 @@
|
|
6
6
|
<%= form_for(:job, url: update_slice_job_path(@job, offset: @offset, error_type: @failure_exception.class_name), method: :patch) do |f| %>
|
7
7
|
<% @lines.each_with_index do |line, index| %>
|
8
8
|
<% if @line_index == index %>
|
9
|
-
<%= f.text_area :records, :
|
9
|
+
<%= f.text_area :records, value: line, class: 'input_slices', id: index, multiple: true, rows: 14, cols: 10, wrap: "soft" %>
|
10
10
|
<% else %>
|
11
|
-
<%= f.hidden_field :records, :
|
11
|
+
<%= f.hidden_field :records, value: line, class: 'input_slices', id: index, multiple: true %>
|
12
12
|
<% end %>
|
13
13
|
<% end %>
|
14
14
|
|
@@ -1,28 +1,34 @@
|
|
1
1
|
<div class='job-list'>
|
2
2
|
<div class='list'>
|
3
|
-
<div class=
|
4
|
-
<div class=
|
5
|
-
<
|
6
|
-
|
3
|
+
<div class="panel panel-default">
|
4
|
+
<div class="panel-heading">
|
5
|
+
<div class='row'>
|
6
|
+
<div class='col-sm-10'>
|
7
|
+
<h2><%= @description %> Jobs</h2>
|
8
|
+
</div>
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
<div class='col-sm-2'>
|
11
|
+
<div class='btn btn-default pull-right dt-reload' data-behavior='reload'>
|
12
|
+
<i class='fas fa-sync'></i>
|
13
|
+
</div>
|
14
|
+
</div>
|
11
15
|
</div>
|
12
16
|
</div>
|
13
|
-
</div>
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
<div class="panel-body">
|
19
|
+
<table class='table datatable jobs-datatable' data-source='<%= @data_table_url %>' style='width: 100%'>
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<% @columns.each do |column| %>
|
23
|
+
<th><%= column[:display] %></th>
|
24
|
+
<% end %>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
23
27
|
|
24
|
-
|
25
|
-
|
28
|
+
<tbody></tbody>
|
29
|
+
</table>
|
30
|
+
</div>
|
31
|
+
</div>
|
26
32
|
</div>
|
27
33
|
</div>
|
28
34
|
|
@@ -1,70 +1,44 @@
|
|
1
1
|
<div class='row'>
|
2
|
-
<div
|
3
|
-
<div
|
4
|
-
<div class='lead'><%= @job.class.name %></div>
|
2
|
+
<div id='job'>
|
3
|
+
<div class='lead'><%= image_tag('rocket_job_mission_control/rocket-icon-64x64.png') %><%= @job.class.name %>
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
<div class=
|
9
|
-
|
10
|
-
|
11
|
-
<% if sub_state = @job['sub_state'] %>
|
12
|
-
<div class='job-state inline-block'>
|
13
|
-
<div class='left'>Batch</div>
|
14
|
-
<div class='running right'><%= @job.sub_state %></div>
|
5
|
+
<div class='btn-toolbar job-actions'>
|
6
|
+
<% if @job.scheduled? && can?(:run_now, @job) %>
|
7
|
+
<div class='btn-group'>
|
8
|
+
<%= job_action_links_for_show('Run', rocket_job_mission_control.run_now_job_path(@job), :patch) %>
|
15
9
|
</div>
|
16
10
|
<% end %>
|
17
11
|
|
18
|
-
<div class='
|
19
|
-
|
20
|
-
<% if @job.
|
12
|
+
<div class='left-margin'>
|
13
|
+
<% valid_events = @job.aasm.events.collect { |e| e.name } %>
|
14
|
+
<% if valid_events.include?(:pause) && @job.pausable? && can?(:pause, @job) %>
|
15
|
+
<%= job_action_links_for_show('Pause', rocket_job_mission_control.pause_job_path(@job), :patch) %>
|
16
|
+
<% end %>
|
17
|
+
<% if valid_events.include?(:resume) && can?(:resume, @job) %>
|
18
|
+
<%= job_action_links_for_show('Resume', rocket_job_mission_control.resume_job_path(@job), :patch) %>
|
19
|
+
<% end %>
|
20
|
+
<% if valid_events.include?(:retry) && can?(:retry, @job) %>
|
21
|
+
<%= job_action_links_for_show('Retry', rocket_job_mission_control.retry_job_path(@job), :patch) %>
|
22
|
+
<% end %>
|
23
|
+
<% if valid_events.include?(:fail) && can?(:fail, @job) %>
|
24
|
+
<%= job_action_links_for_show('Fail', rocket_job_mission_control.fail_job_path(@job), :patch) %>
|
25
|
+
<% end %>
|
26
|
+
<% if valid_events.include?(:abort) && can?(:abort, @job) %>
|
27
|
+
<%= job_action_links_for_show('Abort', rocket_job_mission_control.abort_job_path(@job), :patch) %>
|
28
|
+
<% end %>
|
29
|
+
<% if can?(:destroy, @job) %>
|
30
|
+
<%= job_action_links_for_show('Destroy', rocket_job_mission_control.job_path(@job), :delete) %>
|
31
|
+
<% end %>
|
32
|
+
<% unless @job.completed? || @job.aborted? %>
|
21
33
|
<div class='btn-group'>
|
22
|
-
|
34
|
+
<% if can?(:edit, @job) %>
|
35
|
+
<%= link_to 'Edit', edit_job_path(@job), class: 'btn btn-primary' %>
|
36
|
+
<% end %>
|
23
37
|
</div>
|
24
38
|
<% end %>
|
25
|
-
|
26
|
-
<div class='left-margin'>
|
27
|
-
<% valid_events = @job.aasm.events.collect { |e| e.name } %>
|
28
|
-
|
29
|
-
<% if valid_events.include?(:pause) && @job.pausable? && can?(:pause, @job) %>
|
30
|
-
<%= job_action_links_for_show('Pause', rocket_job_mission_control.pause_job_path(@job), :patch) %>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<% if valid_events.include?(:resume) && can?(:resume, @job) %>
|
34
|
-
<%= job_action_links_for_show('Resume', rocket_job_mission_control.resume_job_path(@job), :patch) %>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<% if valid_events.include?(:retry) && can?(:retry, @job) %>
|
38
|
-
<%= job_action_links_for_show('Retry', rocket_job_mission_control.retry_job_path(@job), :patch) %>
|
39
|
-
<% end %>
|
40
|
-
|
41
|
-
<% if valid_events.include?(:fail) && can?(:fail, @job) %>
|
42
|
-
<%= job_action_links_for_show('Fail', rocket_job_mission_control.fail_job_path(@job), :patch) %>
|
43
|
-
<% end %>
|
44
|
-
|
45
|
-
<% if valid_events.include?(:abort) && can?(:abort, @job) %>
|
46
|
-
<%= job_action_links_for_show('Abort', rocket_job_mission_control.abort_job_path(@job), :patch) %>
|
47
|
-
<% end %>
|
48
|
-
|
49
|
-
<% if can?(:destroy, @job) %>
|
50
|
-
<%= job_action_links_for_show('Destroy', rocket_job_mission_control.job_path(@job), :delete) %>
|
51
|
-
<% end %>
|
52
|
-
|
53
|
-
<% unless @job.completed? || @job.aborted? %>
|
54
|
-
<div class='btn-group'>
|
55
|
-
<% if can?(:edit, @job) %>
|
56
|
-
<%= link_to 'Edit', edit_job_path(@job), class: 'btn btn-primary' %>
|
57
|
-
<% end %>
|
58
|
-
</div>
|
59
|
-
<% end %>
|
60
|
-
</div>
|
61
39
|
</div>
|
62
40
|
</div>
|
41
|
+
</div>
|
63
42
|
</div>
|
64
43
|
</div>
|
65
|
-
|
66
|
-
<div class='row'>
|
67
|
-
<div class='col-md-12'>
|
68
|
-
<%= render partial: 'status', locals: {job: @job} %>
|
69
|
-
</div>
|
70
|
-
</div>
|
44
|
+
<%= render partial: 'status', locals: {job: @job} %>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class='clearfix'></div>
|
12
12
|
|
13
13
|
<div class='message'>
|
14
|
-
<pre><code><%= @failure_exception.message %></code></pre>
|
14
|
+
<pre><code class="language-html"><%= @failure_exception.message %></code></pre>
|
15
15
|
</div>
|
16
16
|
|
17
17
|
</div>
|
@@ -23,7 +23,9 @@
|
|
23
23
|
<%= render partial: 'layouts/rocket_job_mission_control/partials/flash' %>
|
24
24
|
<br>
|
25
25
|
<% end %>
|
26
|
+
|
26
27
|
<div class='message' tabindex="<%= index + 1 %>" id="<%= index + 1 %>">
|
28
|
+
|
27
29
|
<pre><span>Line: <%= index + 1 %></span><br><br><code><%= line %></code><br><br>
|
28
30
|
<% if can?(:edit_slice, @job) %><div class='edit_button'><%= link_to "Edit", edit_slice_job_path(@job, offset: @offset, error_type: @failure_exception.class_name, line_index: index), class: 'btn btn-primary' %></div><% end %><div class='edit_button'> <%= link_to "Back", job_path(@job), class: 'btn btn-warning' %></div>
|
29
31
|
</pre>
|
@@ -41,7 +43,7 @@
|
|
41
43
|
</div>
|
42
44
|
|
43
45
|
<script>
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
$(document).ready(function () {
|
47
|
+
document.getElementById(<%= @view_slice_pagination[:record_number] %>).focus();
|
48
|
+
});
|
47
49
|
</script>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
Rails.application.config.assets.precompile <<
|
2
|
-
true if path =~ /\.(eot|svg|ttf|woff)\z/
|
3
|
-
end
|
4
|
-
|
1
|
+
Rails.application.config.assets.precompile << ["*.svg", "*.eot", "*.woff", "*.ttf"]
|
5
2
|
Rails.application.config.assets.precompile += %w[
|
3
|
+
rocket_job_mission_control/application.css
|
4
|
+
rocket_job_mission_control/application.js
|
6
5
|
rocket_job_mission_control/favicon.png
|
7
6
|
rocket_job_mission_control/safari-pinned-tab.svg
|
8
7
|
rocket_job_mission_control/favicon-16x16.png
|
@@ -8,9 +8,9 @@ module RocketJobMissionControl
|
|
8
8
|
isolate_namespace RocketJobMissionControl
|
9
9
|
|
10
10
|
require "rocketjob"
|
11
|
-
require "jquery-rails"
|
12
|
-
require "sass-rails"
|
13
11
|
require "access-granted"
|
12
|
+
require "turbolinks"
|
13
|
+
|
14
14
|
begin
|
15
15
|
require "rocketjob_enterprise"
|
16
16
|
rescue LoadError
|
@@ -60,7 +60,7 @@ module RocketJobMissionControl
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "alerts the user" do
|
63
|
-
assert_equal I18n.t(:failure, scope: %i[dirmon_entry enable]), flash[:
|
63
|
+
assert_equal I18n.t(:failure, scope: %i[dirmon_entry enable]), flash[:danger]
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -91,7 +91,7 @@ module RocketJobMissionControl
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it "alerts the user" do
|
94
|
-
assert_equal I18n.t(:failure, scope: %i[dirmon_entry disable]), flash[:
|
94
|
+
assert_equal I18n.t(:failure, scope: %i[dirmon_entry disable]), flash[:danger]
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -277,7 +277,7 @@ module RocketJobMissionControl
|
|
277
277
|
end
|
278
278
|
|
279
279
|
it "adds a flash alert message" do
|
280
|
-
assert_equal I18n.t(:failure, scope: %i[dirmon_entry find], id: 42), flash[:
|
280
|
+
assert_equal I18n.t(:failure, scope: %i[dirmon_entry find], id: 42), flash[:danger]
|
281
281
|
end
|
282
282
|
end
|
283
283
|
|
@@ -26,7 +26,8 @@ module RocketJobMissionControl
|
|
26
26
|
end
|
27
27
|
|
28
28
|
let :failed_job do
|
29
|
-
job = KaboomBatchJob.new
|
29
|
+
job = KaboomBatchJob.new
|
30
|
+
job.input_category.slice_size = 1
|
30
31
|
job.upload do |stream|
|
31
32
|
stream << "first record"
|
32
33
|
stream << "second record"
|
@@ -64,7 +65,7 @@ module RocketJobMissionControl
|
|
64
65
|
end
|
65
66
|
|
66
67
|
it "adds a flash alert message" do
|
67
|
-
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:
|
68
|
+
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:danger]
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
@@ -120,7 +121,7 @@ module RocketJobMissionControl
|
|
120
121
|
end
|
121
122
|
|
122
123
|
it "adds a flash alert message" do
|
123
|
-
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:
|
124
|
+
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:danger]
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
@@ -158,7 +159,7 @@ module RocketJobMissionControl
|
|
158
159
|
end
|
159
160
|
|
160
161
|
it "adds a flash alert message" do
|
161
|
-
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:
|
162
|
+
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:danger]
|
162
163
|
end
|
163
164
|
end
|
164
165
|
|
@@ -188,7 +189,7 @@ module RocketJobMissionControl
|
|
188
189
|
end
|
189
190
|
|
190
191
|
it "adds a flash alert message" do
|
191
|
-
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:
|
192
|
+
assert_equal I18n.t(:failure, scope: %i[job find], id: 42), flash[:danger]
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
@@ -203,7 +204,7 @@ module RocketJobMissionControl
|
|
203
204
|
end
|
204
205
|
|
205
206
|
it "notifies the user" do
|
206
|
-
assert_equal I18n.t(:no_errors, scope: %i[job failures]), flash[:
|
207
|
+
assert_equal I18n.t(:no_errors, scope: %i[job failures]), flash[:warning]
|
207
208
|
end
|
208
209
|
end
|
209
210
|
|
@@ -65,7 +65,7 @@ module RocketJobMissionControl
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "does not display an error message" do
|
68
|
-
assert_nil flash[:
|
68
|
+
assert_nil flash[:danger]
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -90,7 +90,7 @@ module RocketJobMissionControl
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "displays a flash message" do
|
93
|
-
assert_equal I18n.t(:success, scope: %i[server destroy]), flash[:
|
93
|
+
assert_equal I18n.t(:success, scope: %i[server destroy]), flash[:success]
|
94
94
|
end
|
95
95
|
|
96
96
|
it "destroys the server" do
|
@@ -108,7 +108,7 @@ module RocketJobMissionControl
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "displays a flash message" do
|
111
|
-
assert_equal I18n.t(:failure, scope: %i[server find], id: 999_999), flash[:
|
111
|
+
assert_equal I18n.t(:failure, scope: %i[server find], id: 999_999), flash[:danger]
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require_relative "../../test_helper"
|
2
|
+
|
3
|
+
class DirmonSanitizerTest < Minitest::Test
|
4
|
+
describe RocketJobMissionControl::DirmonSanitizer do
|
5
|
+
class SampleJob < RocketJob::Job
|
6
|
+
include RocketJob::Batch
|
7
|
+
|
8
|
+
input_category format: :csv
|
9
|
+
output_category format: :csv
|
10
|
+
output_category name: :errors, format: :csv
|
11
|
+
|
12
|
+
field :client_name, type: String, user_editable: true
|
13
|
+
field :zip_code, type: Integer, user_editable: true
|
14
|
+
|
15
|
+
self.destroy_on_complete = false
|
16
|
+
|
17
|
+
def perform(record)
|
18
|
+
record
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
let :sample_job do
|
23
|
+
SampleJob.new
|
24
|
+
end
|
25
|
+
|
26
|
+
let :job_class_name do
|
27
|
+
SampleJob.name
|
28
|
+
end
|
29
|
+
|
30
|
+
let :properties do
|
31
|
+
{
|
32
|
+
client_name: "Jack",
|
33
|
+
zip_code: 12345,
|
34
|
+
input_categories_attributes: {0 => {format: :json}},
|
35
|
+
output_categories_attributes: {0 => {name: :errors, format: :json}}
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
let :sanitized_properties do
|
40
|
+
{
|
41
|
+
client_name: "Jill",
|
42
|
+
zip_code: 45673,
|
43
|
+
input_categories: [{name: "main", format: "json", slice_size: 100, skip_unknown: "false"}],
|
44
|
+
output_categories: [{name: "errors", format: "json"}]
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
let :dirmon_entry do
|
49
|
+
RocketJob::DirmonEntry.new(
|
50
|
+
name: "Test",
|
51
|
+
job_class_name: job_class_name,
|
52
|
+
pattern: "the_path",
|
53
|
+
properties: properties
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".sanitize" do
|
58
|
+
it "passes permissible fields" do
|
59
|
+
params = {
|
60
|
+
name: "Test2",
|
61
|
+
job_class_name: job_class_name,
|
62
|
+
pattern: "another/path",
|
63
|
+
archive_directory: "archive/path",
|
64
|
+
properties: properties
|
65
|
+
}
|
66
|
+
cleansed = RocketJobMissionControl::DirmonSanitizer.sanitize(params, SampleJob, dirmon_entry)
|
67
|
+
assert_equal 0, dirmon_entry.errors.count
|
68
|
+
expected = {:archive_directory => "archive/path", :job_class_name => "DirmonSanitizerTest::SampleJob", :name => "Test2", :pattern => "another/path", :properties => {:client_name => "Jack", :zip_code => 12345, :input_categories => [{:format => :json}], :output_categories => [{:name => :errors, :format => :json}]}}
|
69
|
+
assert_equal expected, cleansed
|
70
|
+
end
|
71
|
+
|
72
|
+
it "strips blank values" do
|
73
|
+
params = {
|
74
|
+
name: "",
|
75
|
+
job_class_name: "",
|
76
|
+
pattern: "",
|
77
|
+
archive_directory: "",
|
78
|
+
bad_field: "Not permissible",
|
79
|
+
properties: {
|
80
|
+
client_name: "",
|
81
|
+
zip_code: "",
|
82
|
+
input_categories_attributes: {0 => {format: ""}},
|
83
|
+
output_categories_attributes: {0 => {name: "", format: ""}}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
cleansed = RocketJobMissionControl::DirmonSanitizer.sanitize(params, SampleJob, dirmon_entry)
|
87
|
+
assert_equal 0, dirmon_entry.errors.count
|
88
|
+
expected = {}
|
89
|
+
assert_equal expected, cleansed
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe ".diff_category" do
|
94
|
+
it "returns only different values" do
|
95
|
+
default_category = sample_job.input_category
|
96
|
+
properties = {
|
97
|
+
name: "main",
|
98
|
+
format: "psv",
|
99
|
+
slice_size: 100,
|
100
|
+
skip_unknown: false
|
101
|
+
}
|
102
|
+
updated_category = RocketJob::Category::Input.new(properties)
|
103
|
+
|
104
|
+
diff = RocketJobMissionControl::DirmonSanitizer.diff_category(properties, updated_category, default_category)
|
105
|
+
|
106
|
+
expected = {:format => "psv", :name => "main"}
|
107
|
+
assert_equal expected, diff
|
108
|
+
end
|
109
|
+
|
110
|
+
it "is empty with no changes" do
|
111
|
+
default_category = sample_job.input_category
|
112
|
+
properties = {
|
113
|
+
name: "main",
|
114
|
+
format: "csv",
|
115
|
+
slice_size: 100,
|
116
|
+
skip_unknown: false
|
117
|
+
}
|
118
|
+
updated_category = RocketJob::Category::Input.new(properties)
|
119
|
+
|
120
|
+
diff = RocketJobMissionControl::DirmonSanitizer.diff_category(properties, updated_category, default_category)
|
121
|
+
|
122
|
+
expected = {}
|
123
|
+
assert_equal expected, diff
|
124
|
+
end
|
125
|
+
|
126
|
+
it "empty" do
|
127
|
+
default_category = sample_job.input_category
|
128
|
+
properties = {}
|
129
|
+
updated_category = RocketJob::Category::Input.new(properties)
|
130
|
+
|
131
|
+
diff = RocketJobMissionControl::DirmonSanitizer.diff_category(properties, updated_category, default_category)
|
132
|
+
|
133
|
+
expected = {}
|
134
|
+
assert_equal expected, diff
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe ".diff_properties" do
|
139
|
+
it "returns only different values" do
|
140
|
+
diff = RocketJobMissionControl::DirmonSanitizer.diff_properties(sanitized_properties, dirmon_entry)
|
141
|
+
expected = {:client_name => "Jill", :zip_code => 45673, :input_categories => [{:format => "json", :name => "main"}], :output_categories => [{:format => "json", :name => "errors"}]}
|
142
|
+
assert_equal expected, diff
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -81,7 +81,7 @@ class JobSanitizerTest < Minitest::Test
|
|
81
81
|
assert_equal error.first, :properties
|
82
82
|
assert error.second.include?("unexpected token"), error
|
83
83
|
end
|
84
|
-
assert_equal({
|
84
|
+
assert_equal({string: "hello"}, cleansed)
|
85
85
|
end
|
86
86
|
|
87
87
|
it "Keeps empty JSON Hash" do
|