foreman-tasks 8.3.1 → 9.0.0

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman-tasks/locale/de/foreman_tasks.js +899 -1
  3. data/app/assets/javascripts/foreman-tasks/locale/en/foreman_tasks.js +899 -1
  4. data/app/assets/javascripts/foreman-tasks/locale/es/foreman_tasks.js +900 -1
  5. data/app/assets/javascripts/foreman-tasks/locale/fr/foreman_tasks.js +900 -1
  6. data/app/assets/javascripts/foreman-tasks/locale/ja/foreman_tasks.js +898 -1
  7. data/app/assets/javascripts/foreman-tasks/locale/ka/foreman_tasks.js +899 -1
  8. data/app/assets/javascripts/foreman-tasks/locale/ko/foreman_tasks.js +899 -1
  9. data/app/assets/javascripts/foreman-tasks/locale/pt_BR/foreman_tasks.js +900 -1
  10. data/app/assets/javascripts/foreman-tasks/locale/ru/foreman_tasks.js +899 -1
  11. data/app/assets/javascripts/foreman-tasks/locale/zh_CN/foreman_tasks.js +898 -1
  12. data/app/assets/javascripts/foreman-tasks/locale/zh_TW/foreman_tasks.js +899 -1
  13. data/app/lib/actions/bulk_action.rb +4 -1
  14. data/app/lib/actions/trigger_proxy_batch.rb +13 -8
  15. data/app/models/foreman_tasks/concerns/user_extensions.rb +5 -3
  16. data/lib/foreman_tasks/engine.rb +1 -1
  17. data/lib/foreman_tasks/version.rb +1 -1
  18. data/locale/action_names.rb +2 -0
  19. data/locale/de/foreman_tasks.po +36 -0
  20. data/locale/en/foreman_tasks.po +36 -1
  21. data/locale/es/foreman_tasks.po +36 -0
  22. data/locale/foreman_tasks.pot +70 -8
  23. data/locale/fr/foreman_tasks.po +36 -0
  24. data/locale/ja/foreman_tasks.po +36 -0
  25. data/locale/ka/foreman_tasks.po +36 -0
  26. data/locale/ko/foreman_tasks.po +36 -0
  27. data/locale/pt_BR/foreman_tasks.po +36 -0
  28. data/locale/ru/foreman_tasks.po +36 -0
  29. data/locale/zh_CN/foreman_tasks.po +36 -0
  30. data/locale/zh_TW/foreman_tasks.po +36 -0
  31. data/test/unit/actions/bulk_action_test.rb +27 -0
  32. data/test/unit/actions/trigger_proxy_batch_test.rb +7 -0
  33. data/webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js +1 -7
  34. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +2 -1
  35. metadata +2 -2
@@ -16,6 +16,12 @@ module ForemanTasks
16
16
  end
17
17
  end
18
18
 
19
+ class KwArgChildAction < Actions::EntryAction
20
+ def plan(_target, options = {})
21
+ plan_self(kw_string: options['kw'], kw_symbol: options[:kw])
22
+ end
23
+ end
24
+
19
25
  describe Actions::BulkAction do
20
26
  include ForemanTasks::TestHelpers::WithInThreadExecutor
21
27
 
@@ -46,6 +52,27 @@ module ForemanTasks
46
52
  _(success.count).must_equal 4
47
53
  _(failed.count).must_equal 1
48
54
  end
55
+
56
+ specify "it handles keyword arguments as indifferent hashes when they're being flattened" do
57
+ Target.expects(:unscoped).returns(Target)
58
+ Target.expects(:where).with(:id => targets.map(&:id)).returns(targets)
59
+
60
+ triggered = ForemanTasks.trigger(ParentAction, KwArgChildAction, targets, kw: 7)
61
+ task = ForemanTasks::Task.where(:external_id => triggered.id).first
62
+ wait_for { task.reload.state == 'stopped' }
63
+ task = task.sub_tasks.first
64
+ _(task.input[:kw_string]).must_equal 7
65
+ _(task.input[:kw_symbol]).must_equal 7
66
+ end
67
+
68
+ specify 'it allows setting concurrency limit' do
69
+ Target.expects(:unscoped).returns(Target)
70
+ Target.expects(:where).with(:id => targets.map(&:id)).returns(targets)
71
+
72
+ triggered = ForemanTasks.trigger(ParentAction, ChildAction, targets, concurrency_limit: 25)
73
+ task = ForemanTasks::Task.where(:external_id => triggered.id).first
74
+ _(task.execution_plan.entry_action.concurrency_limit).must_equal 25
75
+ end
49
76
  end
50
77
  end
51
78
  end
@@ -32,6 +32,13 @@ module ForemanTasks
32
32
  triggered.output[:planned_count] = ((total_count - 1) / batch_size) * batch_size
33
33
  run_action(triggered)
34
34
  end
35
+
36
+ it "finishes after the last batch even if the counts don't match" do
37
+ Actions::TriggerProxyBatch.any_instance.expects(:trigger_remote_tasks_batch).once
38
+ triggered.output[:planned_count] = 0
39
+ action = run_action(triggered, Actions::TriggerProxyBatch::TriggerLastBatch)
40
+ _(action.state).must_equal :success
41
+ end
35
42
  end
36
43
 
37
44
  describe '#trigger_remote_tasks_batch' do
@@ -1,10 +1,4 @@
1
1
  import React from 'react';
2
- import { translate as __ } from 'foremanReact/common/I18n';
3
2
  import TasksTablePage from './';
4
3
 
5
- export const TasksIndexPage = props => {
6
- const getBreadcrumbs = () => ({
7
- breadcrumbItems: [{ caption: __('Tasks'), url: `/foreman_tasks/tasks` }],
8
- });
9
- return <TasksTablePage getBreadcrumbs={getBreadcrumbs} {...props} />;
10
- };
4
+ export const TasksIndexPage = props => <TasksTablePage {...props} />;
@@ -123,7 +123,7 @@ TasksTablePage.propTypes = {
123
123
  selectAllRows: PropTypes.func.isRequired,
124
124
  results: PropTypes.array.isRequired,
125
125
  getTableItems: PropTypes.func.isRequired,
126
- getBreadcrumbs: PropTypes.func.isRequired,
126
+ getBreadcrumbs: PropTypes.func,
127
127
  actionName: PropTypes.string,
128
128
  status: PropTypes.oneOf(Object.keys(STATUS)),
129
129
  history: PropTypes.object.isRequired,
@@ -143,6 +143,7 @@ TasksTablePage.propTypes = {
143
143
  TasksTablePage.defaultProps = {
144
144
  perPage: 20,
145
145
  allRowsSelected: false,
146
+ getBreadcrumbs: () => null,
146
147
  actionName: '',
147
148
  status: STATUS.PENDING,
148
149
  selectedRows: [],
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: 8.3.1
4
+ version: 9.0.0
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: 2023-10-20 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow