foreman-tasks 5.3.0 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_tests.yml +7 -18
  3. data/.rubocop.yml +1 -0
  4. data/app/controllers/foreman_tasks/tasks_controller.rb +18 -18
  5. data/app/lib/actions/helpers/lifecycle_logging.rb +1 -1
  6. data/app/lib/actions/middleware/rails_executor_wrap.rb +2 -2
  7. data/app/lib/actions/proxy_action.rb +1 -1
  8. data/app/lib/actions/trigger_proxy_batch.rb +2 -1
  9. data/app/models/foreman_tasks/lock.rb +1 -1
  10. data/app/models/foreman_tasks/recurring_logic.rb +1 -1
  11. data/app/models/foreman_tasks/remote_task.rb +5 -4
  12. data/extra/foreman-tasks-cleanup.sh +19 -2
  13. data/lib/foreman_tasks/dynflow/configuration.rb +1 -1
  14. data/lib/foreman_tasks/dynflow.rb +1 -1
  15. data/lib/foreman_tasks/engine.rb +7 -7
  16. data/lib/foreman_tasks/tasks/export_tasks.rake +27 -19
  17. data/lib/foreman_tasks/version.rb +1 -1
  18. data/locale/action_names.rb +2 -3
  19. data/locale/en/foreman_tasks.po +27 -3
  20. data/locale/foreman_tasks.pot +230 -176
  21. data/locale/fr/foreman_tasks.po +27 -3
  22. data/locale/ja/foreman_tasks.po +27 -3
  23. data/locale/zh_CN/foreman_tasks.po +27 -3
  24. data/test/controllers/api/tasks_controller_test.rb +1 -2
  25. data/test/support/dummy_proxy_action.rb +1 -1
  26. data/test/unit/actions/proxy_action_test.rb +19 -13
  27. data/test/unit/remote_task_test.rb +26 -0
  28. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js +11 -14
  29. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/OtherInfo.test.js.snap +11 -27
  30. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +2 -28
  31. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +5 -9
  32. data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +1 -5
  33. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +2 -2
  34. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +1 -4
  35. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +1 -6
  36. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +1 -6
  37. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap +2 -22
  38. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +2 -12
  39. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +1 -4
  40. data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
  41. data/webpack/__mocks__/foremanReact/components/Pagination/index.js +2 -0
  42. metadata +4 -4
  43. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
@@ -57,6 +57,9 @@ msgstr "Le paramètre :after dans la section de nettoyage des tâches est obsol
57
57
  msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
58
58
  msgstr "Une tâche en pause représente un processus qui ne s'est pas terminé correctement. Toute tâche en état de pause peut entraîner une incohérence potentielle et doit être résolue."
59
59
 
60
+ msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
61
+ msgstr ""
62
+
60
63
  msgid "Action"
61
64
  msgstr "Action"
62
65
 
@@ -69,6 +72,9 @@ msgstr "Actif"
69
72
  msgid "Active Filters:"
70
73
  msgstr "Filtres actifs :"
71
74
 
75
+ msgid "Active or disabled recurring logic with purpose %s already exists"
76
+ msgstr ""
77
+
72
78
  msgid "All %s tasks are selected. "
73
79
  msgstr "Toutes les tâches %s sont sélectionnées. "
74
80
 
@@ -277,6 +283,9 @@ msgstr "Tâches Foreman"
277
283
  msgid "Fri"
278
284
  msgstr "Ven."
279
285
 
286
+ msgid "I understand that this may cause harm and have working database backups of all backend services."
287
+ msgstr ""
288
+
280
289
  msgid "ID"
281
290
  msgstr "ID"
282
291
 
@@ -428,9 +437,6 @@ msgstr "Multiplicateur des intervalles de sondage"
428
437
  msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
429
438
  msgstr "Multiplicateur de sondage qui est utilisé pour multiplier les intervalles de sondage par défaut. Il peut être utilisé pour éviter que les sondages ne soient trop fréquents pour des tâches de longue durée."
430
439
 
431
- msgid "Preupgrade job"
432
- msgstr ""
433
-
434
440
  msgid "Proxy action retry count"
435
441
  msgstr ""
436
442
 
@@ -443,6 +449,9 @@ msgstr "Tâches de proxy manquantes du smart proxy"
443
449
  msgid "Proxy tasks batch size"
