foreman-tasks 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c51f734a6c321d30bd6c3aa93499d9924b93435cadfd48bf129452758ed88338
4
- data.tar.gz: ffd67ecf17550277bf7bcbc86f8fb98a1ac566c1d386350ff4ed1aa97ffad9e3
3
+ metadata.gz: 6442bb42dbd73e86c09da30b7b10651a055108a43169ec9aa99b6ee9afe67cc4
4
+ data.tar.gz: b65ed0dbeac486d6cfce23e4af226a1c87289284d4c4962482e6f74ad4f24a36
5
5
  SHA512:
6
- metadata.gz: 68b31fa072fbf39a1bd93184dfd6a0588270f897ba4a546d79a4f25be2e5815473eedf9a2975eb57c5344a024f7581e8427f39219af00cf6478ce0697b9fb403
7
- data.tar.gz: b531f627380fc77b93c930b6b22051b60e4adad8861cc137cbedfee30237e05fa70a1226b1651b4e7268bd618816a3256ba8b2993a27b5bf04771c3f73c776da
6
+ metadata.gz: 7f1f2cc08a2d6a1d312c302d27f965ce9bcf5c1dafb8de0d63299952f598478a1b9c5637f2b940e840d31836ec4a6a236cf176de53d25e980001efa41871dd7e
7
+ data.tar.gz: 671329ba2b9539fd586d82092e77458b482a445e34c4cbed18d9d9e9854b4573a59f7e475aa7ae2ec41f1959938020a376a4adf2f48e09747023109fb518d1ae
@@ -75,11 +75,16 @@ module ForemanTasks
75
75
  end
76
76
 
77
77
  api :POST, '/tasks/bulk_resume', N_('Resume all paused error tasks')
78
+ desc <<~DOC
79
+ Resumes all selected resumable tasks. If neither a search query nor an
80
+ explicit list of task IDs is provided, it tries to resume all tasks in
81
+ paused state with result error.
82
+ DOC
78
83
  param :search, String, :desc => N_('Resume tasks matching search string')
79
84
  param :task_ids, Array, :desc => N_('Resume specific tasks by ID')
80
85
  def bulk_resume
81
86
  if params[:search].nil? && params[:task_ids].nil?
82
- raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
87
+ params[:search] = 'state = paused and result = error'
83
88
  end
84
89
  resumed = []
85
90
  failed = []
@@ -109,9 +114,14 @@ module ForemanTasks
109
114
  }
110
115
  end
111
116
 
112
- api :POST, '/tasks/bulk_cancel', N_('Cancel all cancellable tasks')
117
+ api :POST, '/tasks/bulk_cancel', N_('Cancel selected cancellable tasks')
118
+ desc <<~DOC
119
+ Cancels all selected cancellable tasks. Requires a search query or an
120
+ explicit list of task IDs to be provided.
121
+ DOC
113
122
  param :search, String, :desc => N_('Cancel tasks matching search string')
114
123
  param :task_ids, Array, :desc => N_('Cancel specific tasks by ID')
124
+ error :bad_request, 'Returned if neither search nor task_ids parameter is provided.'
115
125
  def bulk_cancel
116
126
  if params[:search].nil? && params[:task_ids].nil?
117
127
  raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
@@ -130,9 +140,14 @@ module ForemanTasks
130
140
  }
131
141
  end
132
142
 
133
- api :POST, '/tasks/bulk_stop', N_('Stop all stoppable tasks')
143
+ api :POST, '/tasks/bulk_stop', N_('Stop selected stoppable tasks')
144
+ desc <<~DOC
145
+ Stops all selected tasks which are not already stopped. Requires a
146
+ search query or an explicit list of task IDs to be provided.
147
+ DOC
134
148
  param :search, String, :desc => N_('Stop tasks matching search string')
135
149
  param :task_ids, Array, :desc => N_('Stop specific tasks by ID')
150
+ error :bad_request, 'Returned if neither search nor task_ids parameter is provided.'
136
151
  def bulk_stop
137
152
  if params[:search].nil? && params[:task_ids].nil?
138
153
  raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
@@ -31,12 +31,12 @@ module ForemanTasks
31
31
  if value
32
32
  task.update!(:start_at => next_occurrence_time) if task.start_at < Time.zone.now
33
33
  update(:state => 'active')
34
- else
35
- update(:state => 'disabled')
36
34
  end
37
- else
35
+ elsif value
38
36
  raise RecurringLogicCancelledException
39
37
  end
38
+
39
+ update(:state => 'disabled') unless value
40
40
  end
41
41
 
42
42
  def enabled?
@@ -11,7 +11,7 @@
11
11
  <td class="ellipsis"><%= link_to task.humanized[:action], defined?(main_app) ? main_app.foreman_tasks_task_path(task.id) : foreman_tasks_task_path(task.id) %></td>
12
12
  <td><%= task.state %></td>
13
13
  <td><%= task.result %></td>
14
- <td><%= task.started_at ? (_(date_time_relative(task.started_at))) : _('N/A') %></td>
14
+ <td><%= task.started_at ? date_time_relative(task.started_at) : _('N/A') %></td>
15
15
  </tr>
16
16
  <% end %>
17
17
  </table>
@@ -11,7 +11,7 @@
11
11
  <td><%= result.state %></td>
12
12
  <td><%= result.result %></td>
13
13
  <td><%= link_to result.count, main_app.foreman_tasks_tasks_path(:search => "state=#{result.state}&result=#{result.result}") %></td>
14
- <td><%= result.started_at ? (_(date_time_relative(result.started_at))) : _('N/A') %></td>
14
+ <td><%= result.started_at ? date_time_relative(result.started_at) : _('N/A') %></td>
15
15
  </tr>
16
16
  <% end %>
17
17
  </table>
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '3.0.2'.freeze
2
+ VERSION = '3.0.3'.freeze
3
3
  end
@@ -148,6 +148,12 @@ class RecurringLogicsTest < ActiveSupport::TestCase
148
148
  assert ForemanTasks.dynflow.world.persistence.load_delayed_plan(task.execution_plan.id).frozen
149
149
  end
150
150
 
151
+ it 'handles if the task has been deleted' do
152
+ logic.tasks.find_by(:state => 'scheduled').destroy
153
+ logic.update!(:enabled => false)
154
+ assert_equal 'disabled', logic.state
155
+ end
156
+
151
157
  it 'properly re-enables on disable' do
152
158
  logic.update!(:enabled => false)
153
159
  logic.update!(:enabled => true)
@@ -4,6 +4,8 @@ exports[`actionNameCellFormatter render 1`] = `
4
4
  <a
5
5
  href="/some-url/some-id"
6
6
  >
7
- action-name
7
+ <EllipisWithTooltip>
8
+ action-name
9
+ </EllipisWithTooltip>
8
10
  </a>
9
11
  `;
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
2
  import { cellFormatter } from 'foremanReact/components/common/table';
3
+ import EllipsisWithTooltip from 'react-ellipsis-with-tooltip';
3
4
 
4
5
  export const actionNameCellFormatter = url => (value, { rowData: { id } }) =>
5
- cellFormatter(<a href={`/${url}/${id}`}>{value}</a>);
6
+ cellFormatter(
7
+ <a href={`/${url}/${id}`}>
8
+ <EllipsisWithTooltip>{value}</EllipsisWithTooltip>
9
+ </a>
10
+ );
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 1980-01-01 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow