foreman-tasks 2.0.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/js_tests.yml +27 -0
  3. data/.github/workflows/ruby_tests.yml +74 -0
  4. data/.rubocop.yml +12 -4
  5. data/.rubocop_todo.yml +32 -25
  6. data/Gemfile +5 -0
  7. data/app/controllers/foreman_tasks/api/tasks_controller.rb +31 -58
  8. data/app/controllers/foreman_tasks/concerns/parameters/triggering.rb +1 -1
  9. data/app/controllers/foreman_tasks/recurring_logics_controller.rb +7 -0
  10. data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +3 -3
  11. data/app/models/foreman_tasks/recurring_logic.rb +4 -4
  12. data/app/models/foreman_tasks/task.rb +11 -0
  13. data/app/models/foreman_tasks/task/dynflow_task.rb +27 -33
  14. data/app/models/foreman_tasks/task/status_explicator.rb +1 -1
  15. data/app/models/foreman_tasks/triggering.rb +1 -1
  16. data/app/models/setting/foreman_tasks.rb +1 -1
  17. data/app/views/foreman_tasks/api/tasks/index.json.rabl +2 -0
  18. data/app/views/foreman_tasks/recurring_logics/index.html.erb +3 -1
  19. data/config/routes.rb +2 -1
  20. data/db/migrate/20200517215015_rename_bookmarks_controller.rb +2 -2
  21. data/db/seeds.d/30-notification_blueprints.rb +7 -7
  22. data/db/seeds.d/61-foreman_tasks_bookmarks.rb +1 -1
  23. data/lib/foreman_tasks/cleaner.rb +4 -6
  24. data/lib/foreman_tasks/dynflow/configuration.rb +1 -1
  25. data/lib/foreman_tasks/dynflow/persistence.rb +4 -6
  26. data/lib/foreman_tasks/engine.rb +2 -2
  27. data/lib/foreman_tasks/version.rb +1 -1
  28. data/package.json +0 -1
  29. data/test/controllers/api/recurring_logics_controller_test.rb +1 -1
  30. data/test/controllers/api/tasks_controller_test.rb +7 -7
  31. data/test/controllers/tasks_controller_test.rb +6 -6
  32. data/test/core/unit/runner_test.rb +20 -20
  33. data/test/core/unit/task_launcher_test.rb +8 -8
  34. data/test/helpers/foreman_tasks/foreman_tasks_helper_test.rb +7 -7
  35. data/test/helpers/foreman_tasks/tasks_helper_test.rb +3 -3
  36. data/test/lib/actions/middleware/keep_current_request_id_test.rb +3 -3
  37. data/test/support/history_tasks_builder.rb +1 -1
  38. data/test/tasks/generate_task_actions_test.rb +1 -1
  39. data/test/unit/actions/action_with_sub_plans_test.rb +2 -2
  40. data/test/unit/actions/bulk_action_test.rb +6 -6
  41. data/test/unit/actions/proxy_action_test.rb +20 -20
  42. data/test/unit/actions/recurring_action_test.rb +30 -32
  43. data/test/unit/cleaner_test.rb +24 -24
  44. data/test/unit/dashboard_table_filter_test.rb +5 -5
  45. data/test/unit/otp_manager_test.rb +2 -2
  46. data/test/unit/proxy_selector_test.rb +9 -9
  47. data/test/unit/recurring_logic_test.rb +32 -38
  48. data/test/unit/remote_task_test.rb +2 -2
  49. data/test/unit/task_groups_test.rb +4 -4
  50. data/test/unit/task_test.rb +18 -18
  51. data/test/unit/triggering_test.rb +8 -8
  52. data/test/unit/troubleshooting_help_generator_test.rb +6 -6
  53. data/test/unit/ui_notifications_test.rb +11 -11
  54. data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +3 -3
  55. data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +8 -157
  56. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskButtons.js +168 -0
  57. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +6 -7
  58. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskSkeleton.js +48 -0
  59. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
  60. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +12 -70
  61. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskButtons.test.js +95 -0
  62. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +78 -225
  63. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskButtons.test.js.snap +212 -0
  64. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +8 -4
  65. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +87 -70
  66. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +48 -125
  67. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -16
  68. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +55 -29
  69. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +2 -2
  70. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +6 -0
  71. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +2 -18
  72. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +77 -27
  73. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +14 -101
  74. data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -3
  75. data/webpack/ForemanTasks/Components/common/urlHelpers.js +7 -0
  76. data/webpack/ForemanTasks/ForemanTasksReducers.js +0 -2
  77. data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
  78. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +10 -0
  79. data/webpack/__mocks__/foremanReact/redux/API/index.js +10 -0
  80. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -0
  81. metadata +17 -14
  82. data/.travis.yml +0 -7
  83. data/script/travis_run_js_tests.sh +0 -7
  84. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -38
  85. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +0 -33
  86. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsReducer.test.js.snap +0 -26
  87. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/integration.test.js.snap +0 -122
  88. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +0 -72
  89. data/webpack/__mocks__/foremanReact/redux/API.js +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e37924776f38fa00d98c1389b22baff43347f4f4c28c0d3848de93951b5cd1d9
4
- data.tar.gz: 49c49253f6cd157b6c602bb1ceb5bee9b249aee207939501b60e273b4fce1734
3
+ metadata.gz: 24da58e2837688da28a18832b72b154ac74868157f6176f942119b8b856987c8
4
+ data.tar.gz: 3031305c5f86f3b03aed95a4501670cbd2dbd595db38f638354ff046f416823a
5
5
  SHA512:
6
- metadata.gz: 53aebec3deef276e131483dc20f5ce3753a9bf8b7d64e9a443af9a0284e9749a657c97e03923034db81e1a698aa24d0de120fe3530b5768725e9a910f8b34e52
7
- data.tar.gz: ae5931295bc54e9bfcf3b48278c52724265ddc0e902d39be2d05897f1231b5c29291810f7e638d83f0a436a6f0a414453692158ad9b93c2445db038e87872168
6
+ metadata.gz: a6a21ff8c4b9336f63118c2cdf6a4f11bf25ff882fe1dbd1b17d05f9722705c9cebabb522792416758c3fede1a8507d720cac0317076d8e833bfbb95a83fa8a4
7
+ data.tar.gz: bef5dd6cac70ac43d53e83950668e930883649d42966b10ff6303e0d581431d3f11028ae24c7ecc9ed0e2875214f4a512cfbaa46f1da81fd912d6a6f25da2db2
@@ -0,0 +1,27 @@
1
+ name: JavaScript Testing
2
+ on:
3
+ pull_request:
4
+ paths:
5
+ - 'webpack/**'
6
+ - 'package.json'
7
+ - '.github/workflows/js_tests.yml'
8
+
9
+ jobs:
10
+ test_js:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ node-version: [10, 12]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Setup Node
19
+ uses: actions/setup-node@v1
20
+ with:
21
+ node-version: ${{ matrix.node-version }}
22
+ - name: Npm install
23
+ run: npm install
24
+ - name: Run plugin linter
25
+ run: npm run lint
26
+ - name: Run plugin tests
27
+ run: npm run test
@@ -0,0 +1,74 @@
1
+ name: Ruby Testing
2
+ on: [pull_request]
3
+ env:
4
+ RAILS_ENV: test
5
+ DATABASE_URL: postgresql://postgres:@localhost/test
6
+ DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
7
+ jobs:
8
+ rubocop:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Setup Ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6
16
+ - name: Setup
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs=3 --retry=3
20
+ - name: Run rubocop
21
+ run: bundle exec rubocop
22
+ test_ruby:
23
+ runs-on: ubuntu-latest
24
+ needs: rubocop
25
+ services:
26
+ postgres:
27
+ image: postgres:12.1
28
+ ports: ['5432:5432']
29
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ foreman-core-branch: [develop]
34
+ ruby-version: [2.5, 2.6]
35
+ node-version: [12]
36
+ steps:
37
+ - run: sudo apt-get update
38
+ - run: sudo apt-get install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev
39
+ - uses: actions/checkout@v2
40
+ with:
41
+ repository: theforeman/foreman
42
+ ref: ${{ matrix.foreman-core-branch }}
43
+ - uses: actions/checkout@v2
44
+ with:
45
+ path: foreman-tasks
46
+ - name: Setup Ruby
47
+ uses: ruby/setup-ruby@v1
48
+ with:
49
+ ruby-version: ${{ matrix.ruby-version }}
50
+ - name: Setup Node
51
+ uses: actions/setup-node@v1
52
+ with:
53
+ node-version: ${{ matrix.node-version }}
54
+ - uses: actions/cache@v2
55
+ with:
56
+ path: vendor/bundle
57
+ key: ${{ runner.os }}-fgems-${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.lock') }}
58
+ restore-keys: |
59
+ ${{ runner.os }}-fgems-${{ matrix.ruby-version }}-
60
+ - name: Setup Bundler
61
+ run: |
62
+ echo "gem 'foreman-tasks', path: './foreman-tasks'" > bundler.d/foreman-tasks.local.rb
63
+ gem install bundler
64
+ bundle config set without journald development console libvirt
65
+ bundle config set path vendor/bundle
66
+ - name: Prepare test env
67
+ run: |
68
+ bundle install --jobs=3 --retry=3
69
+ bundle exec rake db:create
70
+ bundle exec rake db:migrate
71
+ - name: Run plugin tests
72
+ run: |
73
+ bundle exec rake test:foreman-tasks
74
+ bundle exec rake test TEST="test/unit/foreman/access_permissions_test.rb"
data/.rubocop.yml CHANGED
@@ -6,10 +6,10 @@ require:
6
6
  inherit_from: .rubocop_todo.yml
7
7
 
8
8
  AllCops:
9
- Include:
10
- - 'Rakefile'
11
- - 'app/views/foreman_tasks/api/**/*.rabl'
12
- - lib/**/*.rake
9
+ Exclude:
10
+ - 'node_modules/**/*'
11
+ - 'locale/*'
12
+ TargetRubyVersion: 2.5
13
13
 
14
14
  Lint/ShadowingOuterLocalVariable:
15
15
  Enabled: false
@@ -68,6 +68,8 @@ Naming/FileName:
68
68
  - Gemfile
69
69
  - db/seeds.d/*
70
70
  - lib/foreman-tasks.rb
71
+ - gemfile.d/foreman-tasks.rb
72
+
71
73
 
72
74
  Layout/HeredocIndentation:
73
75
  Exclude:
@@ -115,3 +117,9 @@ Naming/RescuedExceptionsVariableName:
115
117
 
116
118
  Style/WordArray:
117
119
  Enabled: false
120
+
121
+ Style/TrailingCommaInArrayLiteral:
122
+ EnforcedStyleForMultiline: comma
123
+
124
+ Style/TrailingCommaInHashLiteral:
125
+ EnforcedStyleForMultiline: comma
data/.rubocop_todo.yml CHANGED
@@ -1,21 +1,34 @@
1
- # Offense count: 1
2
- Lint/EmptyWhen:
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-08-07 08:31:32 UTC using RuboCop version 0.89.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: 2
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
3
13
  Exclude:
4
- - 'app/lib/actions/proxy_action.rb'
14
+ - 'foreman-tasks-core.gemspec'
15
+ - 'foreman-tasks.gemspec'
5
16
 
6
17
  # Offense count: 1
7
18
  Lint/UselessAssignment:
8
19
  Exclude:
9
20
  - 'lib/foreman_tasks/tasks/export_tasks.rake'
10
21
 
11
- Minitest/AssertEmpty:
12
- Enabled: false
13
-
14
- Minitest/AssertEqual:
15
- Enabled: false
16
-
17
- Minitest/GlobalExpectations:
18
- Enabled: false
22
+ # Offense count: 1
23
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
24
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
25
+ Naming/FileName:
26
+ Exclude:
27
+ - '*.gemspec'
28
+ - 'Gemfile'
29
+ - 'db/seeds.d/*'
30
+ - 'lib/foreman-tasks.rb'
31
+ - 'gemfile.d/foreman-tasks.rb'
19
32
 
20
33
  # Offense count: 3
21
34
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
@@ -28,7 +41,7 @@ Naming/MemoizedInstanceVariableName:
28
41
 
29
42
  # Offense count: 11
30
43
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
31
- # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
44
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
32
45
  Naming/MethodParameterName:
33
46
  Exclude:
34
47
  - 'app/helpers/foreman_tasks/foreman_tasks_helper.rb'
@@ -67,11 +80,13 @@ Rails/OutputSafety:
67
80
  Exclude:
68
81
  - 'app/helpers/foreman_tasks/foreman_tasks_helper.rb'
69
82
 
70
- # Offense count: 1
83
+ # Offense count: 2
71
84
  # Configuration parameters: Include.
72
85
  # Include: **/Rakefile, **/*.rake
73
86
  Rails/RakeEnvironment:
74
87
  Exclude:
88
+ - 'lib/capistrano/tasks/**/*.rake'
89
+ - 'lib/foreman_tasks/tasks/dynflow.rake'
75
90
  - 'lib/foreman_tasks/tasks/test.rake'
76
91
 
77
92
  # Offense count: 12
@@ -92,22 +107,14 @@ Style/ClassAndModuleChildren:
92
107
  - 'test/controllers/api/recurring_logics_controller_test.rb'
93
108
  - 'test/controllers/api/tasks_controller_test.rb'
94
109
 
95
- # Offense count: 2
110
+ # Offense count: 1
111
+ # Configuration parameters: EnforcedStyle.
112
+ # SupportedStyles: allowed_in_returns, forbidden
96
113
  Style/DoubleNegation:
97
114
  Exclude:
98
- - 'app/models/foreman_tasks/lock.rb'
99
115
  - 'app/models/foreman_tasks/recurring_logic.rb'
100
116
 
101
- # Offense count: 36
117
+ # Offense count: 35
102
118
  # Configuration parameters: MinBodyLength.
103
119
  Style/GuardClause:
104
120
  Enabled: false
105
-
106
- Style/HashEachMethods:
107
- Enabled: false
108
-
109
- Style/HashTransformKeys:
110
- Enabled: false
111
-
112
- Style/HashTransformValues:
113
- Enabled: false
data/Gemfile CHANGED
@@ -13,3 +13,8 @@ gemspec :name => 'foreman-tasks'
13
13
 
14
14
  # To use debugger
15
15
  # gem 'debugger'
16
+
17
+ gem 'rubocop', '~> 0.87'
18
+ gem 'rubocop-minitest', '~> 0.9.0'
19
+ gem 'rubocop-performance', '~> 1.5.2'
20
+ gem 'rubocop-rails', '~> 2.5.2'
@@ -31,17 +31,6 @@ module ForemanTasks
31
31
  param :id, :identifier, desc: 'UUID of the task'
32
32
  def details; end
33
33
 
34
- api :GET, '/tasks/:id/sub_tasks', 'Show sub_tasks details'
35
- param :id, :identifier, desc: 'UUID of the task'
36
- def sub_tasks
37
- parent_task = resource_scope.find(params[:id])
38
- filtered_scope = parent_task.sub_tasks
39
- action_name = { "action_name" => parent_task.action }
40
-
41
- filtered_scope = DashboardTableFilter.new(filtered_scope, params).scope
42
- render :json => action_name.merge(tasks_list(filtered_scope))
43
- end
44
-
45
34
  api :POST, '/tasks/bulk_search', 'List dynflow tasks for uuids'
46
35
  param :searches, Array, :desc => 'List of uuids to fetch info about' do
47
36
  param :search_id, String, :desc => <<-DESC
@@ -116,7 +105,7 @@ module ForemanTasks
116
105
  total: resumed.length + failed.length + skipped.length,
117
106
  resumed: resumed,
118
107
  failed: failed,
119
- skipped: skipped
108
+ skipped: skipped,
120
109
  }