444
450
  msgstr ""
445
451
 
452
+ msgid "Purpose"
453
+ msgstr ""
454
+
446
455
  msgid "Raw"
447
456
  msgstr "Brut"
448
457
 
@@ -488,6 +497,9 @@ msgstr "Le verrouillage requis est déjà utilisé par d'autres tâches en cours
488
497
  msgid "Resource search_params requires resource_type and resource_id to be specified"
489
498
  msgstr "Ressource search_params a besoin que resource_type et resource_id soient spécifiés"
490
499
 
500
+ msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
501
+ msgstr ""
502
+
491
503
  msgid "Result"
492
504
  msgstr "Résultat"
493
505
 
@@ -664,6 +676,12 @@ msgstr[1] "Il y a %{compte} de tâches en pause dans le système qui nécessiten
664
676
  msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
665
677
  msgstr "Cette action supprimera toutes les logiques récurrentes annulées. Veuillez noter que cette action ne peut pas être annulée."
666
678
 
679
+ msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
680
+ msgstr ""
681
+
682
+ msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
683
+ msgstr ""
684
+
667
685
  msgid "Thu"
668
686
  msgstr "Jeu."
669
687
 
@@ -718,6 +736,9 @@ msgstr "En se concentrant sur la dernière"
718
736
  msgid "Yes"
719
737
  msgstr "Oui"
720
738
 
739
+ msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
740
+ msgstr ""
741
+
721
742
  msgid "You do not have permission"
722
743
  msgstr ""
723
744
 
@@ -759,6 +780,9 @@ msgstr "est minute (plage: 0-59)"
759
780
  msgid "is month (range: 1-12)"
760
781
  msgstr "est mois (Plage: 1-12)"
761
782
 
783
+ msgid "is not a valid format"
784
+ msgstr ""
785
+
762
786
  msgid "last"
763
787
  msgstr "dernier"
764
788
 
@@ -57,6 +57,9 @@ msgstr "タスク消去のセクションの :after の設定は非推奨にな
57
57
  msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
58
58
  msgstr "一時停止タスクは、適切に終了していないプロセスを表します。一時停止状態のタスクは、一貫性に欠ける可能性があり、解決する必要があります。"
59
59
 
60
+ msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
61
+ msgstr ""
62
+
60
63
  msgid "Action"
61
64
  msgstr "アクション"
62
65
 
@@ -69,6 +72,9 @@ msgstr "アクティブ"
69
72
  msgid "Active Filters:"
70
73
  msgstr "アクティブなフィルター:"
71
74
 
75
+ msgid "Active or disabled recurring logic with purpose %s already exists"
76
+ msgstr ""
77
+
72
78
  msgid "All %s tasks are selected. "
73
79
  msgstr "%s の全タスクを選択します。"
74
80
 
@@ -277,6 +283,9 @@ msgstr "Foreman タスク"
277
283
  msgid "Fri"
278
284
  msgstr "金"
279
285
 
286
+ msgid "I understand that this may cause harm and have working database backups of all backend services."
287
+ msgstr ""
288
+
280
289
  msgid "ID"
281
290
  msgstr "ID"
282
291
 
@@ -428,9 +437,6 @@ msgstr "ポーリングの間隔乗数"
428
437
  msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
429
438
  msgstr "デフォルトのポーリングの間隔を乗算するときに使用するポーリング乗数。この乗数を使用して、長期間にわたり実行中のタスクが頻繁にポーリングされるのを回避します。"
430
439
 
431
- msgid "Preupgrade job"
432
- msgstr ""
433
-
434
440
  msgid "Proxy action retry count"
435
441
  msgstr ""
436
442
 
@@ -443,6 +449,9 @@ msgstr "Smart Proxy のプロキシータスクが見つかりません"
443
449
  msgid "Proxy tasks batch size"
444
450
  msgstr ""
445
451
 
452
+ msgid "Purpose"
453
+ msgstr ""
454
+
446
455
  msgid "Raw"
447
456
  msgstr "ロー"
448
457
 
@@ -488,6 +497,9 @@ msgstr "必要なロックは、実行中の他のタスクにより取得済み
488
497
  msgid "Resource search_params requires resource_type and resource_id to be specified"
489
498
  msgstr "リソース search_params では resource_type と resource_id を指定する必要があります"
490
499
 
500
+ msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
501
+ msgstr ""
502
+
491
503
  msgid "Result"
492
504
  msgstr "結果"
493
505
 
@@ -664,6 +676,12 @@ msgstr[1] ""
664
676
  msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
665
677
  msgstr "このアクションは、キャンセル済みの再帰論理をすべて削除します。この操作は元に戻すことはできません。注意してください。"
666
678
 
679
+ msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
680
+ msgstr ""
681
+
682
+ msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
683
+ msgstr ""
684
+
667
685
  msgid "Thu"
668
686
  msgstr "木"
669
687
 
@@ -718,6 +736,9 @@ msgstr "フォーカスする時間: 過去 "
718
736
  msgid "Yes"
719
737
  msgstr "はい"
720
738
 
739
+ msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
740
+ msgstr ""
741
+
721
742
  msgid "You do not have permission"
722
743
  msgstr ""
723
744
 
@@ -759,6 +780,9 @@ msgstr "分 (範囲: 0〜59)"
759
780
  msgid "is month (range: 1-12)"
760
781
  msgstr "月 (範囲: 1〜12)"
761
782
 
783
+ msgid "is not a valid format"
784
+ msgstr ""
785
+
762
786
  msgid "last"
763
787
  msgstr "過去"
764
788
 
@@ -56,6 +56,9 @@ msgstr ":在任务清理部分中的设置弃用之后,使用 :after in :
56
56
  msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
57
57
  msgstr "暂停的任务代表未正确完成的进程。任何处于暂停状态的任务都可能导致潜在的不一致,需要被解决。"
58
58
 
59
+ msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
60
+ msgstr ""
61
+
59
62
  msgid "Action"
60
63
  msgstr "行动"
61
64
 
@@ -68,6 +71,9 @@ msgstr "活性"
68
71
  msgid "Active Filters:"
69
72
  msgstr "活跃的过滤器:"
70
73
 
74
+ msgid "Active or disabled recurring logic with purpose %s already exists"
75
+ msgstr ""
76
+
71
77
  msgid "All %s tasks are selected. "
72
78
  msgstr "已选择所有%s任务。 "
73
79
 
@@ -276,6 +282,9 @@ msgstr "Foreman 任务"
276
282
  msgid "Fri"
277
283
  msgstr "周五"
278
284
 
285
+ msgid "I understand that this may cause harm and have working database backups of all backend services."
286
+ msgstr ""
287
+
279
288
  msgid "ID"
280
289
  msgstr "ID"
281
290
 
@@ -427,9 +436,6 @@ msgstr "轮询间隔乘数"
427
436
  msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
428
437
  msgstr "轮询乘数,用于乘以默认轮询间隔。这可用于防止对长时间运行的任务进行过于频繁的轮询。"
429
438
 
430
- msgid "Preupgrade job"
431
- msgstr ""
432
-
433
439
  msgid "Proxy action retry count"
434
440
  msgstr ""
435
441
 
@@ -442,6 +448,9 @@ msgstr "代理任务在智能代理中丢失"
442
448
  msgid "Proxy tasks batch size"
443
449
  msgstr ""
444
450
 
451
+ msgid "Purpose"
452
+ msgstr ""
453
+
445
454
  msgid "Raw"
446
455
  msgstr "Raw"
447
456
 
@@ -487,6 +496,9 @@ msgstr "所需的锁定已由其他正在运行的任务获取。"
487
496
  msgid "Resource search_params requires resource_type and resource_id to be specified"
488
497
  msgstr "資源 search_params 需要指定 resource_type 與 resource_id"
489
498
 
499
+ msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
500
+ msgstr ""
501
+
490
502
  msgid "Result"
491
503
  msgstr "结果"
492
504
 
@@ -663,6 +675,12 @@ msgstr[1] ""
663
675
  msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
664
676
  msgstr "此操作将删除所有取消的重复逻辑。请注意,此操作无法撤消。"
665
677
 
678
+ msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
679
+ msgstr ""
680
+
681
+ msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
682
+ msgstr ""
683
+
666
684
  msgid "Thu"
667
685
  msgstr "周四"
