foreman-tasks 1.0.1 → 2.0.1
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/.rubocop.yml +12 -12
- data/.rubocop_todo.yml +34 -116
- data/README.md +2 -0
- data/app/controllers/foreman_tasks/api/recurring_logics_controller.rb +20 -1
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +65 -10
- data/app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb +1 -1
- data/app/controllers/foreman_tasks/recurring_logics_controller.rb +19 -0
- data/app/controllers/foreman_tasks/tasks_controller.rb +9 -14
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +1 -3
- data/app/lib/actions/helpers/humanizer.rb +1 -3
- data/app/lib/actions/proxy_action.rb +33 -12
- data/app/lib/foreman_tasks/concerns/polling_action_extensions.rb +12 -0
- data/app/models/foreman_tasks/concerns/action_triggering.rb +1 -1
- data/app/models/foreman_tasks/recurring_logic.rb +1 -0
- data/app/models/foreman_tasks/remote_task.rb +1 -0
- data/app/models/foreman_tasks/task.rb +8 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +2 -1
- data/app/models/foreman_tasks/task/search.rb +11 -1
- data/app/models/setting/foreman_tasks.rb +7 -2
- data/app/services/foreman_tasks/troubleshooting_help_generator.rb +0 -4
- data/app/services/ui_notifications/tasks/task_bulk_cancel.rb +36 -0
- data/app/services/ui_notifications/tasks/task_bulk_resume.rb +38 -0
- data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
- data/app/views/foreman_tasks/api/recurring_logics/base.json.rabl +2 -1
- data/app/views/foreman_tasks/api/tasks/details.json.rabl +1 -1
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +1 -1
- data/app/views/foreman_tasks/recurring_logics/index.html.erb +30 -0
- data/app/views/foreman_tasks/tasks/show.html.erb +3 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20200517215015_rename_bookmarks_controller.rb +35 -0
- data/db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb +5 -0
- data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +9 -0
- data/db/seeds.d/30-notification_blueprints.rb +21 -0
- data/foreman-tasks.gemspec +5 -6
- data/gemfile.d/foreman-tasks.rb +1 -0
- data/lib/foreman_tasks/dynflow/console_authorizer.rb +2 -2
- data/lib/foreman_tasks/engine.rb +17 -19
- data/lib/foreman_tasks/tasks/cleanup.rake +1 -1
- data/lib/foreman_tasks/tasks/export_tasks.rake +2 -2
- data/lib/foreman_tasks/test_extensions.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +2 -2
- data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/en/foreman_tasks.po +270 -54
- data/locale/foreman_tasks.pot +630 -292
- data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/fr/foreman_tasks.po +817 -0
- data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ja/foreman_tasks.po +817 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/zh_CN/foreman_tasks.po +816 -0
- data/package.json +1 -2
- data/script/rails +2 -2
- data/script/travis_run_js_tests.sh +2 -2
- data/test/factories/task_factory.rb +34 -2
- data/test/foreman_tasks_test_helper.rb +4 -0
- data/test/lib/concerns/polling_action_extensions_test.rb +34 -0
- data/test/unit/actions/action_with_sub_plans_test.rb +1 -1
- data/test/unit/task_test.rb +160 -74
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +67 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js +46 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js +16 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js +14 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap +233 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap +25 -0
- data/webpack/ForemanTasks/Components/TaskActions/index.js +115 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +17 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +132 -165
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +3 -12
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +8 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +68 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/RunningSteps.test.js.snap +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +108 -75
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +3 -9
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +35 -5
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +34 -14
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -4
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +4 -10
- data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +8 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +7 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +18 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +30 -13
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +91 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +13 -4
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +5 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +3 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js +14 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js +83 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js +106 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js +38 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +45 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js +36 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js +205 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js +27 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +54 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap +41 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap +19 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +30 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js +43 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +75 -0
- data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +4 -1
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +247 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +37 -19
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +56 -92
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +19 -11
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +4 -3
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +64 -73
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +21 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +13 -4
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +147 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +3 -10
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +46 -74
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +17 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +9 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +22 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +4 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +336 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +3 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +22 -158
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +56 -132
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +34 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/index.js +10 -4
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +47 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +61 -14
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +80 -21
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss +9 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js +44 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap +52 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +59 -66
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/ToastTypesConstants.js +11 -0
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +2 -2
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +17 -3
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- data/webpack/__mocks__/foremanReact/{API.js → redux/API.js} +1 -1
- metadata +76 -27
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +0 -53
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +0 -56
- data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +0 -52
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +0 -24
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +0 -65
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +0 -30
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +0 -63
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -26
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +0 -27
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +0 -15
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1026fe8670d8a41977697a9ff2bd4f04758dca2f18a9bac806dea4856cb4478
|
|
4
|
+
data.tar.gz: 8ec9ddbfb5a444a525cc27d178ade81c30e5c7c8b4fe0e577aba7d780ed3b37d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 044b43805dcfd80a9607154d0a8be54b54b8b054923727d79f699dec5a4f355fe84d1533f5049ecc47d65efd3313447a070cc9bd01bea47bbd639f800847375e
|
|
7
|
+
data.tar.gz: edd5a4f741c2e55eb7d695011e8dc7a017214e0a5b43027035352095ad8132d8ea93a75c5991a97c5ffa05645f970f6d878a5d33ba6f6c75ed7ece1b16af4237
|
data/.rubocop.yml
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
require:
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-minitest
|
|
3
|
+
- rubocop-performance
|
|
4
|
+
- rubocop-rails
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
inherit_from:
|
|
5
|
-
- .rubocop_todo.yml
|
|
6
|
+
inherit_from: .rubocop_todo.yml
|
|
6
7
|
|
|
7
8
|
AllCops:
|
|
8
9
|
Include:
|
|
@@ -55,12 +56,11 @@ Rails/FilePath:
|
|
|
55
56
|
Rails/ReversibleMigration:
|
|
56
57
|
Enabled: false
|
|
57
58
|
|
|
58
|
-
Metrics
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- lib/foreman_tasks/tasks/**/*
|
|
59
|
+
Metrics:
|
|
60
|
+
Enabled: false
|
|
61
|
+
|
|
62
|
+
Layout/LineLength:
|
|
63
|
+
Enabled: false
|
|
64
64
|
|
|
65
65
|
Naming/FileName:
|
|
66
66
|
Exclude:
|
|
@@ -69,7 +69,7 @@ Naming/FileName:
|
|
|
69
69
|
- db/seeds.d/*
|
|
70
70
|
- lib/foreman-tasks.rb
|
|
71
71
|
|
|
72
|
-
Layout/
|
|
72
|
+
Layout/HeredocIndentation:
|
|
73
73
|
Exclude:
|
|
74
74
|
- '*.gemspec'
|
|
75
75
|
- bin/*
|
|
@@ -101,7 +101,7 @@ Style/FormatStringToken:
|
|
|
101
101
|
Style/RegexpLiteral:
|
|
102
102
|
Enabled: false
|
|
103
103
|
|
|
104
|
-
Layout/
|
|
104
|
+
Layout/HashAlignment:
|
|
105
105
|
Enabled: false
|
|
106
106
|
|
|
107
107
|
Metrics/ClassLength:
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,113 +1,49 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2018-04-02 18:15:37 +0200 using RuboCop version 0.54.0.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 3
|
|
10
|
-
# Cop supports --auto-correct.
|
|
11
|
-
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
|
12
|
-
# Include: **/*.gemspec
|
|
13
|
-
Gemspec/OrderedDependencies:
|
|
14
|
-
Exclude:
|
|
15
|
-
- 'foreman-tasks.gemspec'
|
|
16
|
-
|
|
17
|
-
# Offense count: 1
|
|
18
|
-
# Cop supports --auto-correct.
|
|
19
|
-
# Configuration parameters: EnforcedStyle.
|
|
20
|
-
# SupportedStyles: final_newline, final_blank_line
|
|
21
|
-
Layout/TrailingBlankLines:
|
|
22
|
-
Exclude:
|
|
23
|
-
- 'locale/action_names.rb'
|
|
24
|
-
|
|
25
1
|
# Offense count: 1
|
|
26
2
|
Lint/EmptyWhen:
|
|
27
3
|
Exclude:
|
|
28
4
|
- 'app/lib/actions/proxy_action.rb'
|
|
29
5
|
|
|
30
|
-
# Offense count:
|
|
6
|
+
# Offense count: 1
|
|
31
7
|
Lint/UselessAssignment:
|
|
32
8
|
Exclude:
|
|
33
9
|
- 'lib/foreman_tasks/tasks/export_tasks.rake'
|
|
34
10
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Max: 41
|
|
38
|
-
|
|
39
|
-
# Offense count: 2
|
|
40
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
|
41
|
-
Metrics/BlockLength:
|
|
42
|
-
Max: 32
|
|
43
|
-
|
|
44
|
-
# Offense count: 13
|
|
45
|
-
# Configuration parameters: CountComments.
|
|
46
|
-
Metrics/ClassLength:
|
|
47
|
-
Max: 230
|
|
48
|
-
|
|
49
|
-
# Offense count: 9
|
|
50
|
-
Metrics/CyclomaticComplexity:
|
|
51
|
-
Max: 9
|
|
52
|
-
|
|
53
|
-
# Offense count: 482
|
|
54
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
55
|
-
# URISchemes: http, https
|
|
56
|
-
Metrics/LineLength:
|
|
57
|
-
Max: 211
|
|
58
|
-
|
|
59
|
-
# Offense count: 54
|
|
60
|
-
# Configuration parameters: CountComments.
|
|
61
|
-
Metrics/MethodLength:
|
|
62
|
-
Max: 29
|
|
63
|
-
|
|
64
|
-
# Offense count: 2
|
|
65
|
-
# Configuration parameters: CountComments.
|
|
66
|
-
Metrics/ModuleLength:
|
|
67
|
-
Max: 167
|
|
11
|
+
Minitest/AssertEmpty:
|
|
12
|
+
Enabled: false
|
|
68
13
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Metrics/ParameterLists:
|
|
72
|
-
Max: 6
|
|
14
|
+
Minitest/AssertEqual:
|
|
15
|
+
Enabled: false
|
|
73
16
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Max: 9
|
|
17
|
+
Minitest/GlobalExpectations:
|
|
18
|
+
Enabled: false
|
|
77
19
|
|
|
78
20
|
# Offense count: 3
|
|
21
|
+
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
|
22
|
+
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
|
79
23
|
Naming/MemoizedInstanceVariableName:
|
|
80
24
|
Exclude:
|
|
81
25
|
- 'app/controllers/foreman_tasks/recurring_logics_controller.rb'
|
|
82
26
|
- 'app/lib/actions/recurring_action.rb'
|
|
83
27
|
- 'lib/foreman_tasks_core/otp_manager.rb'
|
|
84
28
|
|
|
29
|
+
# Offense count: 11
|
|
30
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
31
|
+
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
|
|
32
|
+
Naming/MethodParameterName:
|
|
33
|
+
Exclude:
|
|
34
|
+
- 'app/helpers/foreman_tasks/foreman_tasks_helper.rb'
|
|
35
|
+
|
|
85
36
|
# Offense count: 1
|
|
86
|
-
# Configuration parameters: NamePrefix,
|
|
37
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
|
87
38
|
# NamePrefix: is_, has_, have_
|
|
88
|
-
#
|
|
89
|
-
#
|
|
39
|
+
# ForbiddenPrefixes: is_, has_, have_
|
|
40
|
+
# AllowedMethods: is_a?
|
|
90
41
|
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
91
42
|
Naming/PredicateName:
|
|
92
43
|
Exclude:
|
|
93
44
|
- 'spec/**/*'
|
|
94
45
|
- 'app/models/foreman_tasks/task/status_explicator.rb'
|
|
95
46
|
|
|
96
|
-
# Offense count: 12
|
|
97
|
-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
98
|
-
# AllowedNames: io, id, to
|
|
99
|
-
Naming/UncommunicativeMethodParamName:
|
|
100
|
-
Exclude:
|
|
101
|
-
- 'app/helpers/foreman_tasks/foreman_tasks_helper.rb'
|
|
102
|
-
- 'app/models/foreman_tasks/recurring_logic.rb'
|
|
103
|
-
|
|
104
|
-
# Offense count: 3
|
|
105
|
-
# Cop supports --auto-correct.
|
|
106
|
-
Rails/ActiveRecordAliases:
|
|
107
|
-
Exclude:
|
|
108
|
-
- 'app/models/foreman_tasks/task/dynflow_task.rb'
|
|
109
|
-
- 'test/factories/task_factory.rb'
|
|
110
|
-
|
|
111
47
|
# Offense count: 6
|
|
112
48
|
# Configuration parameters: Include.
|
|
113
49
|
# Include: db/migrate/*.rb
|
|
@@ -119,14 +55,6 @@ Rails/CreateTableWithTimestamps:
|
|
|
119
55
|
- 'db/migrate/20150907131503_create_task_groups.rb'
|
|
120
56
|
- 'db/migrate/20151112152108_create_triggerings.rb'
|
|
121
57
|
|
|
122
|
-
# Offense count: 1
|
|
123
|
-
# Cop supports --auto-correct.
|
|
124
|
-
# Configuration parameters: EnforcedStyle.
|
|
125
|
-
# SupportedStyles: numeric, symbolic
|
|
126
|
-
Rails/HttpStatus:
|
|
127
|
-
Exclude:
|
|
128
|
-
- 'app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb'
|
|
129
|
-
|
|
130
58
|
# Offense count: 1
|
|
131
59
|
# Configuration parameters: Include.
|
|
132
60
|
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
|
|
@@ -139,7 +67,14 @@ Rails/OutputSafety:
|
|
|
139
67
|
Exclude:
|
|
140
68
|
- 'app/helpers/foreman_tasks/foreman_tasks_helper.rb'
|
|
141
69
|
|
|
142
|
-
# Offense count:
|
|
70
|
+
# Offense count: 1
|
|
71
|
+
# Configuration parameters: Include.
|
|
72
|
+
# Include: **/Rakefile, **/*.rake
|
|
73
|
+
Rails/RakeEnvironment:
|
|
74
|
+
Exclude:
|
|
75
|
+
- 'lib/foreman_tasks/tasks/test.rake'
|
|
76
|
+
|
|
77
|
+
# Offense count: 12
|
|
143
78
|
# Cop supports --auto-correct.
|
|
144
79
|
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
|
145
80
|
# SupportedStyles: nested, compact
|
|
@@ -163,33 +98,16 @@ Style/DoubleNegation:
|
|
|
163
98
|
- 'app/models/foreman_tasks/lock.rb'
|
|
164
99
|
- 'app/models/foreman_tasks/recurring_logic.rb'
|
|
165
100
|
|
|
166
|
-
# Offense count:
|
|
167
|
-
# Cop supports --auto-correct.
|
|
168
|
-
Style/Encoding:
|
|
169
|
-
Exclude:
|
|
170
|
-
- 'foreman-tasks-core.gemspec'
|
|
171
|
-
- 'foreman-tasks.gemspec'
|
|
172
|
-
|
|
173
|
-
# Offense count: 6
|
|
174
|
-
# Cop supports --auto-correct.
|
|
175
|
-
Style/ExpandPathArguments:
|
|
176
|
-
Exclude:
|
|
177
|
-
- 'foreman-tasks-core.gemspec'
|
|
178
|
-
- 'foreman-tasks.gemspec'
|
|
179
|
-
- 'lib/foreman_tasks/engine.rb'
|
|
180
|
-
- 'script/rails'
|
|
181
|
-
|
|
182
|
-
# Offense count: 32
|
|
101
|
+
# Offense count: 36
|
|
183
102
|
# Configuration parameters: MinBodyLength.
|
|
184
103
|
Style/GuardClause:
|
|
185
104
|
Enabled: false
|
|
186
105
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Style/
|
|
191
|
-
|
|
192
|
-
- 'app/models/foreman_tasks/concerns/action_triggering.rb'
|
|
106
|
+
Style/HashEachMethods:
|
|
107
|
+
Enabled: false
|
|
108
|
+
|
|
109
|
+
Style/HashTransformKeys:
|
|
110
|
+
Enabled: false
|
|
193
111
|
|
|
194
|
-
|
|
112
|
+
Style/HashTransformValues:
|
|
195
113
|
Enabled: false
|
data/README.md
CHANGED
|
@@ -10,6 +10,12 @@ module ForemanTasks
|
|
|
10
10
|
api_base_url '/foreman_tasks/api'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
# Foreman right now doesn't have mechanism to
|
|
14
|
+
# cause general BadRequest handling, resuing the Apipie::ParamError
|
|
15
|
+
# for now http://projects.theforeman.org/issues/3957
|
|
16
|
+
class BadRequest < Apipie::ParamError
|
|
17
|
+
end
|
|
18
|
+
|
|
13
19
|
before_action :find_resource, :only => %w[show cancel update]
|
|
14
20
|
|
|
15
21
|
api :GET, '/recurring_logics', N_('List recurring logics')
|
|
@@ -39,9 +45,22 @@ module ForemanTasks
|
|
|
39
45
|
ForemanTasks::RecurringLogic
|
|
40
46
|
end
|
|
41
47
|
|
|
48
|
+
api :POST, '/recurring_logics/bulk_destroy', N_('Delete recurring logics by search query')
|
|
49
|
+
param :search, String, :desc => N_('Search query'), :required => true
|
|
50
|
+
def bulk_destroy
|
|
51
|
+
if params[:search].blank?
|
|
52
|
+
raise BadRequest, _('Please provide a search parameter in the request')
|
|
53
|
+
end
|
|
54
|
+
scope = resource_scope.search_for(params[:search])
|
|
55
|
+
scope.each(&:destroy!)
|
|
56
|
+
render json: { destroyed: scope }
|
|
57
|
+
rescue ActiveRecord::RecordNotDestroyed => error
|
|
58
|
+
render json: { error: error, scope: scope }, status: :bad_request
|
|
59
|
+
end
|
|
60
|
+
|
|
42
61
|
def action_permission
|
|
43
62
|
case params[:action]
|
|
44
|
-
when 'cancel'
|
|
63
|
+
when 'cancel', 'bulk_destroy'
|
|
45
64
|
'edit'
|
|
46
65
|
else
|
|
47
66
|
super
|
|
@@ -89,19 +89,14 @@ module ForemanTasks
|
|
|
89
89
|
param :search, String, :desc => N_('Resume tasks matching search string')
|
|
90
90
|
param :task_ids, Array, :desc => N_('Resume specific tasks by ID')
|
|
91
91
|
def bulk_resume
|
|
92
|
-
scope = resource_scope
|
|
93
|
-
scope = scope.search_for(params[:search]) if params[:search]
|
|
94
|
-
scope = scope.select('DISTINCT foreman_tasks_tasks.*')
|
|
95
92
|
if params[:search].nil? && params[:task_ids].nil?
|
|
96
|
-
|
|
97
|
-
scope = scope.where(:result => :error)
|
|
93
|
+
raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
|
|
98
94
|
end
|
|
99
|
-
scope = scope.where(:id => params[:task_ids]) if params[:task_ids]
|
|
100
|
-
|
|
101
95
|
resumed = []
|
|
102
96
|
failed = []
|
|
103
97
|
skipped = []
|
|
104
|
-
|
|
98
|
+
filtered_scope = bulk_scope
|
|
99
|
+
filtered_scope.each do |task|
|
|
105
100
|
if task.resumable?
|
|
106
101
|
begin
|
|
107
102
|
ForemanTasks.dynflow.world.execute(task.execution_plan.id)
|
|
@@ -113,7 +108,10 @@ module ForemanTasks
|
|
|
113
108
|
skipped << task_hash(task)
|
|
114
109
|
end
|
|
115
110
|
end
|
|
116
|
-
|
|
111
|
+
if params[:search]
|
|
112
|
+
notification = UINotifications::Tasks::TaskBulkResume.new(filtered_scope.first, resumed.length, failed.length, skipped.length)
|
|
113
|
+
notification.deliver!
|
|
114
|
+
end
|
|
117
115
|
render :json => {
|
|
118
116
|
total: resumed.length + failed.length + skipped.length,
|
|
119
117
|
resumed: resumed,
|
|
@@ -122,6 +120,55 @@ module ForemanTasks
|
|
|
122
120
|
}
|
|
123
121
|
end
|
|
124
122
|
|
|
123
|
+
api :POST, '/tasks/bulk_cancel', N_('Cancel all cancellable tasks')
|
|
124
|
+
param :search, String, :desc => N_('Cancel tasks matching search string')
|
|
125
|
+
param :task_ids, Array, :desc => N_('Cancel specific tasks by ID')
|
|
126
|
+
def bulk_cancel
|
|
127
|
+
if params[:search].nil? && params[:task_ids].nil?
|
|
128
|
+
raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
|
|
129
|
+
end
|
|
130
|
+
filtered_scope = bulk_scope
|
|
131
|
+
cancelled, skipped = filtered_scope.partition(&:cancellable?)
|
|
132
|
+
cancelled.each(&:cancel)
|
|
133
|
+
if params[:search]
|
|
134
|
+
notification = UINotifications::Tasks::TaskBulkCancel.new(filtered_scope.first, cancelled.length, skipped.length)
|
|
135
|
+
notification.deliver!
|
|
136
|
+
end
|
|
137
|
+
render :json => {
|
|
138
|
+
total: cancelled.length + skipped.length,
|
|
139
|
+
cancelled: cancelled,
|
|
140
|
+
skipped: skipped
|
|
141
|
+
}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
api :POST, '/tasks/bulk_stop', N_('Stop all stoppable tasks')
|
|
145
|
+
param :search, String, :desc => N_('Stop tasks matching search string')
|
|
146
|
+
param :task_ids, Array, :desc => N_('Stop specific tasks by ID')
|
|
147
|
+
def bulk_stop
|
|
148
|
+
if params[:search].nil? && params[:task_ids].nil?
|
|
149
|
+
raise BadRequest, _('Please provide at least one of search or task_ids parameters in the request')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
filtered_scope = bulk_scope
|
|
153
|
+
total_length = filtered_scope.count
|
|
154
|
+
to_stop = filtered_scope.where.not(state: :stopped)
|
|
155
|
+
to_stop_length = to_stop.count
|
|
156
|
+
skipped_length = total_length - to_stop_length
|
|
157
|
+
|
|
158
|
+
to_stop.find_each { |task| task.update(state: :stopped) }
|
|
159
|
+
|
|
160
|
+
if params[:search]
|
|
161
|
+
notification = UINotifications::Tasks::TaskBulkStop.new(filtered_scope.first, to_stop_length, skipped_length)
|
|
162
|
+
notification.deliver!
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
render :json => {
|
|
166
|
+
total: total_length,
|
|
167
|
+
stopped_length: to_stop_length,
|
|
168
|
+
skipped_length: skipped_length
|
|
169
|
+
}
|
|
170
|
+
end
|
|
171
|
+
|
|
125
172
|
api :GET, '/tasks', N_('List tasks')
|
|
126
173
|
param :search, String, :desc => N_('Search string')
|
|
127
174
|
param :page, :number, :desc => N_('Page number, starting at 1')
|
|
@@ -272,7 +319,7 @@ module ForemanTasks
|
|
|
272
319
|
case params[:action]
|
|
273
320
|
when 'bulk_search', 'summary', 'details', 'sub_tasks'
|
|
274
321
|
:view
|
|
275
|
-
when 'bulk_resume'
|
|
322
|
+
when 'bulk_resume', 'bulk_cancel', 'bulk_stop'
|
|
276
323
|
:edit
|
|
277
324
|
else
|
|
278
325
|
super
|
|
@@ -311,6 +358,14 @@ module ForemanTasks
|
|
|
311
358
|
results: results
|
|
312
359
|
}
|
|
313
360
|
end
|
|
361
|
+
|
|
362
|
+
def bulk_scope
|
|
363
|
+
scope = resource_scope
|
|
364
|
+
scope = scope.search_for(params[:search]) if params[:search]
|
|
365
|
+
scope = scope.select('DISTINCT foreman_tasks_tasks.*')
|
|
366
|
+
scope = scope.where(:id => params[:task_ids]) if params[:task_ids]
|
|
367
|
+
scope
|
|
368
|
+
end
|
|
314
369
|
end
|
|
315
370
|
end
|
|
316
371
|
end
|
|
@@ -9,7 +9,7 @@ module ForemanTasks
|
|
|
9
9
|
params[:certname],
|
|
10
10
|
detected_proxy.try(:id))
|
|
11
11
|
|
|
12
|
-
render :json => { :task_id => task.id }, :status =>
|
|
12
|
+
render :json => { :task_id => task.id }, :status => :accepted
|
|
13
13
|
rescue ::Foreman::Exception => e
|
|
14
14
|
render :json => { 'message' => e.to_s }, :status => :unprocessable_entity
|
|
15
15
|
end
|
|
@@ -22,6 +22,12 @@ module ForemanTasks
|
|
|
22
22
|
redirect_to :action => :index
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def clear_cancelled
|
|
26
|
+
scope = resource_base.search_for('state=cancelled')
|
|
27
|
+
scope.destroy_all
|
|
28
|
+
redirect_to :action => :index
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
def controller_name
|
|
26
32
|
'foreman_tasks_recurring_logics'
|
|
27
33
|
end
|
|
@@ -49,5 +55,18 @@ module ForemanTasks
|
|
|
49
55
|
scope.search_for(params[:search])
|
|
50
56
|
.paginate(:page => params[:page], :per_page => params[:per_page])
|
|
51
57
|
end
|
|
58
|
+
|
|
59
|
+
def action_permission
|
|
60
|
+
case params[:action]
|
|
61
|
+
when 'clear_cancelled'
|
|
62
|
+
'edit'
|
|
63
|
+
else
|
|
64
|
+
super
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def controller_permission
|
|
69
|
+
'recurring_logics'
|
|
70
|
+
end
|
|
52
71
|
end
|
|
53
72
|
end
|