rocketjob_mission_control 4.0.0 → 4.1.0
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 +4 -4
- data/app/assets/stylesheets/rocket_job_mission_control/jobs.scss +20 -0
- data/app/controllers/rocket_job_mission_control/application_controller.rb +9 -2
- data/app/controllers/rocket_job_mission_control/jobs_controller.rb +87 -6
- data/app/helpers/rocket_job_mission_control/jobs_helper.rb +11 -0
- data/app/models/rocket_job_mission_control/access_policy.rb +1 -1
- data/app/views/layouts/rocket_job_mission_control/partials/_flash.html.erb +1 -1
- data/app/views/rocket_job_mission_control/jobs/_exceptions.html.erb +35 -0
- data/app/views/rocket_job_mission_control/jobs/_status.html.erb +8 -0
- data/app/views/rocket_job_mission_control/jobs/_view_slice_pagination.html.erb +31 -0
- data/app/views/rocket_job_mission_control/jobs/edit_slice.html.erb +24 -0
- data/app/views/rocket_job_mission_control/jobs/show.html.erb +23 -30
- data/app/views/rocket_job_mission_control/jobs/view_slice.html.erb +47 -0
- data/config/routes.rb +6 -2
- data/lib/rocket_job_mission_control/version.rb +1 -1
- data/test/controllers/rocket_job_mission_control/jobs_controller_test.rb +27 -0
- metadata +9 -7
- data/app/views/rocket_job_mission_control/jobs/exceptions.html.erb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e285d14af9fde45c1fec22bc89a89f96b9eb6e59dbb1cbf5baeac2946b9b4a63
|
4
|
+
data.tar.gz: fdff6c5fa69deec469be289f340fb4d82f910d8a1a9c819f703edb984e9fb773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b24c8dfebb108b5d91dfe848f80f6b62feda9ff6bfd48d5e6f85a90cffb9d865dd10c071f646e34c25ca1e4962ffc8ea62e05d21c3c1bde441f4bb48fb1b3a2
|
7
|
+
data.tar.gz: 06da811e1d6e9da338b948c463754dcced2512aac7177eea184b0a4f328872a9ceec707ccfc37d0f5f83353ab0fab6c469dc950b6ea4469edadaf7dab5098cee
|
@@ -50,3 +50,23 @@
|
|
50
50
|
border-radius: 0;
|
51
51
|
}
|
52
52
|
}
|
53
|
+
|
54
|
+
.input_slices {
|
55
|
+
font-size: 14px;
|
56
|
+
line-height: 2.0;
|
57
|
+
resize: none;
|
58
|
+
width: 100%;
|
59
|
+
height: 20em;
|
60
|
+
padding-top:5px;
|
61
|
+
padding-bottom:5px;
|
62
|
+
margin-bottom: 4px;
|
63
|
+
}
|
64
|
+
|
65
|
+
.edit_button{
|
66
|
+
float: right;
|
67
|
+
margin-left: 3px;
|
68
|
+
}
|
69
|
+
|
70
|
+
.edit_input{
|
71
|
+
margin-left: 80px;
|
72
|
+
}
|
@@ -14,13 +14,20 @@ module RocketJobMissionControl
|
|
14
14
|
|
15
15
|
def current_policy
|
16
16
|
@current_policy ||= begin
|
17
|
-
args =
|
17
|
+
@args =
|
18
18
|
if Config.authorization_callback
|
19
19
|
instance_exec(&Config.authorization_callback)
|
20
20
|
else
|
21
21
|
{roles: %i[admin]}
|
22
22
|
end
|
23
|
-
AccessPolicy.new(Authorization.new(args))
|
23
|
+
AccessPolicy.new(Authorization.new(@args))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def login
|
28
|
+
@login ||= begin
|
29
|
+
args = instance_exec(&Config.authorization_callback)
|
30
|
+
args[:login]
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
@@ -133,9 +133,90 @@ module RocketJobMissionControl
|
|
133
133
|
authorize! :edit, @job
|
134
134
|
end
|
135
135
|
|
136
|
-
def
|
137
|
-
|
138
|
-
|
136
|
+
def view_slice
|
137
|
+
# Params from RocketJob. Exceptions are grouped by class_name.
|
138
|
+
# Scope: [[slice1], [slice2], [slice(n)]
|
139
|
+
authorize! :view_slice, @job
|
140
|
+
error_type = params[:error_type]
|
141
|
+
scope = @job.input.failed.where('exception.class_name' => error_type)
|
142
|
+
|
143
|
+
# Used by pagination to display the correct slice
|
144
|
+
# Offset refers to the slice number from the array "scope".
|
145
|
+
@offset = params.fetch(:offset, 0).to_i
|
146
|
+
current_failure = scope.order(_id: 1).limit(1).skip(@offset).first
|
147
|
+
|
148
|
+
# Instance variables to share with the view and pagination.
|
149
|
+
@lines = current_failure.records
|
150
|
+
@failure_exception = current_failure.try!(:exception)
|
151
|
+
@view_slice_pagination = {
|
152
|
+
record_number: current_failure['exception']['record_number'],
|
153
|
+
offset: @offset,
|
154
|
+
total: (scope.count - 1)
|
155
|
+
}
|
156
|
+
end
|
157
|
+
|
158
|
+
def edit_slice
|
159
|
+
# We need all the instance varaibles from the view_slice (above) to able to
|
160
|
+
# Build the form as an array but only display the bad line
|
161
|
+
authorize! :edit_slice, @job
|
162
|
+
error_type = params[:error_type]
|
163
|
+
@line_index = params[:line_index].to_i
|
164
|
+
@offset = params.fetch(:offset, 0).to_i
|
165
|
+
scope = @job.input.failed.where('exception.class_name' => error_type)
|
166
|
+
current_failure = scope.order(_id: 1).limit(1).skip(@offset).first
|
167
|
+
@lines = current_failure.records
|
168
|
+
@failure_exception = current_failure.try!(:exception)
|
169
|
+
end
|
170
|
+
|
171
|
+
def update_slice
|
172
|
+
authorize! :update_slice, @job
|
173
|
+
|
174
|
+
# Params from the edit_slice form
|
175
|
+
error_type = params[:error_type]
|
176
|
+
offset = params[:offset]
|
177
|
+
updated_records = params['job']['records']
|
178
|
+
|
179
|
+
# Finds specific slice [Array]
|
180
|
+
slice = @job.input.failed.skip(offset).first
|
181
|
+
|
182
|
+
# Assings modified slice (from the form) back to slice
|
183
|
+
slice.records = updated_records
|
184
|
+
|
185
|
+
if slice.save
|
186
|
+
logger.info("Slice Updated By #{login}, job: #{@job.id}, file_name: #{@job.upload_file_name}")
|
187
|
+
flash[:success] = 'slice updated'
|
188
|
+
redirect_to view_slice_job_path(@job, error_type: error_type)
|
189
|
+
else
|
190
|
+
flash[:danger] = 'Error updating slice.'
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def delete_line
|
195
|
+
authorize! :edit_slice, @job
|
196
|
+
|
197
|
+
# Params from the edit_slice form
|
198
|
+
error_type = params[:error_type]
|
199
|
+
offset = params.fetch(:offset, 0).to_i
|
200
|
+
line_index = params[:line_index].to_i
|
201
|
+
|
202
|
+
# Finds specific slice [Array]
|
203
|
+
scope = @job.input.failed.where('exception.class_name' => error_type)
|
204
|
+
slice = scope.order(_id: 1).limit(1).skip(offset).first
|
205
|
+
|
206
|
+
# Finds and deletes line
|
207
|
+
value = slice.to_a[line_index]
|
208
|
+
slice.to_a.delete(value)
|
209
|
+
|
210
|
+
# Assings full array back to slice
|
211
|
+
slice.records = slice.to_a
|
212
|
+
|
213
|
+
if slice.save
|
214
|
+
logger.info("Line Deleted By #{login}, job: #{@job.id}, file_name: #{@job.upload_file_name}")
|
215
|
+
redirect_to view_slice_job_path(@job, error_type: error_type)
|
216
|
+
flash[:success] = 'line removed'
|
217
|
+
else
|
218
|
+
flash[:danger] = 'Error removing line.'
|
219
|
+
end
|
139
220
|
end
|
140
221
|
|
141
222
|
def exception
|
@@ -199,7 +280,7 @@ module RocketJobMissionControl
|
|
199
280
|
'Error loading jobs.'
|
200
281
|
end
|
201
282
|
|
202
|
-
|
283
|
+
raise exception if Rails.env.development? || Rails.env.test?
|
203
284
|
redirect_to :back
|
204
285
|
end
|
205
286
|
|
@@ -223,10 +304,10 @@ module RocketJobMissionControl
|
|
223
304
|
def build_table_layout(columns)
|
224
305
|
index = 0
|
225
306
|
columns.collect do |column|
|
226
|
-
h = {
|
307
|
+
h = {data: index.to_s}
|
227
308
|
h[:width] = column[:width] if column.key?(:width)
|
228
309
|
h[:orderable] = column[:orderable] if column.key?(:orderable)
|
229
|
-
index
|
310
|
+
index += 1
|
230
311
|
h
|
231
312
|
end
|
232
313
|
end
|
@@ -43,6 +43,17 @@ module RocketJobMissionControl
|
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
46
|
+
def job_action_links_for_show(action, path, http_method=:get)
|
47
|
+
link_to(
|
48
|
+
action,
|
49
|
+
path,
|
50
|
+
method: http_method,
|
51
|
+
title: "#{action} job",
|
52
|
+
class: 'btn btn-primary',
|
53
|
+
data: {confirm: t(:confirm, scope: [:job, :action], action: action)}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
46
57
|
def job_selected_class(job, selected_job)
|
47
58
|
if selected_job.present? && job.id == selected_job.id
|
48
59
|
'selected'
|
@@ -12,7 +12,7 @@ module RocketJobMissionControl
|
|
12
12
|
# View the contents of jobs and edit the data within them.
|
13
13
|
# Including encrypted records.
|
14
14
|
role :editor, {editor: true} do
|
15
|
-
can %i[
|
15
|
+
can %i[view_slice edit_slice update_slice], RocketJob::Job
|
16
16
|
end
|
17
17
|
|
18
18
|
# Stop, Pause, Resume, Destroy (force stop) Rocket Job Servers
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if flash.present? %>
|
2
2
|
<div class='flash text-center'>
|
3
3
|
<% flash.each do |key, msg| %>
|
4
|
-
<div class='alert alert
|
4
|
+
<div class='alert alert-<%=key%> alert-dismissable' role='alert'>
|
5
5
|
<button class='close' data-dismiss='alert'>
|
6
6
|
<span>×</span>
|
7
7
|
</button>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<table class='table datatable jobs-datatable' data-source='<%= jobs_url(format: 'json') %>' style='width: 100%'>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Count</th>
|
5
|
+
<th>Exception Class</th>
|
6
|
+
<th>Exception Messages</th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
|
10
|
+
<tbody>
|
11
|
+
<% @job.input.group_exceptions.each do |exception| %>
|
12
|
+
<tr>
|
13
|
+
<th><%= exception.count %></th>
|
14
|
+
<th><%= link_to(exception.class_name, exception_job_path(@job, error_type: exception.class_name), class: "card callout") %></th>
|
15
|
+
|
16
|
+
<th>
|
17
|
+
<% exception.messages.each do |message| %>
|
18
|
+
<div><%= message %></div>
|
19
|
+
<% end %>
|
20
|
+
</th>
|
21
|
+
|
22
|
+
<% if can?(:view_slice, @job) %>
|
23
|
+
<th>
|
24
|
+
<div>
|
25
|
+
<%= link_to 'View Slice', view_slice_job_path(@job, error_type: exception.class_name, record_number: @job.input.failed.first["exception"]["record_number"] ), class: 'btn btn-primary' %>
|
26
|
+
</div>
|
27
|
+
</th>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
</tr>
|
31
|
+
<% end %>
|
32
|
+
</tbody>
|
33
|
+
</table>
|
34
|
+
|
35
|
+
|
@@ -42,6 +42,14 @@
|
|
42
42
|
|
43
43
|
<div class='clearfix'></div>
|
44
44
|
|
45
|
+
<% if job.respond_to?('input') && job.input.failed.count.positive? %>
|
46
|
+
<% status.delete('exception') %>
|
47
|
+
<div class='status-message'>
|
48
|
+
<label><%= 'Exceptions' %>:</label>
|
49
|
+
<%= render partial: 'exceptions', locals: {job: @job} %>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
52
|
+
|
45
53
|
<% remaining.each_pair do |key, value| %>
|
46
54
|
<div class='status-message'>
|
47
55
|
<label><%= key.to_s.titleize %>:</label>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%
|
2
|
+
previous_offset = [0, pagination[:offset].pred].max
|
3
|
+
next_offset = [pagination[:total], pagination[:offset].next].min
|
4
|
+
record_number = pagination[:record_number]
|
5
|
+
%>
|
6
|
+
|
7
|
+
<ul class='pagination'>
|
8
|
+
<li>
|
9
|
+
<%= link_to(view_slice_job_path(error_type: error_type, offset: 0, record_number: record_number), class: "btn btn-default #{page_nav_disabled_class(pagination[:offset], 0)}", title: 'First') do %>
|
10
|
+
<i class='fas fa-angle-double-left'></i>
|
11
|
+
<% end %>
|
12
|
+
</li>
|
13
|
+
|
14
|
+
<li>
|
15
|
+
<%= link_to(view_slice_job_path(error_type: error_type, offset: previous_offset, record_number: record_number), class: "btn btn-default #{page_nav_disabled_class(pagination[:offset], 0)}", title: 'Previous') do %>
|
16
|
+
<i class='fas fa-angle-left'></i>
|
17
|
+
<% end %>
|
18
|
+
</li>
|
19
|
+
|
20
|
+
<li>
|
21
|
+
<%= link_to(view_slice_job_path(error_type: error_type, offset: next_offset, record_number: record_number), class: "btn btn-default #{page_nav_disabled_class(pagination[:offset], pagination[:total])}", title: 'Next') do %>
|
22
|
+
<i class='fas fa-angle-right'></i>
|
23
|
+
<% end %>
|
24
|
+
</li>
|
25
|
+
|
26
|
+
<li>
|
27
|
+
<%= link_to(view_slice_job_path(error_type: error_type, offset: pagination[:total], record_number: record_number), class: "btn btn-default #{page_nav_disabled_class(pagination[:offset], pagination[:total])}", title: 'Last') do %>
|
28
|
+
<i class='fas fa-angle-double-right'></i>
|
29
|
+
<% end %>
|
30
|
+
</li>
|
31
|
+
</ul>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class='edit_input'>
|
2
|
+
<div class='col-md-10'>
|
3
|
+
<% valid_events = @job.aasm.events.collect { |e| e.name } %>
|
4
|
+
<br>
|
5
|
+
<br>
|
6
|
+
<%= form_for(:job, url: update_slice_job_path(@job, offset: @offset, error_type: @failure_exception.class_name), method: :patch) do |f| %>
|
7
|
+
<% @lines.each_with_index do |line, index| %>
|
8
|
+
<% if @line_index == index %>
|
9
|
+
<%= f.text_area :records, :value => line, class: 'input_slices', id: index, multiple: true %>
|
10
|
+
<% else %>
|
11
|
+
<%= f.hidden_field :records, :value => line, class: 'input_slices', id: index, multiple: true %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div id='submit'>
|
16
|
+
<%= f.submit 'Save', class: 'btn btn-primary' %>
|
17
|
+
<%= link_to 'Delete', delete_line_job_path(@job, offset: @offset, error_type: @failure_exception.class_name, line_index: @line_index), :data => {:confirm => 'Are you sure?'}, method: :patch, class: 'btn btn-danger' %>
|
18
|
+
<%= link_to 'Cancel', view_slice_job_path(@job, error_type: @failure_exception.class_name, record_number: @job.input.failed.first["exception"]["record_number"]), class: 'btn btn-default' %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
|
@@ -16,55 +16,48 @@
|
|
16
16
|
<% end %>
|
17
17
|
|
18
18
|
<div class='btn-toolbar job-actions pull-right'>
|
19
|
-
<% if @job.respond_to?(:input) && @job.input.failed.count > 0 %>
|
20
|
-
<div class='btn-group'>
|
21
|
-
<%= link_to('Show Exceptions', exceptions_job_path(@job), class: 'btn btn-default') %>
|
22
|
-
</div>
|
23
|
-
<% end %>
|
24
19
|
|
25
|
-
<% if @job.scheduled? && can?(:run_now, @job)%>
|
20
|
+
<% if @job.scheduled? && can?(:run_now, @job) %>
|
26
21
|
<div class='btn-group'>
|
27
|
-
<%=
|
22
|
+
<%= job_action_links_for_show('Run', rocket_job_mission_control.run_now_job_path(@job), :patch) %>
|
28
23
|
</div>
|
29
24
|
<% end %>
|
30
25
|
|
31
|
-
<div class='
|
26
|
+
<div class='left-margin'>
|
32
27
|
<% valid_events = @job.aasm.events.collect { |e| e.name } %>
|
33
28
|
|
34
|
-
<% if valid_events.include?(:pause) && @job.pausable? && can?(:pause, @job)%>
|
35
|
-
<%=
|
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) %>
|
36
31
|
<% end %>
|
37
32
|
|
38
|
-
<% if valid_events.include?(:resume) && can?(:resume, @job)%>
|
39
|
-
<%=
|
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) %>
|
40
35
|
<% end %>
|
41
36
|
|
42
|
-
<% if valid_events.include?(:retry) && can?(:retry, @job)%>
|
43
|
-
<%=
|
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) %>
|
44
39
|
<% end %>
|
45
|
-
</div>
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
<%= job_action_link('Fail', rocket_job_mission_control.fail_job_path(@job), :patch) %>
|
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) %>
|
50
43
|
<% end %>
|
51
44
|
|
52
45
|
<% if valid_events.include?(:abort) && can?(:abort, @job) %>
|
53
|
-
<%=
|
46
|
+
<%= job_action_links_for_show('Abort', rocket_job_mission_control.abort_job_path(@job), :patch) %>
|
54
47
|
<% end %>
|
55
48
|
|
56
|
-
<% if can?(:destroy, @job)%>
|
57
|
-
|
49
|
+
<% if can?(:destroy, @job) %>
|
50
|
+
<%= job_action_links_for_show('Destroy', rocket_job_mission_control.job_path(@job), :delete) %>
|
58
51
|
<% end %>
|
59
|
-
</div>
|
60
52
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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>
|
68
61
|
</div>
|
69
62
|
</div>
|
70
63
|
</div>
|
@@ -72,6 +65,6 @@
|
|
72
65
|
|
73
66
|
<div class='row'>
|
74
67
|
<div class='col-md-12'>
|
75
|
-
<%= render partial: 'status', locals: {
|
68
|
+
<%= render partial: 'status', locals: {job: @job} %>
|
76
69
|
</div>
|
77
70
|
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class='edit_input'>
|
2
|
+
<div class='col-md-10'>
|
3
|
+
<div class='job-status'>
|
4
|
+
<div class='failures'>
|
5
|
+
<div class='lead'><%= link_to(@job.class, job_path(@job)) %>: <%= @failure_exception.class_name %></div>
|
6
|
+
|
7
|
+
<div class='pagination-buttons pull-right'>
|
8
|
+
<%= render partial: 'view_slice_pagination', locals: {error_type: @failure_exception.class_name, pagination: @view_slice_pagination} %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class='clearfix'></div>
|
12
|
+
|
13
|
+
<div class='message'>
|
14
|
+
<pre><code><%= @failure_exception.message %></code></pre>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<% @lines.each_with_index do |line, index| %>
|
21
|
+
<% if index + 1 == @view_slice_pagination[:record_number] %>
|
22
|
+
<% if flash[:success] %>
|
23
|
+
<%= render partial: 'layouts/rocket_job_mission_control/partials/flash' %>
|
24
|
+
<br>
|
25
|
+
<% end %>
|
26
|
+
<div class='message' tabindex="<%= index + 1 %>" id="<%= index + 1 %>">
|
27
|
+
<pre><span>Line: <%= index + 1 %></span><br><br><code><%= line %></code><br><br>
|
28
|
+
<% 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
|
+
</pre>
|
30
|
+
</div>
|
31
|
+
<% else %>
|
32
|
+
<div class='message' tabindex="<%= index + 1 %>" id="<%= index + 1 %>">
|
33
|
+
<pre><span>Line: <%= index + 1 %></span><br><br><code><%= line %></code><br><br>
|
34
|
+
<% 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 %>
|
35
|
+
</pre>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<script>
|
44
|
+
$(document).ready(function () {
|
45
|
+
document.getElementById(<%= @view_slice_pagination[:record_number] %>).focus();
|
46
|
+
});
|
47
|
+
</script>
|
data/config/routes.rb
CHANGED
@@ -19,8 +19,12 @@ RocketJobMissionControl::Engine.routes.draw do
|
|
19
19
|
patch :resume
|
20
20
|
patch :retry
|
21
21
|
patch :run_now
|
22
|
-
|
23
|
-
|
22
|
+
patch :delete_line
|
23
|
+
patch :update_slice
|
24
|
+
get :exceptions
|
25
|
+
get :exception
|
26
|
+
get :view_slice
|
27
|
+
get :edit_slice
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
@@ -430,6 +430,33 @@ module RocketJobMissionControl
|
|
430
430
|
end
|
431
431
|
end
|
432
432
|
end
|
433
|
+
|
434
|
+
[:view_slice, :edit_slice].each do |method|
|
435
|
+
describe "with a failed slice" do
|
436
|
+
it "access ##{method}" do
|
437
|
+
params = {:error_type => "ArgumentError", "record_number" => "9", "id" => failed_job.id}
|
438
|
+
params = {params: params} if Rails.version.to_i >= 5
|
439
|
+
get method, params
|
440
|
+
assert_response :success
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
describe "#update slice" do
|
446
|
+
before do
|
447
|
+
params = { "job" => { "records" => [ "1", "2", "3"] }, "error_type" => "CSV::MalformedCSVError", "offset" => "1", "id" => failed_job.id.to_s }
|
448
|
+
params = {params: params} if Rails.version.to_i >= 5
|
449
|
+
post :update_slice, params
|
450
|
+
end
|
451
|
+
|
452
|
+
it 'redirects' do
|
453
|
+
assert_redirected_to view_slice_job_path(failed_job, error_type: "CSV::MalformedCSVError")
|
454
|
+
end
|
455
|
+
|
456
|
+
it 'adds a flash success message' do
|
457
|
+
assert_equal 'slice updated', flash[:success]
|
458
|
+
end
|
459
|
+
end
|
433
460
|
end
|
434
461
|
|
435
462
|
def set_role(r)
|
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: 4.
|
4
|
+
version: 4.1.0
|
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:
|
14
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -33,14 +33,14 @@ dependencies:
|
|
33
33
|
requirements:
|
34
34
|
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 4.0
|
36
|
+
version: '4.0'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 4.0
|
43
|
+
version: '4.0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: jquery-rails
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,14 +185,17 @@ files:
|
|
185
185
|
- app/views/rocket_job_mission_control/dirmon_entries/index.html.erb
|
186
186
|
- app/views/rocket_job_mission_control/dirmon_entries/new.html.erb
|
187
187
|
- app/views/rocket_job_mission_control/dirmon_entries/show.html.erb
|
188
|
+
- app/views/rocket_job_mission_control/jobs/_exceptions.html.erb
|
188
189
|
- app/views/rocket_job_mission_control/jobs/_pagination.html.erb
|
189
190
|
- app/views/rocket_job_mission_control/jobs/_sidebar.html.erb
|
190
191
|
- app/views/rocket_job_mission_control/jobs/_status.html.erb
|
192
|
+
- app/views/rocket_job_mission_control/jobs/_view_slice_pagination.html.erb
|
191
193
|
- app/views/rocket_job_mission_control/jobs/edit.html.erb
|
194
|
+
- app/views/rocket_job_mission_control/jobs/edit_slice.html.erb
|
192
195
|
- app/views/rocket_job_mission_control/jobs/exception.html.erb
|
193
|
-
- app/views/rocket_job_mission_control/jobs/exceptions.html.erb
|
194
196
|
- app/views/rocket_job_mission_control/jobs/index.html.erb
|
195
197
|
- app/views/rocket_job_mission_control/jobs/show.html.erb
|
198
|
+
- app/views/rocket_job_mission_control/jobs/view_slice.html.erb
|
196
199
|
- app/views/rocket_job_mission_control/servers/_sidebar.html.erb
|
197
200
|
- app/views/rocket_job_mission_control/servers/index.html.erb
|
198
201
|
- config/initializers/assets.rb
|
@@ -240,8 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
243
|
- !ruby/object:Gem::Version
|
241
244
|
version: '0'
|
242
245
|
requirements: []
|
243
|
-
|
244
|
-
rubygems_version: 2.7.7
|
246
|
+
rubygems_version: 3.0.2
|
245
247
|
signing_key:
|
246
248
|
specification_version: 4
|
247
249
|
summary: Ruby's missing batch system.
|
@@ -1,42 +0,0 @@
|
|
1
|
-
<div class='job-list'>
|
2
|
-
<div class='list'>
|
3
|
-
<div class='row'>
|
4
|
-
<div class='col-sm-10'>
|
5
|
-
<h2>Exceptions for <%= @job.class.name %></h2>
|
6
|
-
<%= link_to(@job.class.name, job_path(@job)) %>
|
7
|
-
<%= h(@job.description) %>
|
8
|
-
</div>
|
9
|
-
|
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>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
<table class='table datatable jobs-datatable' data-source='<%= jobs_url(format: 'json') %>' style='width: 100%'>
|
18
|
-
<thead>
|
19
|
-
<tr>
|
20
|
-
<th>Count</th>
|
21
|
-
<th>Exception Class</th>
|
22
|
-
<th>Exception Messages</th>
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
|
26
|
-
<tbody>
|
27
|
-
<% @exceptions.each do |exception| %>
|
28
|
-
<tr>
|
29
|
-
<th><%= exception.count %></th>
|
30
|
-
<th><%= link_to(exception.class_name, exception_job_path(@job, error_type: exception.class_name), class: "card callout") %></th>
|
31
|
-
|
32
|
-
<th>
|
33
|
-
<% exception.messages.each do |message| %>
|
34
|
-
<div><%= message %></div>
|
35
|
-
<% end %>
|
36
|
-
</th>
|
37
|
-
</tr>
|
38
|
-
<% end %>
|
39
|
-
</tbody>
|
40
|
-
</table>
|
41
|
-
</div>
|
42
|
-
</div>
|