668
686
 
@@ -717,6 +735,9 @@ msgstr "专注于最后"
717
735
  msgid "Yes"
718
736
  msgstr "是"
719
737
 
738
+ msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
739
+ msgstr ""
740
+
720
741
  msgid "You do not have permission"
721
742
  msgstr ""
722
743
 
@@ -758,6 +779,9 @@ msgstr "是分鐘(範圍:0-59)"
758
779
  msgid "is month (range: 1-12)"
759
780
  msgstr "是月份(範圍:1-12)"
760
781
 
782
+ msgid "is not a valid format"
783
+ msgstr ""
784
+
761
785
  msgid "last"
762
786
  msgstr "最近"
763
787
 
@@ -192,14 +192,13 @@ module ForemanTasks
192
192
  _(task.state).must_equal 'running'
193
193
  _(task.result).must_equal 'pending'
194
194
 
195
- callback = Support::DummyProxyAction.proxy.log[:trigger_task].first[1][:action_input][:callback]
195
+ callback = Support::DummyProxyAction.proxy.log[:trigger_task].first[1].first[1][:action_input][:callback]
196
196
  post :callback, params: { 'callback' => callback, 'data' => { 'result' => 'success' } }
197
197
  triggered.finished.wait(5)
198
198
 
199
199
  task.reload
200
200
  _(task.state).must_equal 'stopped'
201
201
  _(task.result).must_equal 'success'
202
- _(task.main_action.output['proxy_task_id']).must_equal Support::DummyProxyAction.proxy.uuid
203
202
  _(task.main_action.output['proxy_output']).must_equal('result' => 'success')
204
203
  end
205
204
  end
@@ -40,7 +40,7 @@ module Support
40
40
  def launch_tasks(operation, args = {})
41
41
  @log[:trigger_task] << [operation, args]
42
42
  @task_triggered.fulfill(true)
43
- { 'task_id' => @uuid, 'result' => 'success' }
43
+ { 'task_id' => @uuid, 'result' => 'success', 'parent' => { 'task_id' => @uuid } }
44
44
  end
45
45
  end
46
46
 
@@ -1,4 +1,5 @@
1
1
  require 'foreman_tasks_test_helper'
2
+ require 'ostruct'
2
3
 
3
4
  module ForemanTasks
4
5
  class ProxyActionTest < ActiveSupport::TestCase
@@ -22,24 +23,29 @@ module ForemanTasks
22
23
  'foo' => 'bar',
23
24
  'secrets' => secrets,
24
25
  'use_batch_triggering' => batch_triggering)
26
+ RemoteTask.any_instance.stubs(:action).returns(@action)
27
+ RemoteTask.any_instance.stubs(:task).returns(OpenStruct.new(:id => Support::DummyProxyAction.proxy.uuid))
28
+ @run_step_id = @action.run_step_id
29
+
25
30
  @action = run_action(@action)
26
31
  end
27
32
 
28
33
  describe 'first run' do
29
34
  it 'triggers the corresponding action on the proxy' do
30
35
  proxy_call = Support::DummyProxyAction.proxy.log[:trigger_task].first
31
- expected_call = ['single',
32
- { :action_class => 'Proxy::DummyAction',
33
- :action_input =>
34
- { 'foo' => 'bar',
35
- 'secrets' => secrets,
36
- 'connection_options' =>
37
- { 'retry_interval' => 15, 'retry_count' => 4,
38
- 'proxy_batch_triggering' => batch_triggering },
39
- 'use_batch_triggering' => batch_triggering,
40
- 'proxy_url' => 'proxy.example.com',
41
- 'proxy_action_name' => 'Proxy::DummyAction',
42
- 'callback' => { 'task_id' => Support::DummyProxyAction.proxy.uuid, 'step_id' => @action.run_step_id } } }]
36
+ action_input =
37
+ { :action_class => 'Proxy::DummyAction',
38
+ :action_input =>
39
+ { 'foo' => 'bar',
40
+ 'secrets' => secrets,
41
+ 'connection_options' =>
42
+ { 'retry_interval' => 15, 'retry_count' => 4,
43
+ 'proxy_batch_triggering' => batch_triggering },
44
+ 'use_batch_triggering' => batch_triggering,
45
+ 'proxy_url' => 'proxy.example.com',
46
+ 'proxy_action_name' => 'Proxy::DummyAction',
47
+ 'callback' => { 'task_id' => Support::DummyProxyAction.proxy.uuid, 'step_id' => @run_step_id } } }
48
+ expected_call = ['support', { @action.execution_plan_id => action_input }]
43
49
  _(proxy_call).must_equal(expected_call)