121
110
  end
122
111
 
@@ -137,7 +126,7 @@ module ForemanTasks
137
126
  render :json => {
138
127
  total: cancelled.length + skipped.length,
139
128
  cancelled: cancelled,
140
- skipped: skipped
129
+ skipped: skipped,
141
130
  }
142
131
  end
143
132
 
@@ -165,22 +154,33 @@ module ForemanTasks
165
154
  render :json => {
166
155
  total: total_length,
167
156
  stopped_length: to_stop_length,
168
- skipped_length: skipped_length
157
+ skipped_length: skipped_length,
169
158
  }
170
159
  end
171
160
 
172
161
  api :GET, '/tasks', N_('List tasks')
173
- param :search, String, :desc => N_('Search string')
174
- param :page, :number, :desc => N_('Page number, starting at 1')
175
- param :per_page, :number, :desc => N_('Number of results per page to return')
176
- param :order, String, :desc => N_("Sort field and order, e.g. 'name DESC'")
177
- param :sort, Hash, :desc => N_("Hash version of 'order' param") do
178
- param :by, String, :desc => N_('Field to sort the results on')
179
- param :order, String, :desc => N_('How to order the sorted results (e.g. ASC for ascending)')
180
- end
162
+ api :GET, '/tasks/:parent_task_id/sub_tasks', 'Show sub_tasks details'
163
+ param :parent_task_id, :identifier, desc: 'UUID of the task'
164
+ param_group :search_and_pagination, ::Api::V2::BaseController
181
165
  def index
