foreman-tasks 0.5.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/foreman_tasks/tasks_controller.rb +22 -18
- data/app/lib/actions/base.rb +5 -0
- data/app/models/foreman_tasks/task.rb +8 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +18 -2
- data/app/views/foreman_tasks/tasks/_details.html.erb +121 -0
- data/app/views/foreman_tasks/tasks/_errors.html.erb +36 -0
- data/app/views/foreman_tasks/tasks/_locks.html.erb +13 -0
- data/app/views/foreman_tasks/tasks/_raw.html.erb +16 -0
- data/app/views/foreman_tasks/tasks/_running_steps.html.erb +36 -0
- data/app/views/foreman_tasks/tasks/show.html.erb +39 -168
- data/config/routes.rb +3 -2
- data/lib/foreman_tasks/version.rb +1 -1
- metadata +9 -4
@@ -13,25 +13,41 @@ module ForemanTasks
|
|
13
13
|
paginate(:page => params[:page])
|
14
14
|
end
|
15
15
|
|
16
|
+
def cancel_step
|
17
|
+
task = find_task
|
18
|
+
flash[:notice] = _("Trying to cancel step %s") % params[:step_id]
|
19
|
+
ForemanTasks.dynflow.world.event(task.external_id, params[:step_id].to_i, ::Dynflow::Action::Cancellable::Cancel)
|
20
|
+
redirect_to foreman_tasks_task_path(task)
|
21
|
+
end
|
22
|
+
|
16
23
|
def resume
|
17
|
-
|
24
|
+
task = find_task
|
25
|
+
if task.resumable?
|
18
26
|
ForemanTasks.dynflow.world.execute(task.execution_plan.id)
|
27
|
+
flash[:notice] = _('The execution was resumed.')
|
28
|
+
else
|
29
|
+
flash[:warning] = _('The execution has to be resumable.')
|
19
30
|
end
|
31
|
+
redirect_to foreman_tasks_task_path(task)
|
20
32
|
end
|
21
33
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
34
|
+
def unlock
|
35
|
+
task = find_task
|
36
|
+
if task.paused?
|
25
37
|
task.state = :stopped
|
26
38
|
task.save!
|
39
|
+
flash[:notice] = _('The task resrouces were unlocked.')
|
40
|
+
else
|
41
|
+
flash[:warning] = _('The execution has to be paused.')
|
27
42
|
end
|
43
|
+
redirect_to foreman_tasks_task_path(task)
|
28
44
|
end
|
29
45
|
|
30
|
-
def
|
46
|
+
def force_unlock
|
31
47
|
task = find_task
|
32
48
|
task.state = :stopped
|
33
49
|
task.save!
|
34
|
-
flash[:notice] = _('The task
|
50
|
+
flash[:notice] = _('The task resources were unlocked with force.')
|
35
51
|
redirect_to foreman_tasks_task_path(task)
|
36
52
|
end
|
37
53
|
|
@@ -42,18 +58,6 @@ module ForemanTasks
|
|
42
58
|
|
43
59
|
private
|
44
60
|
|
45
|
-
def paused_task_action(success_message)
|
46
|
-
task = find_task
|
47
|
-
if task.state != 'paused'
|
48
|
-
flash[:warning] = _('The execution has to be paused.')
|
49
|
-
else
|
50
|
-
yield task
|
51
|
-
flash[:notice] = success_message
|
52
|
-
end
|
53
|
-
|
54
|
-
redirect_to foreman_tasks_task_path(task)
|
55
|
-
end
|
56
|
-
|
57
61
|
def find_task
|
58
62
|
ForemanTasks::Task::DynflowTask.find(params[:id])
|
59
63
|
end
|
data/app/lib/actions/base.rb
CHANGED
@@ -62,6 +62,14 @@ module ForemanTasks
|
|
62
62
|
self.state != 'stopped'
|
63
63
|
end
|
64
64
|
|
65
|
+
def resumable?
|
66
|
+
false
|
67
|
+
end
|
68
|
+
|
69
|
+
def paused?
|
70
|
+
self.state == 'paused'
|
71
|
+
end
|
72
|
+
|
65
73
|
def self.search_by_generic_resource(key, operator, value)
|
66
74
|
key_name = self.connection.quote_column_name(key.sub(/^.*\./,''))
|
67
75
|
condition = sanitize_sql_for_conditions(["foreman_tasks_locks.#{key_name} #{operator} ?", value])
|
@@ -23,6 +23,14 @@ module ForemanTasks
|
|
23
23
|
self.save!
|
24
24
|
end
|
25
25
|
|
26
|
+
def resumable?
|
27
|
+
execution_plan.state == :paused
|
28
|
+
end
|
29
|
+
|
30
|
+
def cancellable_action?(action)
|
31
|
+
action.is_a?(::Dynflow::Action::Cancellable)
|
32
|
+
end
|
33
|
+
|
26
34
|
def progress
|
27
35
|
execution_plan.progress
|
28
36
|
end
|
@@ -39,10 +47,18 @@ module ForemanTasks
|
|
39
47
|
main_action.respond_to?(:task_output) && main_action.task_output
|
40
48
|
end
|
41
49
|
|
50
|
+
def failed_steps
|
51
|
+
execution_plan.steps_in_state(:skipped, :skipping, :error)
|
52
|
+
end
|
53
|
+
|
54
|
+
def running_steps
|
55
|
+
execution_plan.steps_in_state(:running, :suspended)
|
56
|
+
end
|
57
|
+
|
42
58
|
def humanized
|
43
59
|
{ action: get_humanized(:humanized_name),
|
44
60
|
input: get_humanized(:humanized_input),
|
45
|
-
output: get_humanized(:humanized_output) }
|
61
|
+
output: [get_humanized(:humanized_output), get_humanized(:humanized_error)].reject(&:blank?).join("\n") }
|
46
62
|
end
|
47
63
|
|
48
64
|
def cli_example
|
@@ -57,7 +73,7 @@ module ForemanTasks
|
|
57
73
|
end
|
58
74
|
|
59
75
|
def get_humanized(method)
|
60
|
-
Match! method, :humanized_name, :humanized_input, :humanized_output
|
76
|
+
Match! method, :humanized_name, :humanized_input, :humanized_output, :humanized_error
|
61
77
|
if main_action.respond_to? method
|
62
78
|
begin
|
63
79
|
main_action.send method
|
@@ -0,0 +1,121 @@
|
|
1
|
+
<p>
|
2
|
+
<%= link_to(_('Auto Reload'), '', class: %w(btn btn-sm btn-default reload-button hidden)) %>
|
3
|
+
|
4
|
+
<%= link_to(_('Dynflow console'),
|
5
|
+
format('/foreman_tasks/dynflow/%s', @task.external_id),
|
6
|
+
class: %w(btn btn-sm btn-default)) if Setting['dynflow_enable_console'] %>
|
7
|
+
|
8
|
+
<%= link_to(_('Resume'),
|
9
|
+
resume_foreman_tasks_task_path(@task),
|
10
|
+
class: ['btn', 'btn-sm', 'btn-primary', ('disabled' unless @task.resumable?)].compact,
|
11
|
+
method: :post) %>
|
12
|
+
|
13
|
+
<%= link_to(_('Unlock'),
|
14
|
+
'',
|
15
|
+
class: ['btn', 'btn-sm', 'btn-warning', 'reload-button-stop', ('disabled' unless @task.state == 'paused')].compact,
|
16
|
+
:'data-toggle' => "modal",
|
17
|
+
:'data-target' => "#unlock_modal") %>
|
18
|
+
|
19
|
+
<%= link_to(_('Force Unlock'),
|
20
|
+
'',
|
21
|
+
class: ['btn', 'btn-sm', 'btn-danger', 'reload-button-stop', ('disabled' if @task.state == 'stopped')].compact,
|
22
|
+
:'data-toggle' => "modal",
|
23
|
+
:'data-target' => "#force_unlock_modal") %>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<div class="modal fade" id="unlock_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true">
|
27
|
+
<div class="modal-dialog">
|
28
|
+
<div class="modal-content">
|
29
|
+
<div class="modal-header">
|
30
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
31
|
+
<h2 class="modal-title" id="deploy_modal_label">
|
32
|
+
<span class="glyphicon glyphicon-warning-sign"></span>
|
33
|
+
<%= _("Unlock") %>
|
34
|
+
</h2>
|
35
|
+
</div>
|
36
|
+
<div class="modal-body">
|
37
|
+
<%= _("This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed") %>
|
38
|
+
</div>
|
39
|
+
<div class="modal-footer">
|
40
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button>
|
41
|
+
<%= link_to(_("Unlock"), unlock_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-warning') %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="modal fade" id="force_unlock_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true">
|
48
|
+
<div class="modal-dialog">
|
49
|
+
<div class="modal-content">
|
50
|
+
<div class="modal-header">
|
51
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
52
|
+
<h2 class="modal-title" id="deploy_modal_label">
|
53
|
+
<span class="glyphicon glyphicon-exclamation-sign"></span>
|
54
|
+
<%= _("Force Unlock") %>
|
55
|
+
</h2>
|
56
|
+
</div>
|
57
|
+
<div class="modal-body">
|
58
|
+
<%= _("Resources will be unlocked and will not prevent other tasks from being run. As the task might be still running, it should be avoided to use this unless you are really sure the task got stuck") %>
|
59
|
+
</div>
|
60
|
+
<div class="modal-footer">
|
61
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button>
|
62
|
+
<%= link_to(_("Force Unlock"), force_unlock_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-danger') %>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<div>
|
69
|
+
<span class="param-name"><%= _("Id") %>:</span>
|
70
|
+
<span class="param-value"><%= @task.id %></span>
|
71
|
+
</div>
|
72
|
+
<div>
|
73
|
+
<span class="param-name"><%= _("Label") %>:</span>
|
74
|
+
<span class="param-value"><%= @task.label %></span>
|
75
|
+
</div>
|
76
|
+
<div>
|
77
|
+
<span class="param-name"><%= _("Name") %>:</span>
|
78
|
+
<span class="param-value"><%= @task.humanized[:action] %></span>
|
79
|
+
</div>
|
80
|
+
<div>
|
81
|
+
<span class="param-name"><%= _("Owner") %>:</span>
|
82
|
+
<span class="param-value"><%= @task.username %></span>
|
83
|
+
</div>
|
84
|
+
<div>
|
85
|
+
<span class="param-name"><%= _("Started at") %>:</span>
|
86
|
+
<span class="param-value"><%= @task.started_at %></span>
|
87
|
+
</div>
|
88
|
+
<div>
|
89
|
+
<span class="param-name"><%= _("Ended at") %>:</span>
|
90
|
+
<span class="param-value"><%= @task.ended_at %></span>
|
91
|
+
</div>
|
92
|
+
<div>
|
93
|
+
<span class="param-name"><%= _("State") %>:</span>
|
94
|
+
<span class="param-value"><%= @task.state %></span>
|
95
|
+
</div>
|
96
|
+
<div>
|
97
|
+
<span class="param-name"><%= _("Result") %>:</span>
|
98
|
+
<span class="param-value"><%= @task.result %></span>
|
99
|
+
</div>
|
100
|
+
<div>
|
101
|
+
<span class="param-name"><%= _("Params") %>:</span>
|
102
|
+
<span class="param-value"><%= format_task_input(@task) %></span>
|
103
|
+
</div>
|
104
|
+
<div>
|
105
|
+
<span class="param-name"><%= _("Progress") %>:</span>
|
106
|
+
<span class="param-value">
|
107
|
+
<div class="progress progress-striped">
|
108
|
+
<% progress = 100 * @task.progress %>
|
109
|
+
<div class="progress-bar" role="progressbar" aria-valuenow="<%= progress %>"
|
110
|
+
aria-valuemin="0" aria-valuemax="100" style="width: <%= progress %>%">
|
111
|
+
<span class="sr-only"><%= progress %>% Complete</span>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
</span>
|
115
|
+
</div>
|
116
|
+
<div>
|
117
|
+
<span class="param-name"><%= _("Output") %>:</span>
|
118
|
+
<span class="param-value">
|
119
|
+
<pre><%= @task.humanized[:output] %></pre>
|
120
|
+
</span>
|
121
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<% if @task.is_a? ForemanTasks::Task::DynflowTask %>
|
2
|
+
<div>
|
3
|
+
<% failed_steps = @task.failed_steps %>
|
4
|
+
<% if failed_steps.empty? %>
|
5
|
+
<div class="alert alert-success">
|
6
|
+
<%= _("No errors") %>
|
7
|
+
</div>
|
8
|
+
<% else %>
|
9
|
+
<% failed_steps.each do |step| %>
|
10
|
+
<div class="alert alert-danger">
|
11
|
+
<% action = step.action(@task.execution_plan) %>
|
12
|
+
<span class="param-name"><%= _("Action") %>:</span>
|
13
|
+
<span class="param-value">
|
14
|
+
<pre><%= action.class %></pre>
|
15
|
+
</span>
|
16
|
+
<span class="param-name"><%= _("Input") %>:</span>
|
17
|
+
<span class="param-value">
|
18
|
+
<pre><%= action.input.pretty_inspect %></pre>
|
19
|
+
</span>
|
20
|
+
<span class="param-name"><%= _("Output") %>:</span>
|
21
|
+
<span class="param-value">
|
22
|
+
<pre><%= action.output.pretty_inspect %></pre>
|
23
|
+
</span>
|
24
|
+
<span class="param-name"><%= _("Exception") %>:</span>
|
25
|
+
<span class="param-value">
|
26
|
+
<pre><%= step.error.exception_class %>: <%= step.error.message %></pre>
|
27
|
+
</span>
|
28
|
+
<span class="param-name"><%= _("Backtrace") %>:</span>
|
29
|
+
<span class="param-value">
|
30
|
+
<pre><%= step.error.backtrace.join("\n") %></pre>
|
31
|
+
</span>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div>
|
2
|
+
<span class="param-name"><%= _("Raw input") %>:</span>
|
3
|
+
<span class="param-value">
|
4
|
+
<pre><%= @task.input.pretty_inspect %></pre>
|
5
|
+
</span>
|
6
|
+
</div>
|
7
|
+
<div>
|
8
|
+
<span class="param-name"><%= _("Raw output") %>:</span>
|
9
|
+
<span class="param-value">
|
10
|
+
<pre><%= @task.output.pretty_inspect %></pre>
|
11
|
+
</span>
|
12
|
+
</div>
|
13
|
+
<div>
|
14
|
+
<span class="param-name"><%= _("External Id") %>:</span>
|
15
|
+
<span class="param-value"><%= @task.external_id %></span>
|
16
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<% if @task.is_a? ForemanTasks::Task::DynflowTask %>
|
2
|
+
<div>
|
3
|
+
<% running_steps = @task.running_steps %>
|
4
|
+
<% if running_steps.empty? %>
|
5
|
+
<%= _("No running steps") %>
|
6
|
+
<% else %>
|
7
|
+
<% running_steps.each do |step| %>
|
8
|
+
<% action = step.action(@task.execution_plan) %>
|
9
|
+
<div class="alert alert-warning">
|
10
|
+
<p>
|
11
|
+
<% if @task.cancellable_action?(action) %>
|
12
|
+
<%= link_to(_('Cancel'),
|
13
|
+
cancel_step_foreman_tasks_task_path(@task, :step_id => step.id),
|
14
|
+
class: ['btn', 'btn-sm', 'btn-primary'].compact,
|
15
|
+
method: :post) %>
|
16
|
+
<% end %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<span class="param-name"><%= _("Action") %>:</span>
|
20
|
+
<span class="param-value">
|
21
|
+
<pre><%= action.class %></pre>
|
22
|
+
</span>
|
23
|
+
<span class="param-name"><%= _("Input") %>:</span>
|
24
|
+
<span class="param-value">
|
25
|
+
<pre><%= action.input.pretty_inspect %></pre>
|
26
|
+
</span>
|
27
|
+
<span class="param-name"><%= _("Output") %>:</span>
|
28
|
+
<span class="param-value">
|
29
|
+
<pre><%= action.output.pretty_inspect %></pre>
|
30
|
+
</span>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
</p>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script>
|
2
|
-
|
2
|
+
var taskProgressReloader = {
|
3
3
|
timeoutId: null,
|
4
4
|
reload: function () {
|
5
5
|
$.ajax({
|
@@ -7,7 +7,7 @@
|
|
7
7
|
context: document.body,
|
8
8
|
success: function (s, x) {
|
9
9
|
$(this).html(s);
|
10
|
-
|
10
|
+
taskProgressReloader.start();
|
11
11
|
}
|
12
12
|
});
|
13
13
|
},
|
@@ -15,20 +15,20 @@
|
|
15
15
|
start: function () {
|
16
16
|
if (!this.timeoutId) {
|
17
17
|
this.timeoutId = setTimeout(this.reload, 5000);
|
18
|
-
var button = $('.reload-button');
|
19
|
-
button.html('<span class="glyphicon glyphicon-refresh spin"></span> <%= _('Stop auto-reloading') %>');
|
20
|
-
button.show();
|
21
18
|
}
|
19
|
+
var button = $('.reload-button');
|
20
|
+
button.html('<span class="glyphicon glyphicon-refresh spin"></span> <%= _('Stop auto-reloading') %>');
|
21
|
+
button.show();
|
22
22
|
},
|
23
23
|
|
24
24
|
stop: function () {
|
25
25
|
if (this.timeoutId) {
|
26
26
|
clearTimeout(this.timeoutId);
|
27
|
-
this.timeoutId = null;
|
28
|
-
var button = $('.reload-button');
|
29
|
-
button.html('<span class="glyphicon glyphicon-refresh"></span> <%= _('Start auto-reloading') %>');
|
30
|
-
button.show();
|
31
27
|
}
|
28
|
+
this.timeoutId = null;
|
29
|
+
var button = $('.reload-button');
|
30
|
+
button.html('<span class="glyphicon glyphicon-refresh"></span> <%= _('Start auto-reloading') %>');
|
31
|
+
button.show();
|
32
32
|
},
|
33
33
|
|
34
34
|
toggle: function () {
|
@@ -42,15 +42,23 @@
|
|
42
42
|
|
43
43
|
$(document).ready(function () {
|
44
44
|
$('.reload-button').click(function (event) {
|
45
|
-
|
45
|
+
taskProgressReloader.toggle();
|
46
46
|
event.preventDefault();
|
47
47
|
});
|
48
48
|
|
49
49
|
$('.reload-button-stop').click(function (event) {
|
50
|
-
|
50
|
+
taskProgressReloader.stop();
|
51
51
|
});
|
52
52
|
|
53
|
-
|
53
|
+
$('ul.nav-tabs a' ).click(function (event) {
|
54
|
+
taskProgressReloader.stop();
|
55
|
+
});
|
56
|
+
|
57
|
+
<% if @task.state == 'running' %>
|
58
|
+
taskProgressReloader.start();
|
59
|
+
<% else %>
|
60
|
+
taskProgressReloader.stop();
|
61
|
+
<% end %>
|
54
62
|
});
|
55
63
|
</script>
|
56
64
|
|
@@ -58,167 +66,30 @@
|
|
58
66
|
|
59
67
|
<%= form_for @task, :url => "#" do %>
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
<%= link_to(_('Resume'),
|
69
|
-
resume_foreman_tasks_task_path(@task),
|
70
|
-
class: ['btn', 'btn-sm', 'btn-primary', ('disabled' unless @task.state == 'paused')].compact,
|
71
|
-
method: :post) %>
|
72
|
-
|
73
|
-
<%= link_to(_('Stop'),
|
74
|
-
'',
|
75
|
-
class: ['btn', 'btn-sm', 'btn-warning', 'reload-button-stop', ('disabled' unless @task.state == 'paused')].compact,
|
76
|
-
:'data-toggle' => "modal",
|
77
|
-
:'data-target' => "#stop_modal") %>
|
78
|
-
|
79
|
-
<%= link_to(_('Force Stop'),
|
80
|
-
'',
|
81
|
-
class: ['btn', 'btn-sm', 'btn-danger', 'reload-button-stop', ('disabled' if @task.state == 'stopped')].compact,
|
82
|
-
:'data-toggle' => "modal",
|
83
|
-
:'data-target' => "#force_stop_modal") %>
|
84
|
-
</p>
|
85
|
-
|
86
|
-
<div class="modal fade" id="stop_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true">
|
87
|
-
<div class="modal-dialog">
|
88
|
-
<div class="modal-content">
|
89
|
-
<div class="modal-header">
|
90
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
91
|
-
<h2 class="modal-title" id="deploy_modal_label">
|
92
|
-
<span class="glyphicon glyphicon-warning-sign"></span>
|
93
|
-
<%= _("Stop") %>
|
94
|
-
</h2>
|
95
|
-
</div>
|
96
|
-
<div class="modal-body">
|
97
|
-
<%= _("This will stop the task and unlock the resources. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed") %>
|
98
|
-
</div>
|
99
|
-
<div class="modal-footer">
|
100
|
-
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button>
|
101
|
-
<%= link_to(_("Stop"), stop_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-warning') %>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
</div>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
<div class="modal fade" id="force_stop_modal" tabindex="-1" role="dialog" aria-labelledby="Deploy" aria-hidden="true">
|
108
|
-
<div class="modal-dialog">
|
109
|
-
<div class="modal-content">
|
110
|
-
<div class="modal-header">
|
111
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
112
|
-
<h2 class="modal-title" id="deploy_modal_label">
|
113
|
-
<span class="glyphicon glyphicon-exclamation-sign"></span>
|
114
|
-
<%= _("Force Stop") %>
|
115
|
-
</h2>
|
116
|
-
</div>
|
117
|
-
<div class="modal-body">
|
118
|
-
<%= _("Resources will be unlocked and will not prevent other tasks from being run. As the task might be still running, it should be avoided to use this unless you are really sure the task got stuck") %>
|
119
|
-
</div>
|
120
|
-
<div class="modal-footer">
|
121
|
-
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _("Cancel") %></button>
|
122
|
-
<%= link_to(_("Force Stop"), force_stop_foreman_tasks_task_path(@task), method: :post, class: 'btn btn-danger') %>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
</div>
|
126
|
-
</div>
|
127
|
-
|
69
|
+
<ul class="nav nav-tabs" data-tabs="tabs">
|
70
|
+
<li class="active"><a href="#primary" data-toggle="tab"><%= _("Task") %></a></li>
|
71
|
+
<li><a href="#running-steps" data-toggle="tab"><%= _("Running Steps") %></a></li>
|
72
|
+
<li><a href="#errors" data-toggle="tab"><%= _("Errors") %></a></li>
|
73
|
+
<li><a href="#locks" data-toggle="tab"><%= _("Locks") %></a></li>
|
74
|
+
<li><a href="#raw" data-toggle="tab"><%= _("Raw") %></a></li>
|
75
|
+
</ul>
|
128
76
|
|
129
|
-
|
130
|
-
|
131
|
-
|
77
|
+
<div class="tab-content">
|
78
|
+
<div class="tab-pane active" id="primary">
|
79
|
+
<%= render :partial => 'details' %>
|
132
80
|
</div>
|
133
|
-
<div>
|
134
|
-
|
135
|
-
<span class="param-value"><%= @task.label %></span>
|
81
|
+
<div class="tab-pane" id="running-steps">
|
82
|
+
<%= render :partial => 'running_steps' %>
|
136
83
|
</div>
|
137
|
-
<div>
|
138
|
-
|
139
|
-
<span class="param-value"><%= @task.humanized[:action] %></span>
|
84
|
+
<div class="tab-pane" id="errors">
|
85
|
+
<%= render :partial => 'errors' %>
|
140
86
|
</div>
|
141
|
-
<div>
|
142
|
-
|
143
|
-
<span class="param-value"><%= @task.username %></span>
|
87
|
+
<div class="tab-pane" id="raw">
|
88
|
+
<%= render :partial => 'raw' %>
|
144
89
|
</div>
|
145
|
-
<div>
|
146
|
-
|
147
|
-
<span class="param-value"><%= @task.started_at %></span>
|
148
|
-
</div>
|
149
|
-
<div>
|
150
|
-
<span class="param-name"><%= _("Ended at") %>:</span>
|
151
|
-
<span class="param-value"><%= @task.ended_at %></span>
|
152
|
-
</div>
|
153
|
-
<div>
|
154
|
-
<span class="param-name"><%= _("State") %>:</span>
|
155
|
-
<span class="param-value"><%= @task.state %></span>
|
156
|
-
</div>
|
157
|
-
<div>
|
158
|
-
<span class="param-name"><%= _("Result") %>:</span>
|
159
|
-
<span class="param-value"><%= @task.result %></span>
|
160
|
-
</div>
|
161
|
-
<div>
|
162
|
-
<span class="param-name"><%= _("Params") %>:</span>
|
163
|
-
<span class="param-value"><%= format_task_input(@task) %></span>
|
164
|
-
</div>
|
165
|
-
<div>
|
166
|
-
<span class="param-name"><%= _("Progress") %>:</span>
|
167
|
-
<span class="param-value">
|
168
|
-
<div class="progress progress-striped">
|
169
|
-
<% progress = 100 * @task.progress %>
|
170
|
-
<div class="progress-bar" role="progressbar" aria-valuenow="<%= progress %>"
|
171
|
-
aria-valuemin="0" aria-valuemax="100" style="width: <%= progress %>%">
|
172
|
-
<span class="sr-only"><%= progress %>% Complete</span>
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
</span>
|
176
|
-
</div>
|
177
|
-
<% if @task.cli_example %>
|
178
|
-
<div>
|
179
|
-
<span class="param-name"><%= _("CLI Example") %>:</span>
|
180
|
-
<span class="param-value">
|
181
|
-
<pre><%= @task.cli_example %></pre>
|
182
|
-
</span>
|
183
|
-
</div>
|
184
|
-
<% end %>
|
185
|
-
<div>
|
186
|
-
<span class="param-name"><%= _("Output") %>:</span>
|
187
|
-
<span class="param-value">
|
188
|
-
<pre><%= @task.humanized[:output] %></pre>
|
189
|
-
</span>
|
190
|
-
</div>
|
191
|
-
<div>
|
192
|
-
<span class="param-name"><%= _("Raw input") %>:</span>
|
193
|
-
<span class="param-value">
|
194
|
-
<pre><%= @task.input.pretty_inspect %></pre>
|
195
|
-
</span>
|
196
|
-
</div>
|
197
|
-
<div>
|
198
|
-
<span class="param-name"><%= _("Raw output") %>:</span>
|
199
|
-
<span class="param-value">
|
200
|
-
<pre><%= @task.output.pretty_inspect %></pre>
|
201
|
-
</span>
|
202
|
-
</div>
|
203
|
-
<div>
|
204
|
-
<span class="param-name"><%= _("External Id") %>:</span>
|
205
|
-
<span class="param-value"><%= @task.external_id %></span>
|
206
|
-
</div>
|
207
|
-
<div>
|
208
|
-
<span class="param-name"><%= _("Locks") %>:</span>
|
209
|
-
<span class="param-value">
|
210
|
-
<ul>
|
211
|
-
<% @task.locks.each do |lock| %>
|
212
|
-
<li>
|
213
|
-
name: <%= lock.name %>
|
214
|
-
<br/>
|
215
|
-
resource: <%= format('%s id:%s', lock.resource_type, lock.resource_id) %>
|
216
|
-
<br/>
|
217
|
-
exclusive: <%= lock.exclusive %>
|
218
|
-
</li>
|
219
|
-
<% end %>
|
220
|
-
</ul>
|
221
|
-
</span>
|
90
|
+
<div class="tab-pane" id="locks">
|
91
|
+
<%= render :partial => 'locks' %>
|
222
92
|
</div>
|
93
|
+
|
223
94
|
<% end %>
|
224
95
|
</div>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.7.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.7.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: sequel
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,8 +138,13 @@ files:
|
|
138
138
|
- app/lib/actions/foreman/architecture/update.rb
|
139
139
|
- app/lib/actions/foreman/architecture/destroy.rb
|
140
140
|
- app/views/foreman_tasks/api/tasks/show.json.rabl
|
141
|
+
- app/views/foreman_tasks/tasks/_running_steps.html.erb
|
141
142
|
- app/views/foreman_tasks/tasks/show.html.erb
|
143
|
+
- app/views/foreman_tasks/tasks/_details.html.erb
|
142
144
|
- app/views/foreman_tasks/tasks/index.html.erb
|
145
|
+
- app/views/foreman_tasks/tasks/_raw.html.erb
|
146
|
+
- app/views/foreman_tasks/tasks/_errors.html.erb
|
147
|
+
- app/views/foreman_tasks/tasks/_locks.html.erb
|
143
148
|
- app/controllers/foreman_tasks/api/tasks_controller.rb
|
144
149
|
- app/controllers/foreman_tasks/tasks_controller.rb
|
145
150
|
- app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb
|