foreman-tasks 2.0.3 → 3.0.4
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/.github/workflows/js_tests.yml +31 -0
- data/.github/workflows/ruby_tests.yml +74 -0
- data/.rubocop.yml +12 -4
- data/.rubocop_todo.yml +32 -25
- data/Gemfile +5 -0
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +50 -63
- data/app/controllers/foreman_tasks/concerns/parameters/triggering.rb +1 -1
- data/app/controllers/foreman_tasks/recurring_logics_controller.rb +7 -0
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +3 -3
- data/app/models/foreman_tasks/recurring_logic.rb +1 -1
- data/app/models/foreman_tasks/task.rb +11 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +27 -33
- data/app/models/foreman_tasks/task/search.rb +1 -1
- data/app/models/foreman_tasks/task/status_explicator.rb +1 -1
- data/app/models/foreman_tasks/triggering.rb +1 -1
- data/app/models/setting/foreman_tasks.rb +9 -9
- data/app/services/foreman_tasks/dashboard_table_filter.rb +5 -1
- data/app/views/foreman_tasks/api/tasks/index.json.rabl +2 -0
- data/app/views/foreman_tasks/layouts/react.html.erb +1 -2
- data/app/views/foreman_tasks/recurring_logics/index.html.erb +3 -1
- 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/app/views/foreman_tasks/tasks/show.html.erb +1 -6
- data/config/routes.rb +2 -1
- data/db/migrate/20200517215015_rename_bookmarks_controller.rb +2 -2
- data/db/seeds.d/30-notification_blueprints.rb +7 -7
- data/db/seeds.d/61-foreman_tasks_bookmarks.rb +1 -1
- data/foreman-tasks.gemspec +1 -0
- data/lib/foreman_tasks/cleaner.rb +4 -6
- data/lib/foreman_tasks/dynflow/configuration.rb +1 -1
- data/lib/foreman_tasks/dynflow/persistence.rb +4 -6
- data/lib/foreman_tasks/engine.rb +2 -2
- data/lib/foreman_tasks/version.rb +1 -1
- data/package.json +0 -1
- data/test/controllers/api/recurring_logics_controller_test.rb +1 -1
- data/test/controllers/api/tasks_controller_test.rb +17 -7
- data/test/controllers/tasks_controller_test.rb +6 -6
- data/test/core/unit/runner_test.rb +20 -20
- data/test/core/unit/task_launcher_test.rb +8 -8
- data/test/helpers/foreman_tasks/foreman_tasks_helper_test.rb +7 -7
- data/test/helpers/foreman_tasks/tasks_helper_test.rb +3 -3
- data/test/lib/actions/middleware/keep_current_request_id_test.rb +3 -3
- data/test/support/history_tasks_builder.rb +1 -1
- data/test/tasks/generate_task_actions_test.rb +1 -1
- data/test/unit/actions/action_with_sub_plans_test.rb +2 -2
- data/test/unit/actions/bulk_action_test.rb +6 -6
- data/test/unit/actions/proxy_action_test.rb +20 -20
- data/test/unit/actions/recurring_action_test.rb +30 -32
- data/test/unit/cleaner_test.rb +24 -24
- data/test/unit/dashboard_table_filter_test.rb +5 -5
- data/test/unit/otp_manager_test.rb +2 -2
- data/test/unit/proxy_selector_test.rb +9 -9
- data/test/unit/recurring_logic_test.rb +32 -32
- data/test/unit/remote_task_test.rb +2 -2
- data/test/unit/task_groups_test.rb +4 -4
- data/test/unit/task_test.rb +26 -18
- data/test/unit/triggering_test.rb +8 -8
- data/test/unit/troubleshooting_help_generator_test.rb +6 -6
- data/test/unit/ui_notifications_test.rb +11 -11
- data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +3 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +8 -157
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskButtons.js +168 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +6 -7
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskSkeleton.js +48 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +12 -70
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskButtons.test.js +95 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +78 -225
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskButtons.test.js.snap +212 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +8 -4
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +87 -70
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.scss +10 -0
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +48 -125
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -16
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +55 -29
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +2 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +6 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +2 -18
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +77 -27
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +14 -101
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.scss +4 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js +53 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.test.js +14 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.js +27 -19
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.scss +14 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -34
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/{StoppedTasksCardHelper.js → StoppedTasksCardTable.js} +28 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCardTable.test.js +54 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/OtherInfo.test.js.snap +48 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCard.test.js.snap +60 -1367
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/StoppedTasksCardTable.test.js.snap +960 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/__snapshots__/TasksCardsGrid.test.js.snap +14 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +2 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardSelectors.js +17 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +26 -14
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboard.test.js.snap +14 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboardSelectors.test.js.snap +38 -22
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +0 -8
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +13 -4
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.scss +0 -10
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +0 -2
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionNameCellFormatter.test.js.snap +3 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionNameCellFormatter.js +6 -1
- data/webpack/ForemanTasks/Components/common/urlHelpers.js +7 -0
- data/webpack/ForemanTasks/ForemanTasksReducers.js +0 -2
- data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -0
- metadata +21 -13
- data/.travis.yml +0 -7
- data/app/assets/stylesheets/foreman_tasks/tasks.scss +0 -9
- data/script/travis_run_js_tests.sh +0 -7
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -38
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +0 -33
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsReducer.test.js.snap +0 -26
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/integration.test.js.snap +0 -122
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +0 -72
- data/webpack/__mocks__/foremanReact/redux/API.js +0 -7
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module ForemanTasks
|
|
2
2
|
class RecurringLogicsController < ::ApplicationController
|
|
3
|
+
include Foreman::Controller::AutoCompleteSearch
|
|
4
|
+
|
|
3
5
|
before_action :find_recurring_logic, :only => [:show, :cancel, :enable, :disable]
|
|
4
6
|
|
|
5
7
|
def index
|
|
@@ -41,6 +43,11 @@ module ForemanTasks
|
|
|
41
43
|
def change_enabled(value)
|
|
42
44
|
begin
|
|
43
45
|
@recurring_logic.update!(:enabled => value)
|
|
46
|
+
flash[:success] = if value
|
|
47
|
+
_('The recurring logic was enabled.')
|
|
48
|
+
else
|
|
49
|
+
_('The recurring logic was disabled.')
|
|
50
|
+
end
|
|
44
51
|
rescue RecurringLogicCancelledException => e
|
|
45
52
|
@errors = e.message
|
|
46
53
|
end
|
|
@@ -82,7 +82,7 @@ module ForemanTasks
|
|
|
82
82
|
' — ',
|
|
83
83
|
content_tag(:span, nil, :class => 'time', :style => 'white-space: nowrap;') do
|
|
84
84
|
fields.time_select(attr, datetime_options.merge(:ignore_date => true), html_options)
|
|
85
|
-
end
|
|
85
|
+
end,
|
|
86
86
|
].join
|
|
87
87
|
end
|
|
88
88
|
end
|
|
@@ -139,7 +139,7 @@ module ForemanTasks
|
|
|
139
139
|
cronline_fieldset(f, triggering),
|
|
140
140
|
monthly_fieldset(f, triggering),
|
|
141
141
|
weekly_fieldset(f, triggering),
|
|
142
|
-
time_picker_fieldset(f, triggering)
|
|
142
|
+
time_picker_fieldset(f, triggering),
|
|
143
143
|
]
|
|
144
144
|
|
|
145
145
|
content_tag(:fieldset, nil, :id => 'trigger_mode_recurring', :class => "trigger_mode_form #{'hidden' unless triggering.recurring?}") do
|
|
@@ -158,7 +158,7 @@ module ForemanTasks
|
|
|
158
158
|
# TRANSLATORS: this translation is referring to an option which is a time interval
|
|
159
159
|
_('is month (range: 1-12)'),
|
|
160
160
|
# TRANSLATORS: this translation is referring to an option which is a time interval
|
|
161
|
-
_('is day of week (range: 0-6)')
|
|
161
|
+
_('is day of week (range: 0-6)'),
|
|
162
162
|
].map { |opt| content_tag(:li, opt) }.join
|
|
163
163
|
|
|
164
164
|
help = _("Cron line format 'a b c d e', where: %s") % "<br><ol type=\"a\">#{options}</ol>".html_safe
|
|
@@ -70,6 +70,17 @@ module ForemanTasks
|
|
|
70
70
|
end)
|
|
71
71
|
scope :for_action_types, (->(action_types) { where('foreman_tasks_tasks.label IN (?)', Array(action_types)) })
|
|
72
72
|
|
|
73
|
+
apipie :class, "A class representing #{model_name.human} object" do
|
|
74
|
+
name 'Task'
|
|
75
|
+
refs 'Task'
|
|
76
|
+
sections only: %w[all additional]
|
|
77
|
+
property :main_action, object_of: 'Dynflow::Action', desc: 'Returns the main action of the task, e.g. Actions::RemoteExecution::RunHostJob'
|
|
78
|
+
property :label, String, desc: 'Returns the label of the task'
|
|
79
|
+
property :state, String, desc: 'Returns state of the task execution, e.g. "stopped"'
|
|
80
|
+
property :result, String, desc: 'Returns result of the task execution, e.g. "success"'
|
|
81
|
+
property :started_at, ActiveSupport::TimeWithZone, desc: 'Returns date with time the task started at'
|
|
82
|
+
property :ended_at, ActiveSupport::TimeWithZone, desc: 'Returns date with time the task ended at'
|
|
83
|
+
end
|
|
73
84
|
class Jail < Safemode::Jail
|
|
74
85
|
allow :started_at, :ended_at, :result, :state, :label, :main_action
|
|
75
86
|
end
|
|
@@ -102,32 +102,28 @@ module ForemanTasks
|
|
|
102
102
|
|
|
103
103
|
def input_output_failed_steps
|
|
104
104
|
failed_steps.map do |f|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
end
|
|
105
|
+
f_action = f.action(execution_plan)
|
|
106
|
+
{
|
|
107
|
+
error: ({ exception_class: f.error.exception_class, message: f.error.message, backtrace: f.error.backtrace } if f.error),
|
|
108
|
+
action_class: f.action_class.name,
|
|
109
|
+
state: f.state,
|
|
110
|
+
input: f_action.input.pretty_inspect,
|
|
111
|
+
output: f_action.output.pretty_inspect,
|
|
112
|
+
}
|
|
115
113
|
end
|
|
116
114
|
end
|
|
117
115
|
|
|
118
116
|
def input_output_running_steps
|
|
119
117
|
running_steps.map do |f|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
end
|
|
118
|
+
f_action = f.action(execution_plan)
|
|
119
|
+
{
|
|
120
|
+
id: f_action.id,
|
|
121
|
+
action_class: f.action_class.name,
|
|
122
|
+
state: f.state,
|
|
123
|
+
input: f_action.input.pretty_inspect,
|
|
124
|
+
output: f_action.output.pretty_inspect,
|
|
125
|
+
cancellable: cancellable_action?(f_action),
|
|
126
|
+
}
|
|
131
127
|
end
|
|
132
128
|
end
|
|
133
129
|
|
|
@@ -220,19 +216,17 @@ module ForemanTasks
|
|
|
220
216
|
fixed_count = 0
|
|
221
217
|
logger = Foreman::Logging.logger('foreman-tasks')
|
|
222
218
|
running.each do |task|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
logger.warn('Task %s updated at consistency check: %s' % [task.id, changes.inspect])
|
|
228
|
-
end
|
|
229
|
-
rescue => e
|
|
230
|
-
# if we fail updating the data from dynflow, it usually means there is something
|
|
231
|
-
# odd with the data consistency and at this point it is not possible to resume, switching
|
|
232
|
-
# the task to stopped/error
|
|
233
|
-
task.update(:state => 'stopped', :result => 'error')
|
|
234
|
-
Foreman::Logging.exception("Failed at consistency check for task #{task.id}", e, :logger => 'foreman-tasks')
|
|
219
|
+
changes = task.update_from_dynflow(task.execution_plan.to_hash)
|
|
220
|
+
unless changes.empty?
|
|
221
|
+
fixed_count += 1
|
|
222
|
+
logger.warn('Task %s updated at consistency check: %s' % [task.id, changes.inspect])
|
|
235
223
|
end
|
|
224
|
+
rescue => e
|
|
225
|
+
# if we fail updating the data from dynflow, it usually means there is something
|
|
226
|
+
# odd with the data consistency and at this point it is not possible to resume, switching
|
|
227
|
+
# the task to stopped/error
|
|
228
|
+
task.update(:state => 'stopped', :result => 'error')
|
|
229
|
+
Foreman::Logging.exception("Failed at consistency check for task #{task.id}", e, :logger => 'foreman-tasks')
|
|
236
230
|
end
|
|
237
231
|
fixed_count
|
|
238
232
|
end
|
|
@@ -20,7 +20,7 @@ module ForemanTasks
|
|
|
20
20
|
foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_type = '#{resource_type}')
|
|
21
21
|
SQL
|
|
22
22
|
# Select only those tasks which either have the correct taxonomy or are not related to any
|
|
23
|
-
sql = "foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id #{operator} ? OR foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id IS NULL"
|
|
23
|
+
sql = "foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id #{operator} (?) OR foreman_tasks_locks_taxonomy#{uniq_suffix}.resource_id IS NULL"
|
|
24
24
|
{ :conditions => sanitize_sql_for_conditions([sql, value]), :joins => joins }
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -4,7 +4,7 @@ module ForemanTasks
|
|
|
4
4
|
ERRONEOUS_STATUSES = [
|
|
5
5
|
{ :state => 'paused', :result => ANY },
|
|
6
6
|
{ :state => ANY, :result => 'error' },
|
|
7
|
-
{ :state => ANY, :result => 'warning' }
|
|
7
|
+
{ :state => ANY, :result => 'warning' },
|
|
8
8
|
].freeze
|
|
9
9
|
def is_erroneous(task)
|
|
10
10
|
remainder = ERRONEOUS_STATUSES.select do |status|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
class Setting::ForemanTasks < Setting
|
|
2
2
|
def self.default_settings
|
|
3
3
|
[
|
|
4
|
-
set('foreman_tasks_sync_task_timeout', N_('Number of seconds to wait for synchronous task to finish.'), 120),
|
|
5
|
-
set('dynflow_enable_console', N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'), true),
|
|
6
|
-
set('dynflow_console_require_auth', N_('Require user to be authenticated as user with admin rights when accessing dynflow console'), true),
|
|
7
|
-
set('foreman_tasks_proxy_action_retry_count', N_('Number of attempts to start a task on the smart proxy before failing'), 4),
|
|
8
|
-
set('foreman_tasks_proxy_action_retry_interval', N_('Time in seconds between retries'), 15),
|
|
9
|
-
set('foreman_tasks_proxy_batch_trigger', N_('Allow triggering tasks on the smart proxy in batches'), true),
|
|
10
|
-
set('foreman_tasks_proxy_batch_size', N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'), 100),
|
|
4
|
+
set('foreman_tasks_sync_task_timeout', N_('Number of seconds to wait for synchronous task to finish.'), 120, N_('Sync task timeout')),
|
|
5
|
+
set('dynflow_enable_console', N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'), true, N_('Enable dynflow console')),
|
|
6
|
+
set('dynflow_console_require_auth', N_('Require user to be authenticated as user with admin rights when accessing dynflow console'), true, N_('Require auth for dynflow console')),
|
|
7
|
+
set('foreman_tasks_proxy_action_retry_count', N_('Number of attempts to start a task on the smart proxy before failing'), 4, N_('Proxy action retry count')),
|
|
8
|
+
set('foreman_tasks_proxy_action_retry_interval', N_('Time in seconds between retries'), 15, N_('Proxy action retry interval')),
|
|
9
|
+
set('foreman_tasks_proxy_batch_trigger', N_('Allow triggering tasks on the smart proxy in batches'), true, N_('Allow proxy batch tasks')),
|
|
10
|
+
set('foreman_tasks_proxy_batch_size', N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'), 100, N_('Proxy tasks batch size')),
|
|
11
11
|
set('foreman_tasks_troubleshooting_url',
|
|
12
12
|
N_('Url pointing to the task troubleshooting documentation. '\
|
|
13
13
|
'It should contain %{label} placeholder, that will be replaced with normalized task label '\
|
|
14
14
|
'(restricted to only alphanumeric characters)). %{version} placeholder is also available.'),
|
|
15
|
-
nil),
|
|
15
|
+
nil, N_('Tasks troubleshooting URL')),
|
|
16
16
|
set('foreman_tasks_polling_multiplier',
|
|
17
17
|
N_('Polling multiplier which is used to multiply the default polling intervals. '\
|
|
18
18
|
'This can be used to prevent polling too frequently for long running tasks.'),
|
|
19
19
|
1,
|
|
20
|
-
N_("Polling intervals multiplier"))
|
|
20
|
+
N_("Polling intervals multiplier")),
|
|
21
21
|
]
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -24,7 +24,11 @@ module ForemanTasks
|
|
|
24
24
|
private
|
|
25
25
|
|
|
26
26
|
def scope_by(field)
|
|
27
|
-
|
|
27
|
+
if (field == :result) && (@params[field] == 'other')
|
|
28
|
+
@new_scope = @new_scope.where(:result => ['cancelled', 'pending'])
|
|
29
|
+
elsif @params[field].present?
|
|
30
|
+
@new_scope = @new_scope.where(field => @params[field])
|
|
31
|
+
end
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
def scope_by_time
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
<%= notifications %>
|
|
10
10
|
<div id="organization-id" data-id="<%= Organization.current.id if Organization.current %>" ></div>
|
|
11
11
|
<div id="user-id" data-id="<%= User.current.id if User.current %>" ></div>
|
|
12
|
-
|
|
12
|
+
<%= react_component('ForemanTasks') %>
|
|
13
13
|
<% end %>
|
|
14
14
|
<%= render file: "layouts/base" %>
|
|
15
|
-
<%= mount_react_component('ForemanTasks', '#foremanTasksReactRoot') %>
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
<table class="<%= table_css_classes('table-condensed table-fixed') %>">
|
|
39
39
|
<thead>
|
|
40
|
+
<th class="col-md-1"><%= N_("ID") %></th>
|
|
40
41
|
<th><%= N_("Cron line") %></th>
|
|
41
42
|
<th><%= N_("Task count") %></th>
|
|
42
43
|
<th><%= N_("Action") %></th>
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
</thead>
|
|
51
52
|
<% @recurring_logics.each do |recurring_logic| %>
|
|
52
53
|
<tr>
|
|
53
|
-
<td><%= link_to(recurring_logic.
|
|
54
|
+
<td><%= link_to(recurring_logic.id, foreman_tasks_recurring_logic_path(recurring_logic)) %></td>
|
|
55
|
+
<td><%= recurring_logic.cron_line %></td>
|
|
54
56
|
<td><%= link_to(recurring_logic.tasks.count, foreman_tasks_tasks_url(:search => "task_group.id = #{recurring_logic.task_group.id}")) %></td>
|
|
55
57
|
<td><%= format_task_input(recurring_logic.tasks.first) %></td>
|
|
56
58
|
<td><%= recurring_logic.tasks.order(:started_at).where('started_at IS NOT NULL').last.try(:started_at) || "-" %></td>
|
|
@@ -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>
|
data/config/routes.rb
CHANGED
|
@@ -7,6 +7,7 @@ Foreman::Application.routes.draw do
|
|
|
7
7
|
put :disable
|
|
8
8
|
end
|
|
9
9
|
collection do
|
|
10
|
+
get 'auto_complete_search'
|
|
10
11
|
post :clear_cancelled
|
|
11
12
|
end
|
|
12
13
|
end
|
|
@@ -50,7 +51,6 @@ Foreman::Application.routes.draw do
|
|
|
50
51
|
resources :tasks, :only => [:show, :index] do
|
|
51
52
|
member do
|
|
52
53
|
get :details
|
|
53
|
-
get :sub_tasks
|
|
54
54
|
end
|
|
55
55
|
collection do
|
|
56
56
|
post :bulk_search
|
|
@@ -58,6 +58,7 @@ Foreman::Application.routes.draw do
|
|
|
58
58
|
post :bulk_cancel
|
|
59
59
|
post :bulk_stop
|
|
60
60
|
get :summary
|
|
61
|
+
get '/:parent_task_id/sub_tasks', action: 'index'
|
|
61
62
|
get '/summary/:id/sub_tasks/', action: 'summary_sub_tasks'
|
|
62
63
|
post :callback
|
|
63
64
|
end
|
|
@@ -3,7 +3,7 @@ class RenameBookmarksController < ActiveRecord::Migration[5.2]
|
|
|
3
3
|
original_controller = 'foreman_tasks_tasks'
|
|
4
4
|
original_bookmarks = Bookmark.where(controller: original_controller)
|
|
5
5
|
original_bookmarks_names = Hash[original_bookmarks.pluck(:name, :id)]
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
new_controller = 'foreman_tasks/tasks'
|
|
8
8
|
new_bookmarks = Bookmark.where(controller: new_controller)
|
|
9
9
|
new_bookmarks.find_each do |new_bookmark|
|
|
@@ -18,7 +18,7 @@ class RenameBookmarksController < ActiveRecord::Migration[5.2]
|
|
|
18
18
|
original_bookmark.public == new_bookmark.public
|
|
19
19
|
|
|
20
20
|
if is_duplicated
|
|
21
|
-
original_bookmark.destroy
|
|
21
|
+
original_bookmark.destroy
|
|
22
22
|
else
|
|
23
23
|
modified_name = "#{name}_#{generate_token}"
|
|
24
24
|
original_bookmark.update(name: modified_name)
|
|
@@ -9,9 +9,9 @@ blueprints = [
|
|
|
9
9
|
links:
|
|
10
10
|
[
|
|
11
11
|
href: "/foreman_tasks/tasks?search=#{CGI.escape('state=paused')}",
|
|
12
|
-
title: N_('List of tasks')
|
|
13
|
-
]
|
|
14
|
-
}
|
|
12
|
+
title: N_('List of tasks'),
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
{
|
|
@@ -24,9 +24,9 @@ blueprints = [
|
|
|
24
24
|
links:
|
|
25
25
|
[
|
|
26
26
|
path_method: :foreman_tasks_task_path,
|
|
27
|
-
title: N_('Task Details')
|
|
28
|
-
]
|
|
29
|
-
}
|
|
27
|
+
title: N_('Task Details'),
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
{
|
|
@@ -48,7 +48,7 @@ blueprints = [
|
|
|
48
48
|
name: 'tasks_bulk_stop',
|
|
49
49
|
level: 'info',
|
|
50
50
|
message: "DYNAMIC",
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
52
|
]
|
|
53
53
|
|
|
54
54
|
blueprints.each { |blueprint| UINotifications::Seed.new(blueprint).configure }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Bookmark.without_auditing do
|
|
2
2
|
[
|
|
3
3
|
{ :name => 'running', :query => 'state = running' },
|
|
4
|
-
{ :name => 'failed', :query => 'state = paused or result = error or result = warning' }
|
|
4
|
+
{ :name => 'failed', :query => 'state = paused or result = error or result = warning' },
|
|
5
5
|
|
|
6
6
|
].each do |item|
|
|
7
7
|
next if Bookmark.where(:name => item[:name]).first
|
data/foreman-tasks.gemspec
CHANGED
|
@@ -7,6 +7,7 @@ require "foreman_tasks/version"
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "foreman-tasks"
|
|
9
9
|
s.version = ForemanTasks::VERSION
|
|
10
|
+
s.license = 'GPL-3.0'
|
|
10
11
|
s.authors = ["Ivan Nečas"]
|
|
11
12
|
s.email = ["inecas@redhat.com"]
|
|
12
13
|
s.homepage = "https://github.com/theforeman/foreman-tasks"
|
|
@@ -30,12 +30,10 @@ module ForemanTasks
|
|
|
30
30
|
actions_with_periods = {}
|
|
31
31
|
if cleanup_settings[:actions]
|
|
32
32
|
cleanup_settings[:actions].each do |action|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Foreman::Logging.exception("Error handling #{action} cleanup settings", e)
|
|
38
|
-
end
|
|
33
|
+
action_class = action[:name].constantize
|
|
34
|
+
actions_with_periods[action_class] = action[:after]
|
|
35
|
+
rescue => e
|
|
36
|
+
Foreman::Logging.exception("Error handling #{action} cleanup settings", e)
|
|
39
37
|
end
|
|
40
38
|
end
|
|
41
39
|
(ForemanTasks.dynflow.world.action_classes - actions_with_periods.keys).each do |action_class|
|
|
@@ -15,7 +15,7 @@ module ForemanTasks
|
|
|
15
15
|
return @backup_settings if @backup_settings
|
|
16
16
|
backup_options = {
|
|
17
17
|
:backup_deleted_plans => true,
|
|
18
|
-
:backup_dir => default_backup_dir
|
|
18
|
+
:backup_dir => default_backup_dir,
|
|
19
19
|
}
|
|
20
20
|
settings = SETTINGS[:'foreman-tasks'] && SETTINGS[:'foreman-tasks'][:backup]
|
|
21
21
|
backup_options.merge!(settings) if settings
|
|
@@ -8,12 +8,10 @@ module ForemanTasks
|
|
|
8
8
|
# clear connection only if not running in some active record transaction already
|
|
9
9
|
clear_connections = ActiveRecord::Base.connection.open_transactions.zero?
|
|
10
10
|
super.tap do
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
:logger => 'dynflow')
|
|
16
|
-
end
|
|
11
|
+
on_execution_plan_save(execution_plan_id, value)
|
|
12
|
+
rescue => e
|
|
13
|
+
Foreman::Logging.exception('Error on on_execution_plan_save event', e,
|
|
14
|
+
:logger => 'dynflow')
|
|
17
15
|
end
|
|
18
16
|
ensure
|
|
19
17
|
::ActiveRecord::Base.clear_active_connections! if clear_connections
|