182
- filtered_scope = DashboardTableFilter.new(resource_scope, params).scope
183
- render :json => tasks_list(filtered_scope)
166
+ if params[:sort_by] || params[:sort_order]
167
+ Foreman::Deprecation.api_deprecation_warning(
168
+ "The sort params sort_by and sort_order are deprecated.
169
+ Please use the order param instead as one string 'order=started_at desc'"
170
+ )
171
+
172
+ ordering_params = {
173
+ sort_by: params[:sort_by] || 'started_at',
174
+ sort_order: params[:sort_order] || 'DESC',
175
+ }
176
+ params[:order] = "#{ordering_params[:sort_by]} #{ordering_params[:sort_order]}"
177
+ end
178
+ params[:order] ||= 'started_at DESC'
179
+ @tasks = DashboardTableFilter.new(resource_scope_for_index, params).scope.order(params[:order].to_s)
180
+ end
181
+
182
+ def search_options
183
+ [params[:search], {}]
184
184
  end
185
185
 
186
186
  def_param_group :callback_target do
@@ -312,7 +312,13 @@ module ForemanTasks
312
312
  end
313
313
 
314
314
  def resource_scope(_options = {})
315
- @resource_scope ||= ForemanTasks::Task.authorized("#{action_permission}_foreman_tasks")
315
+ scope = ForemanTasks::Task.authorized("#{action_permission}_foreman_tasks")
316
+ scope = scope.where(:parent_task_id => params[:parent_task_id]) if params[:parent_task_id]
317
+ scope
318
+ end
319
+
320
+ def resource_scope_for_index(*args)
321
+ super.select("DISTINCT foreman_tasks_tasks.*, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration")
316
322
  end
