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
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
-
3
- import { API } from 'foremanReact/redux/API';
4
- import { IntegrationTestHelper } from '@theforeman/test';
5
-
6
- import TaskDetails, { reducers } from '../index';
7
- import { selectForemanTasks } from '../../../ForemanTasksSelectors';
8
- import { minProps } from './TaskDetails.fixtures';
9
-
10
- jest.mock('../../../ForemanTasksSelectors');
11
- jest.mock('foremanReact/redux/API');
12
- selectForemanTasks.mockImplementation(state => state);
13
- describe('TaskDetails integration test', () => {
14
- beforeEach(() => {
15
- jest.useFakeTimers();
16
- const expectedIntervalId = 1;
17
- jest.useFakeTimers();
18
- setInterval.mockImplementation(() => expectedIntervalId);
19
- delete window.location;
20
- window.location = new URL(
21
- 'https://foreman.com/foreman_tasks/tasks/a15dd820-32f1-4ced-9ab7-c0fab8234c47/'
22
- );
23
- });
24
- it('should flow', async () => {
25
- window.location.reload = jest.fn();
26
-
27
- API.get.mockImplementationOnce();
28
- const integrationTestHelper = new IntegrationTestHelper(reducers);
29
-
30
- const component = integrationTestHelper.mount(
31
- <TaskDetails {...minProps} id="test" />
32
- );
33
- integrationTestHelper.takeStoreSnapshot('initial state');
34
-
35
- const reloadButton = component.find('.reload-button').at(0);
36
- reloadButton.simulate('click');
37
- await IntegrationTestHelper.flushAllPromises();
38
-
39
- integrationTestHelper.takeActionsSnapshot(
40
- 'task details reload start with error'
41
- );
42
-
43
- reloadButton.simulate('click');
44
- await IntegrationTestHelper.flushAllPromises();
45
- jest.advanceTimersByTime(1);
46
- integrationTestHelper.takeActionsSnapshot('task details reload stop');
47
- jest.useRealTimers();
48
- });
49
-
50
- it('should change the data after reload', async () => {
51
- API.get.mockImplementationOnce(() => ({
52
- data: { label: 'new-label' },
53
- }));
54
- const integrationTestHelper = new IntegrationTestHelper(reducers);
55
-
56
- const component = integrationTestHelper.mount(
57
- <TaskDetails {...minProps} id="test" />
58
- );
59
-
60
- const reloadButton = component.find('.reload-button').at(0);
61
- reloadButton.simulate('click');
62
-
63
- await IntegrationTestHelper.flushAllPromises();
64
- integrationTestHelper.takeActionsSnapshot(
65
- 'task details reload start without error'
66
- );
67
- integrationTestHelper.takeStoreAndLastActionSnapshot(
68
- 'task details data should change'
69
- );
70
- jest.useRealTimers();
71
- });
72
- });
@@ -1,7 +0,0 @@
1
- export const API = {
2
- get: jest.fn(),
3
- put: jest.fn(),
4
- post: jest.fn(),
5
- delete: jest.fn(),
6
- patch: jest.fn(),
7
- };