44
50
  end
45
51
 
@@ -73,7 +79,7 @@ module ForemanTasks
73
79
  describe 'cancel' do
74
80
  it 'sends the cancel event to the proxy when the cancel event is sent for the first time' do
75
81
  action = run_action(@action, ::Dynflow::Action::Cancellable::Cancel)
76
- _(Support::DummyProxyAction.proxy.log[:cancel_task].first).must_equal [Support::DummyProxyAction.proxy.uuid]
82
+ _(Support::DummyProxyAction.proxy.log[:cancel_task].first).must_equal [action.execution_plan_id]
77
83
  _(action.state).must_equal :suspended
78
84
  end
79
85
 
@@ -28,6 +28,32 @@ module ForemanTasks
28
28
  _(remote_task.remote_task_id).must_equal((remote_task.id + 5).to_s)
29
29
  end
30
30
  end
31
+
32
+ it 'honors the batches with multiple proxies' do
33
+ remote_task = remote_tasks.last
34
+ remote_task.proxy_url = 'something else'
35
+
36
+ results = remote_tasks.reduce({}) do |acc, cur|
37
+ acc.merge(cur.execution_plan_id.to_s => { 'task_id' => cur.id + 5, 'result' => 'success' })
38
+ end
39
+ other_results = { remote_task.execution_plan_id => results.delete(remote_task.execution_plan_id) }
40
+
41
+ fake_proxy = mock
42
+ fake_proxy.expects(:launch_tasks).returns(results)
43
+
44
+ another_fake_proxy = mock
45
+ another_fake_proxy.expects(:launch_tasks).returns(other_results)
46
+
47
+ remote_tasks.first.expects(:proxy).returns(fake_proxy)
48
+ remote_tasks.last.expects(:proxy).returns(another_fake_proxy)
49
+
50
+ RemoteTask.batch_trigger('a_operation', remote_tasks)
51
+ remote_tasks.each do |remote_task|
52
+ remote_task.reload
53
+ _(remote_task.state).must_equal 'triggered'
54
+ _(remote_task.remote_task_id).must_equal((remote_task.id + 5).to_s)
55
+ end
56
+ end
31
57
  end
32
58
  end
33
59
  end
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
 
5
- import { Icon, Button, OverlayTrigger, Tooltip } from 'patternfly-react';
5
+ import { Button, Tooltip, TooltipPosition } from '@patternfly/react-core';
6
+ import { InfoCircleIcon } from '@patternfly/react-icons';
6
7
  import { translate as __ } from 'foremanReact/common/I18n';
