foreman-tasks 0.5.5 → 0.5.6

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.
@@ -0,0 +1,50 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+
15
+ .spin {
16
+ -webkit-animation: spin 1s infinite linear;
17
+ -moz-animation: spin 1s infinite linear;
18
+ -o-animation: spin 1s infinite linear;
19
+ animation: spin 1s infinite linear;
20
+ -webkit-transform-origin: 50% 50%;
21
+ transform-origin: 50% 50%;
22
+ -ms-transform-origin: 50% 50%; /* IE 9 */
23
+ }
24
+
25
+ @-moz-keyframes spin {
26
+ from {
27
+ -moz-transform: rotate(0deg);
28
+ }
29
+ to {
30
+ -moz-transform: rotate(360deg);
31
+ }
32
+ }
33
+
34
+ @-webkit-keyframes spin {
35
+ from {
36
+ -webkit-transform: rotate(0deg);
37
+ }
38
+ to {
39
+ -webkit-transform: rotate(360deg);
40
+ }
41
+ }
42
+
43
+ @keyframes spin {
44
+ from {
45
+ transform: rotate(0deg);
46
+ }
47
+ to {
48
+ transform: rotate(360deg);
49
+ }
50
+ }
@@ -13,7 +13,21 @@ module ForemanTasks
13
13
  class LockConflict < StandardError
14
14
  attr_reader :required_lock, :conflicting_locks
15
15
  def initialize(required_lock, conflicting_locks)
16
- super("required lock: #{required_lock} conflicts wiht #{conflicting_locks.inspect}")
16
+ header = <<-TXT.gsub(/^ *\|/, '')
17
+ |Required lock is already taken by other running tasks.
18
+ |Please inspect their state, fix their errors nad resume them.
19
+ |
20
+ |Required lock: #{required_lock.name}
21
+ |Conflicts with tasks:
22
+ TXT
23
+ url_helpers = Rails.application.routes.url_helpers
24
+ conflicting_tasks = conflicting_locks.
25
+ map(&:task).
26
+ uniq.
27
+ map { |task| "- #{Setting['foreman_url'] + url_helpers.foreman_tasks_task_path(task)}" }.
28
+ join("\n")
29
+
30
+ super header + conflicting_tasks
17
31
  @required_lock = required_lock
18
32
  @conflicting_locks = conflicting_locks
19
33
  end
@@ -1,15 +1,56 @@
1
1
  <script>
2
- $(document).ready(function () {
3
- var reload = function () {
2
+ task_progress_reloader = {
3
+ timeoutId: null,
4
+ reload: function () {
4
5
  $.ajax({
5
6
  url: "",
6
7
  context: document.body,
7
8
  success: function (s, x) {
8
9
  $(this).html(s);
10
+ task_progress_reloader.start();
9
11
  }
10
12
  });
11
- };
12
- setTimeout(reload, 5000);
13
+ },
14
+
15
+ start: function () {
16
+ if (!this.timeoutId) {
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
+ }
22
+ },
23
+
24
+ stop: function () {
25
+ if (this.timeoutId) {
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
+ }
32
+ },
33
+
34
+ toggle: function () {
35
+ if (this.timeoutId) {
36
+ this.stop();
37
+ } else {
38
+ this.start();
39
+ }
40
+ }
41
+ };
42
+
43
+ $(document).ready(function () {
44
+ $('.reload-button').click(function (event) {
45
+ task_progress_reloader.toggle();
46
+ event.preventDefault();
47
+ });
48
+
49
+ $('.reload-button-stop').click(function (event) {
50
+ task_progress_reloader.stop();
51
+ });
52
+
53
+ task_progress_reloader.start();
13
54
  });
14
55
  </script>
15
56
 
@@ -18,9 +59,11 @@
18
59
  <%= form_for @task, :url => "#" do %>
19
60
 
20
61
  <p>
62
+ <%= link_to(_('Auto Reload'), '', class: %w(btn btn-sm btn-default reload-button hidden)) %>
63
+
21
64
  <%= link_to(_('Dynflow console'),
22
65
  format('/foreman_tasks/dynflow/%s', @task.external_id),
23
- class: %w(btn btn-sm btn-info)) if Setting['dynflow_enable_console'] %>
66
+ class: %w(btn btn-sm btn-default)) if Setting['dynflow_enable_console'] %>
24
67
 
25
68
  <%= link_to(_('Resume'),
26
69
  resume_foreman_tasks_task_path(@task),
@@ -29,13 +72,13 @@
29
72
 
30
73
  <%= link_to(_('Stop'),
31
74
  '',
32
- class: ['btn', 'btn-sm', 'btn-warning', ('disabled' unless @task.state == 'paused')].compact,
75
+ class: ['btn', 'btn-sm', 'btn-warning', 'reload-button-stop', ('disabled' unless @task.state == 'paused')].compact,
33
76
  :'data-toggle' => "modal",
34
77
  :'data-target' => "#stop_modal") %>
35
78
 
36
79
  <%= link_to(_('Force Stop'),
37
80
  '',
38
- class: %w(btn btn-sm btn-danger),
81
+ class: ['btn', 'btn-sm', 'btn-danger', 'reload-button-stop', ('disabled' if @task.state == 'stopped')].compact,
39
82
  :'data-toggle' => "modal",
40
83
  :'data-target' => "#force_stop_modal") %>
41
84
  </p>
@@ -27,9 +27,9 @@ module ForemanTasks
27
27
  Lock.owner!(::User.current, task.id) if ::User.current
28
28
  elsif data[:state] != :planning
29
29
  if task = ::ForemanTasks::Task::DynflowTask.find_by_external_id(execution_plan_id)
30
- unless task.state.to_s == data[:state].to_s
30
+ unless task.state.to_s == data[:state].to_s
31
31
  task.update_from_dynflow(data, true)
32
- end
32
+ end
33
33
  end
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
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.5.5
4
+ version: 0.5.6
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-05-22 00:00:00.000000000 Z
12
+ date: 2014-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -126,6 +126,7 @@ executables: []
126
126
  extensions: []
127
127
  extra_rdoc_files: []
128
128
  files:
129
+ - app/assets/stylesheets/foreman_tasks/application.css.scss
129
130
  - app/helpers/foreman_tasks/tasks_helper.rb
130
131
  - app/lib/actions/helpers/args_serialization.rb
131
132
  - app/lib/actions/helpers/humanizer.rb