foreman-tasks 3.0.2 → 3.0.3
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/controllers/foreman_tasks/api/tasks_controller.rb +18 -3
- data/app/models/foreman_tasks/recurring_logic.rb +3 -3
- data/app/views/foreman_tasks/tasks/dashboard/_latest_tasks_in_error_warning.html.erb +1 -1
- data/app/views/foreman_tasks/tasks/dashboard/_tasks_status.html.erb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/test/unit/recurring_logic_test.rb +6 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionNameCellFormatter.test.js.snap +3 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionNameCellFormatter.js +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6442bb42dbd73e86c09da30b7b10651a055108a43169ec9aa99b6ee9afe67cc4
|
4
|
+
data.tar.gz: b65ed0dbeac486d6cfce23e4af226a1c87289284d4c4962482e6f74ad4f24a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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
|
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
|
-
|
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 ?
|
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 ?
|
14
|
+
<td><%= result.started_at ? date_time_relative(result.started_at) : _('N/A') %></td>
|
15
15
|
</tr>
|
16
16
|
<% end %>
|
17
17
|
</table>
|
@@ -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)
|
@@ -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(
|
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.
|
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:
|
11
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|