7
8
  import {
8
9
  TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
@@ -10,30 +11,26 @@ import {
10
11
  } from '../../../../TasksDashboardConstants';
11
12
  import { queryPropType } from '../../../../TasksDashboardPropTypes';
12
13
 
13
- const tooltip = (
14
- <Tooltip id="stopped-tooltip">
15
- {__('Other includes all stopped tasks that are cancelled or pending')}
16
- </Tooltip>
17
- );
18
-
19
14
  export const OtherInfo = ({ updateQuery, otherCount, query }) => {
20
15
  const { OTHER } = TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS;
21
16
  const { STOPPED } = TASKS_DASHBOARD_AVAILABLE_QUERY_STATES;
22
17
  const active = query.state === STOPPED && query.result === OTHER;
23
18
  return (
24
19
  <span className={classNames(active && 'other-active')}>
25
- <OverlayTrigger
26
- overlay={tooltip}
27
- trigger={['hover', 'focus']}
28
- placement="bottom"
20
+ <Tooltip
21
+ id="stopped-tooltip"
22
+ content={__(
23
+ 'Other includes all stopped tasks that are cancelled or pending'
24
+ )}
25
+ position={TooltipPosition.bottom}
29
26
  >
30
27
  <span>
31
- <Icon type="pf" name="info" />
28
+ <InfoCircleIcon className="pficon" />
32
29
  <span>{__('Other:')} </span>
33
30
  </span>
34
- </OverlayTrigger>
31
+ </Tooltip>
35
32
  <Button
36
- bsStyle="link"
33
+ variant="link"
37
34
  onClick={() =>
38
35
  updateQuery({
39
36
  state: STOPPED,
@@ -4,43 +4,27 @@ exports[`OtherInfo render 1`] = `
4
4
  <span
5
5
  className=""
6
6
  >
7
- <OverlayTrigger
8
- defaultOverlayShown={false}
9
- overlay={
10
- <Tooltip
11
- bsClass="tooltip"
12
- id="stopped-tooltip"
13
- placement="right"
14
- >
15
- Other includes all stopped tasks that are cancelled or pending
16
- </Tooltip>
17
- }
18
- placement="bottom"
19
- trigger={
20
- Array [
21
- "hover",
22
- "focus",
23
- ]
24
- }
7
+ <Tooltip
8
+ content="Other includes all stopped tasks that are cancelled or pending"
9
+ id="stopped-tooltip"
10
+ position="bottom"
25
11
  >
26
12
  <span>
27
- <Icon
28
- name="info"
29
- type="pf"
13
+ <InfoCircleIcon
14
+ className="pficon"
15
+ color="currentColor"
16
+ noVerticalAlign={false}
17
+ size="sm"
30
18
  />
31
19
  <span>
32
20
  Other:
33
21
 
34
22
  </span>
35
23
  </span>
36
- </OverlayTrigger>
24
+ </Tooltip>
37
25
  <Button
38
- active={false}
39
- block={false}
40
- bsClass="btn"
41
- bsStyle="link"
42
- disabled={false}
43
26
  onClick={[Function]}
27
+ variant="link"
44
28
  >
45
29
  7
46
30
  </Button>
@@ -4,7 +4,7 @@ import { Table } from 'foremanReact/components/common/table';
4
4
  import { STATUS } from 'foremanReact/constants';
5
5
  import MessageBox from 'foremanReact/components/common/MessageBox';
6
6
  import { translate as __ } from 'foremanReact/common/I18n';
7
- import Pagination from 'foremanReact/components/Pagination/PaginationWrapper';
7
+ import Pagination from 'foremanReact/components/Pagination';
8
8
  import { getURIQuery } from 'foremanReact/common/helpers';
9
9
  import createTasksTableSchema from './TasksTableSchema';
10
10
  import { updateURlQuery } from './TasksTableHelpers';
@@ -18,7 +18,6 @@ const TasksTable = ({
18
18
  results,
19
19
  history,
20
20
  itemCount,
21
- pagination,
22
21
  selectedRows,
23
22
  selectPage,
24
23
  unselectAllRows,
@@ -82,16 +81,6 @@ const TasksTable = ({
82
81
  return <span>{__('No Tasks')}</span>;
83
82
  }
84
83
 
85
- const changeTablePage = ({ page, perPage }) => {
86
- updateURlQuery(
87
- {
88
- page,
89
- per_page: perPage,
90
- },
91
- history
92
- );
93
- };
94
-
95
84
  const setSortHistory = (by, order) => {
96
85
  updateURlQuery({ sort_by: by, sort_order: order }, history);
97
86
  };
@@ -133,14 +122,7 @@ const TasksTable = ({
133
122
  )}
134
123
  rows={results}
135
124
  />
136
- <Pagination
137
- className="tasks-pagination"
138
- viewType="table"
139
- itemCount={itemCount}
140
- pagination={pagination}
141
- onChange={changeTablePage}
142
- dropdownButtonId="tasks-table-dropdown"
143
- />
125
+ <Pagination itemCount={itemCount} />
144
126
  </div>
145
127
  );
146
128
  };
@@ -151,10 +133,6 @@ TasksTable.propTypes = {
151
133
  status: PropTypes.oneOf(Object.keys(STATUS)),
152
134
  error: PropTypes.instanceOf(Error),
153
135
  itemCount: PropTypes.number.isRequired,
154
- pagination: PropTypes.shape({
155
- page: PropTypes.number,
156
- perPage: PropTypes.number,
157
- }),
158
136
  history: PropTypes.object.isRequired,
159
137
  openClickedModal: PropTypes.func.isRequired,
160
138
  selectedRows: PropTypes.array,
@@ -172,10 +150,6 @@ TasksTable.propTypes = {
172
150
  TasksTable.defaultProps = {
173
151
  status: STATUS.PENDING,
174
152
  error: null,
175
- pagination: {
176
- page: 1,
177
- perPage: 20,
178
- },
179
153
  selectedRows: [],
180
154
  allRowsSelected: false,
181
155
  permissions: {
@@ -99,10 +99,10 @@ const TasksTablePage = ({
99
99
  <React.Fragment>
100
100
  {props.permissions.edit &&
101
101
  showSelectAll &&
102
- props.itemCount >= props.pagination.perPage && (
102
+ props.itemCount >= props.perPage && (
103
103
  <SelectAllAlert
104
104
  itemCount={props.itemCount}
105
- perPage={props.pagination.perPage}
105
+ perPage={props.perPage}
106
106
  selectAllRows={selectAllRows}
107
107
  unselectAllRows={props.unselectAllRows}
108
108
  allRowsSelected={props.allRowsSelected}
@@ -118,9 +118,8 @@ const TasksTablePage = ({
118
118
  TasksTablePage.propTypes = {
119
119
  allRowsSelected: PropTypes.bool,
120
120
  itemCount: PropTypes.number.isRequired,
121
- pagination: PropTypes.shape({
122
- perPage: PropTypes.number,
123
- }),
121
+ perPage: PropTypes.number,
122
+
124
123
  selectAllRows: PropTypes.func.isRequired,
125
124
  results: PropTypes.array.isRequired,
126
125
  getTableItems: PropTypes.func.isRequired,
@@ -142,10 +141,7 @@ TasksTablePage.propTypes = {
142
141
  };
143
142
 
144
143
  TasksTablePage.defaultProps = {
145
- pagination: {
146
- page: 1,
147
- perPage: 20,
148
- },
144
+ perPage: 20,
149
145
  allRowsSelected: false,
150
146
  actionName: '',
151
147
  status: STATUS.PENDING,
@@ -21,7 +21,6 @@ export const TasksTableQueryReducer = (state = initialState, action) => {
21
21
  const { type, payload, response } = action;
22
22
  const {
23
23
  subtotal,
24
- page,
25
24
  per_page: perPageString,
26
25
  action_name: actionName,
27
26
  can_edit: canEdit,
@@ -34,10 +33,7 @@ export const TasksTableQueryReducer = (state = initialState, action) => {
34
33
  return Immutable.merge(state, {
35
34
  itemCount: subtotal,
36
35
  actionName,
37
- pagination: {
38
- page: Number(page),
39
- perPage: Number(perPageString),
40
- },
36
+ perPage: Number(perPageString),
41
37
  selectedRows: [],
42
38
  permissions: {
43
39
  edit: canEdit,
@@ -12,8 +12,8 @@ export const selectTasksTableContent = state =>
12
12
  export const selectTasksTableQuery = state =>
13
13
  selectTasksTable(state).tasksTableQuery || {};
14
14
 
15
- export const selectPagitation = state =>
16
- selectTasksTableQuery(state).pagination || {};
15
+ export const selectPerPage = state =>
16
+ selectTasksTableQuery(state).perPage || 20;
17
17
 
18
18
  export const selectItemCount = state =>
19
19
  selectTasksTableQuery(state).itemCount || 0;
@@ -11,10 +11,7 @@ export const minProps = {
11
11
  unselectRow: jest.fn(),
12
12
  reloadPage: jest.fn(),
13
13
  selectedRows: [],
14
- pagination: {
15
- page: 1,
16
- perPage: 10,
17
- },
14
+ perPage: 10,
18
15
  history: { location: { search: '' } },
19
16
  results: ['a', 'b'],
20
17
  sort: {
@@ -23,13 +23,8 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
23
23
  openClickedModal={[MockFunction]}
24
24
  openModal={[MockFunction]}
25
25
  openModalAction={[MockFunction]}
26
- pagination={
27
- Object {
28
- "page": 1,
29
- "perPage": 10,
30
- }
31
- }
32
26
  parentTaskID="some-id"
27
+ perPage={10}
33
28
  reloadPage={[MockFunction]}
34
29
  results={
35
30
  Array [