317
323
 
318
324
  def controller_permission
@@ -330,39 +336,6 @@ module ForemanTasks
330
336
  end
331
337
  end
332
338
 
333
- def tasks_list(filtered_scope)
334
- total = resource_scope.count
335
-
336
- search_scope = filtered_scope.search_for(params[:search])
337
- subtotal = search_scope.select('DISTINCT foreman_tasks_tasks.id').count
338
- filtered_scope = search_scope.select('DISTINCT foreman_tasks_tasks.*')
339
-
340
- ordering_params = {
341
- sort_by: params[:sort_by] || 'started_at',
342
- sort_order: params[:sort_order] || 'DESC'
343
- }
344
- filtered_scope = ordering_scope(filtered_scope, ordering_params)
345
-
346
- pagination_params = {
347
- page: params[:page] || 1,
348
- per_page: params[:per_page] || Setting[:entries_per_page] || 20
349
- }
350
- filtered_scope = pagination_scope(filtered_scope, pagination_params)
351
- results = filtered_scope.map { |task| task_hash(task) }
352
-
353
- {
354
- total: total,
355
- subtotal: subtotal,
356
- page: pagination_params[:page],
357
- per_page: pagination_params[:per_page],
358
- sort: {
359
- by: ordering_params[:sort_by],
360
- order: ordering_params[:sort_order]
361
- },
362
- results: results
363
- }
364
- end
365
-
366
339
  def bulk_scope
367
340
  scope = resource_scope
368
341
  scope = scope.search_for(params[:search]) if params[:search]
@@ -15,7 +15,7 @@ module ForemanTasks
15
15
  *::ForemanTasks::Triggering::PARAMS,
16
16
  :days_of_week => {},
17
17
  :time => {},
18
- :end_time => {}
18
+ :end_time => {},
19
19
  ],
20
20
  :nested => true
21
21
  )
@@ -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
  ' &mdash; ',
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