foreman-tasks 1.0.0 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +2 -22
  3. data/.rubocop.yml +12 -12
  4. data/.rubocop_todo.yml +34 -116
  5. data/app/controllers/foreman_tasks/api/recurring_logics_controller.rb +20 -1
  6. data/app/controllers/foreman_tasks/api/tasks_controller.rb +38 -11
  7. data/app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb +1 -1
  8. data/app/controllers/foreman_tasks/recurring_logics_controller.rb +19 -0
  9. data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +1 -3
  10. data/app/lib/actions/helpers/humanizer.rb +1 -3
  11. data/app/lib/actions/proxy_action.rb +33 -12
  12. data/app/lib/foreman_tasks/concerns/polling_action_extensions.rb +12 -0
  13. data/app/models/foreman_tasks/concerns/action_triggering.rb +1 -1
  14. data/app/models/foreman_tasks/recurring_logic.rb +1 -0
  15. data/app/models/foreman_tasks/remote_task.rb +1 -0
  16. data/app/models/foreman_tasks/task.rb +4 -0
  17. data/app/models/foreman_tasks/task/dynflow_task.rb +1 -1
  18. data/app/models/foreman_tasks/task/search.rb +11 -1
  19. data/app/models/setting/foreman_tasks.rb +6 -1
  20. data/app/services/foreman_tasks/troubleshooting_help_generator.rb +0 -4
  21. data/app/services/ui_notifications/tasks/task_bulk_cancel.rb +36 -0
  22. data/app/services/ui_notifications/tasks/task_bulk_resume.rb +38 -0
  23. data/app/views/foreman_tasks/api/recurring_logics/base.json.rabl +2 -1
  24. data/app/views/foreman_tasks/api/tasks/details.json.rabl +1 -0
  25. data/app/views/foreman_tasks/api/tasks/show.json.rabl +1 -1
  26. data/app/views/foreman_tasks/recurring_logics/index.html.erb +30 -0
  27. data/app/views/foreman_tasks/tasks/show.html.erb +3 -0
  28. data/{.babelrc.js → babel.config.js} +0 -0
  29. data/config/routes.rb +7 -0
  30. data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +9 -0
  31. data/db/seeds.d/30-notification_blueprints.rb +14 -0
  32. data/foreman-tasks.gemspec +5 -6
  33. data/gemfile.d/foreman-tasks.rb +1 -0
  34. data/lib/foreman_tasks/dynflow/console_authorizer.rb +2 -2
  35. data/lib/foreman_tasks/engine.rb +17 -14
  36. data/lib/foreman_tasks/tasks/cleanup.rake +3 -3
  37. data/lib/foreman_tasks/tasks/dynflow.rake +6 -0
  38. data/lib/foreman_tasks/tasks/export_tasks.rake +3 -3
  39. data/lib/foreman_tasks/test_extensions.rb +1 -1
  40. data/lib/foreman_tasks/version.rb +1 -1
  41. data/locale/action_names.rb +1 -1
  42. data/package.json +18 -71
  43. data/script/rails +2 -2
  44. data/script/travis_run_js_tests.sh +2 -2
  45. data/test/controllers/api/tasks_controller_test.rb +9 -0
  46. data/test/factories/task_factory.rb +34 -2
  47. data/test/foreman_tasks_test_helper.rb +4 -0
  48. data/test/lib/concerns/polling_action_extensions_test.rb +34 -0
  49. data/test/unit/actions/action_with_sub_plans_test.rb +1 -1
  50. data/test/unit/task_test.rb +160 -74
  51. data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +4 -0
  52. data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +3 -12
  53. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +1 -1
  54. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +1 -1
  55. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +1 -1
  56. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
  57. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +2 -1
  58. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +1 -1
  59. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +3 -1
  60. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +3 -9
  61. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +6 -2
  62. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +4 -1
  63. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +1 -1
  64. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +1 -1
  65. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +1 -1
  66. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +1 -0
  67. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +1 -1
  68. data/webpack/ForemanTasks/Components/TaskDetails/index.js +2 -0
  69. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +44 -40
  70. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +1 -1
  71. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +45 -40
  72. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +1 -1
  73. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +27 -22
  74. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +1 -1
  75. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +61 -56
  76. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -1
  77. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +40 -35
  78. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +1 -1
  79. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +21 -20
  80. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +1 -1
  81. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +40 -39
  82. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +1 -1
  83. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +16 -17
  84. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +1 -2
  85. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.mdx +57 -0
  86. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +1 -1
  87. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +36 -18
  88. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +1 -1
  89. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +5 -0
  90. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +3 -2
  91. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
  92. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +1 -1
  93. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +1 -1
  94. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +1 -1
  95. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +53 -0
  96. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +56 -0
  97. data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +52 -0
  98. data/webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js +43 -0
  99. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -1
  100. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +26 -0
  101. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +24 -0
  102. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +26 -0
  103. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +29 -0
  104. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +1 -1
  105. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +1 -1
  106. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +65 -0
  107. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +30 -0
  108. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +63 -0
  109. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +75 -0
  110. data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +4 -1
  111. data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +164 -0
  112. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +46 -22
  113. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActionHelpers.js +52 -0
  114. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +88 -87
  115. data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +23 -9
  116. data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +4 -3
  117. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +128 -31
  118. data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +26 -9
  119. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +24 -16
  120. data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +1 -1
  121. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +112 -0
  122. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +1 -1
  123. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +12 -5
  124. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +1 -1
  125. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActionHelpers.test.js +46 -0
  126. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +28 -52
  127. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +17 -1
  128. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +10 -2
  129. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +28 -8
  130. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +15 -5
  131. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +229 -0
  132. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +14 -5
  133. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +56 -85
  134. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +158 -32
  135. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +43 -16
  136. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +1 -1
  137. data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +2 -2
  138. data/webpack/ForemanTasks/Components/TasksTable/index.js +11 -4
  139. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +4 -4
  140. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +1 -1
  141. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +1 -2
  142. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +2 -2
  143. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +3 -3
  144. data/webpack/ForemanTasks/Components/common/ToastTypesConstants.js +11 -0
  145. data/webpack/ForemanTasks/ForemanTasks.test.js +1 -1
  146. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +1 -1
  147. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -3
  148. data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +1 -1
  149. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  150. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +10 -0
  151. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +4 -0
  152. metadata +55 -24
  153. data/.storybook/addons.js +0 -2
  154. data/.storybook/config.js +0 -7
  155. data/.storybook/webpack.config.js +0 -84
  156. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +0 -23
  157. data/webpack/ForemanTasks/Components/TasksTable/Components/ActionConfirmation.js +0 -49
  158. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js +0 -51
  159. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionConfirmation.test.js +0 -18
  160. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelResumeConfirm.test.js +0 -28
  161. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionConfirmation.test.js.snap +0 -89
  162. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelResumeConfirm.test.js.snap +0 -37
  163. data/webpack/stories/index.js +0 -10
  164. data/webpack/stories/index.scss +0 -7
  165. data/webpack/test_setup.js +0 -7
@@ -1,4 +1,4 @@
1
- import { updateURlQuery, getDuration } from '../TasksTableHelpers';
1
+ import { updateURlQuery, getDuration, getCSVurl } from '../TasksTableHelpers';
2
2
 
3
3
  describe('updateURlQuery', () => {
4
4
  it('should use url with new query', () => {
@@ -26,3 +26,19 @@ describe('updateURlQuery', () => {
26
26
  expect(duration.tooltip).toEqual('Task was canceled');
27
27
  });
28
28
  });
29
+
30
+ describe('getCSVurl', () => {
31
+ it('should return currect url for tasks with search', () => {
32
+ const url = '/foreman_tasks/tasks';
33
+ const query = { state: 'stopped' };
34
+ expect(getCSVurl(url, query)).toEqual(
35
+ '/foreman_tasks/tasks.csv?state=stopped'
36
+ );
37
+ });
38
+ it('should return currect url for subtasks', () => {
39
+ const url = '/foreman_tasks/tasks/some-id/sub_tasks';
40
+ expect(getCSVurl(url, {})).toEqual(
41
+ '/foreman_tasks/tasks/some-id/sub_tasks.csv'
42
+ );
43
+ });
44
+ });
@@ -1,12 +1,20 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
  import TasksTablePage from '../TasksTablePage';
3
3
  import { minProps } from './TasksTable.fixtures';
4
4
 
5
+ jest.mock('foremanReact/common/helpers', () => ({
6
+ getURIQuery: () => ({ state: 'stopped' }),
7
+ }));
8
+
9
+ const history = {
10
+ location: { pathname: '/foreman_tasks/tasks', search: '?action="some-name"' },
11
+ };
5
12
  const fixtures = {
6
- 'render with minimal props': minProps,
13
+ 'render with minimal props': { ...minProps, history },
7
14
 
8
15
  'render with Breadcrubs': {
9
16
  ...minProps,
17
+ history,
10
18
  getBreadcrumbs: () => ({
11
19
  breadcrumbItems: [
12
20
  { caption: 'Tasks', url: `/foreman_tasks/tasks` },
@@ -1,4 +1,5 @@
1
- import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import Immutable from 'seamless-immutable';
2
+ import { testReducerSnapshotWithFixtures } from '@theforeman/test';
2
3
  import {
3
4
  TASKS_TABLE_ID,
4
5
  TASKS_TABLE_SET_SORT,
@@ -6,8 +7,9 @@ import {
6
7
  SELECT_ROWS,
7
8
  UNSELECT_ROWS,
8
9
  UNSELECT_ALL_ROWS,
9
- TASKS_TABLE_SELECTED_MODAL,
10
- RESUME,
10
+ UPDATE_CLICKED,
11
+ SELECT_ALL_ROWS,
12
+ OPEN_SELECT_ALL,
11
13
  } from '../TasksTableConstants';
12
14
  import reducer from '../TasksTableReducer';
13
15
 
@@ -16,7 +18,7 @@ const fixtures = {
16
18
  'should handle TASKS_TABLE_SUCCESS': {
17
19
  action: {
18
20
  type: `${TASKS_TABLE_ID}_SUCCESS`,
19
- payload: {
21
+ response: {
20
22
  subtotal: 120,
21
23
  page: 3,
22
24
  per_page: 12,
@@ -45,7 +47,7 @@ const fixtures = {
45
47
  'should handle UNSELECT_ROWS': {
46
48
  action: {
47
49
  type: UNSELECT_ROWS,
48
- payload: 4,
50
+ payload: [{ id: 4 }],
49
51
  },
50
52
  },
51
53
  'should handle UNSELECT_ALL_ROWS': {
@@ -53,10 +55,28 @@ const fixtures = {
53
55
  type: UNSELECT_ALL_ROWS,
54
56
  },
55
57
  },
56
- 'should handle TASKS_TABLE_SELECTED_MODAL': {
58
+ 'should handle UPDATE_CLICKED': {
57
59
  action: {
58
- type: TASKS_TABLE_SELECTED_MODAL,
59
- payload: RESUME,
60
+ type: UPDATE_CLICKED,
61
+ payload: { clicked: 'task' },
62
+ },
63
+ },
64
+ 'should handle SELECT_ALL_ROWS': {
65
+ action: {
66
+ type: SELECT_ALL_ROWS,
67
+ payload: { clicked: 'task' },
68
+ },
69
+ },
70
+ 'should handle OPEN_SELECT_ALL': {
71
+ action: {
72
+ type: OPEN_SELECT_ALL,
73
+ },
74
+ },
75
+ 'should handle UNSELECT_ROWS with all rows selected': {
76
+ state: Immutable({ tasksTableQuery: { allRowsSelected: true } }),
77
+ action: {
78
+ type: UNSELECT_ROWS,
79
+ payload: { id: [4], results: [{ id: 3 }, { id: 4 }, { id: 5 }] },
60
80
  },
61
81
  },
62
82
  };
@@ -2,11 +2,14 @@
2
2
 
3
3
  exports[`SubTasksPage rendering render with minimal props 1`] = `
4
4
  <Connect(TasksTablePage)
5
- actionSelected={[MockFunction]}
5
+ bulkCancelById={[MockFunction]}
6
+ bulkCancelBySearch={[MockFunction]}
7
+ bulkResumeById={[MockFunction]}
8
+ bulkResumeBySearch={[MockFunction]}
6
9
  cancelTask={[MockFunction]}
10
+ createHeader={[Function]}
7
11
  getBreadcrumbs={[MockFunction]}
8
12
  getTableItems={[MockFunction]}
9
- hideSelcetedModal={[MockFunction]}
10
13
  history={
11
14
  Object {
12
15
  "location": Object {
@@ -22,6 +25,15 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
22
25
  },
23
26
  }
24
27
  }
28
+ modalProps={
29
+ Object {
30
+ "cancelModal": Object {},
31
+ "cancelSelectedModal": Object {},
32
+ "resumeModal": Object {},
33
+ "resumeSelectedModal": Object {},
34
+ }
35
+ }
36
+ openClickedModal={[MockFunction]}
25
37
  pagination={
26
38
  Object {
27
39
  "page": 1,
@@ -37,17 +49,15 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
37
49
  }
38
50
  resumeTask={[MockFunction]}
39
51
  selectAllRows={[MockFunction]}
52
+ selectPage={[MockFunction]}
40
53
  selectRow={[MockFunction]}
41
54
  selectedRows={Array []}
42
- showCancelSelcetedModal={[MockFunction]}
43
- showResumeSelcetedModal={[MockFunction]}
44
55
  sort={
45
56
  Object {
46
57
  "by": "q",
47
58
  "order": "w",
48
59
  }
49
60
  }
50
- status="RESOLVED"
51
61
  unselectAllRows={[MockFunction]}
52
62
  unselectRow={[MockFunction]}
53
63
  />
@@ -0,0 +1,229 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`TasksTable bulk actions handles bulkCancelById requests 1`] = `
4
+ Array [
5
+ Array [
6
+ Object {
7
+ "type": "TASKS_CANCEL_REQUEST",
8
+ },
9
+ ],
10
+ Array [
11
+ Object {
12
+ "type": "TASKS_CANCEL_SUCCESS",
13
+ },
14
+ ],
15
+ Array [
16
+ Object {
17
+ "payload": Object {
18
+ "message": Object {
19
+ "message": "I am cancelled Task execution was cancelled",
20
+ "type": "success",
21
+ },
22
+ },
23
+ "type": "TOASTS_ADD",
24
+ },
25
+ ],
26
+ Array [
27
+ "TASKS_TABLE",
28
+ ],
29
+ Array [
30
+ [Function],
31
+ ],
32
+ ]
33
+ `;
34
+
35
+ exports[`TasksTable bulk actions handles bulkCancelById requests that are not cancellable 1`] = `
36
+ Array [
37
+ Array [
38
+ Object {
39
+ "payload": Object {
40
+ "message": Object {
41
+ "message": "Not all the selected tasks can be cancelled",
42
+ "type": "warning",
43
+ },
44
+ },
45
+ "type": "TOASTS_ADD",
46
+ },
47
+ ],
48
+ ]
49
+ `;
50
+
51
+ exports[`TasksTable bulk actions handles bulkCancelBySearch requests 1`] = `
52
+ Array [
53
+ Array [
54
+ Object {
55
+ "type": "TASKS_CANCEL_REQUEST",
56
+ },
57
+ ],
58
+ Array [
59
+ Object {
60
+ "payload": Object {
61
+ "message": Object {
62
+ "message": "Canceling selected tasks, this might take a while",
63
+ "type": "info",
64
+ },
65
+ },
66
+ "type": "TOASTS_ADD",
67
+ },
68
+ ],
69
+ ]
70
+ `;
71
+
72
+ exports[`TasksTable bulk actions handles bulkResumeById requests that are not resumable 1`] = `
73
+ Array [
74
+ Array [
75
+ Object {
76
+ "payload": Object {
77
+ "message": Object {
78
+ "message": "Not all the selected tasks can be resumed",
79
+ "type": "warning",
80
+ },
81
+ },
82
+ "type": "TOASTS_ADD",
83
+ },
84
+ ],
85
+ ]
86
+ `;
87
+
88
+ exports[`TasksTable bulk actions handles bulkResumeById requests that fail 1`] = `
89
+ Array [
90
+ Array [
91
+ Object {
92
+ "type": "TASKS_RESUME_REQUEST",
93
+ },
94
+ ],
95
+ Array [
96
+ Object {
97
+ "error": [Error: Network Error],
98
+ "type": "TASKS_RESUME_FAILURE",
99
+ },
100
+ ],
101
+ Array [
102
+ Object {
103
+ "payload": Object {
104
+ "message": Object {
105
+ "message": "Cannot resume tasks at the moment Error: Network Error",
106
+ "type": "error",
107
+ },
108
+ },
109
+ "type": "TOASTS_ADD",
110
+ },
111
+ ],
112
+ ]
113
+ `;
114
+
115
+ exports[`TasksTable bulk actions handles bulkResumeBySearch requests 1`] = `
116
+ Array [
117
+ Array [
118
+ Object {
119
+ "type": "TASKS_RESUME_REQUEST",
120
+ },
121
+ ],
122
+ Array [
123
+ Object {
124
+ "payload": Object {
125
+ "message": Object {
126
+ "message": "Resuming selected tasks, this might take a while",
127
+ "type": "info",
128
+ },
129
+ },
130
+ "type": "TOASTS_ADD",
131
+ },
132
+ ],
133
+ ]
134
+ `;
135
+
136
+ exports[`TasksTable bulk actions handles resumable bulkResumeById requests 1`] = `
137
+ Array [
138
+ Array [
139
+ Object {
140
+ "type": "TASKS_RESUME_REQUEST",
141
+ },
142
+ ],
143
+ Array [
144
+ Object {
145
+ "type": "TASKS_RESUME_SUCCESS",
146
+ },
147
+ ],
148
+ Array [
149
+ Object {
150
+ "payload": Object {
151
+ "message": Object {
152
+ "message": "I am resumed Task execution was resumed",
153
+ "type": "success",
154
+ },
155
+ },
156
+ "type": "TOASTS_ADD",
157
+ },
158
+ ],
159
+ Array [
160
+ Object {
161
+ "payload": Object {
162
+ "message": Object {
163
+ "message": "I am failed Task execution could not be resumed",
164
+ "type": "error",
165
+ },
166
+ },
167
+ "type": "TOASTS_ADD",
168
+ },
169
+ ],
170
+ Array [
171
+ "TASKS_TABLE",
172
+ ],
173
+ Array [
174
+ [Function],
175
+ ],
176
+ ]
177
+ `;
178
+
179
+ exports[`TasksTable bulk actions handles skipped bulkCancelById requests 1`] = `
180
+ Array [
181
+ Array [
182
+ Object {
183
+ "type": "TASKS_CANCEL_REQUEST",
184
+ },
185
+ ],
186
+ Array [
187
+ Object {
188
+ "type": "TASKS_CANCEL_SUCCESS",
189
+ },
190
+ ],
191
+ Array [
192
+ Object {
193
+ "payload": Object {
194
+ "message": Object {
195
+ "message": "I am skipped Task execution task has to be cancellable",
196
+ "type": "warning",
197
+ },
198
+ },
199
+ "type": "TOASTS_ADD",
200
+ },
201
+ ],
202
+ ]
203
+ `;
204
+
205
+ exports[`TasksTable bulk actions handles skipped bulkResumeById requests 1`] = `
206
+ Array [
207
+ Array [
208
+ Object {
209
+ "type": "TASKS_RESUME_REQUEST",
210
+ },
211
+ ],
212
+ Array [
213
+ Object {
214
+ "type": "TASKS_RESUME_SUCCESS",
215
+ },
216
+ ],
217
+ Array [
218
+ Object {
219
+ "payload": Object {
220
+ "message": Object {
221
+ "message": "I am skipped Task execution task has to be resumable",
222
+ "type": "warning",
223
+ },
224
+ },
225
+ "type": "TOASTS_ADD",
226
+ },
227
+ ],
228
+ ]
229
+ `;
@@ -2,11 +2,13 @@
2
2
 
3
3
  exports[`TasksIndexPage rendering render with minimal props 1`] = `
4
4
  <Connect(TasksTablePage)
5
- actionSelected={[MockFunction]}
5
+ bulkCancelById={[MockFunction]}
6
+ bulkCancelBySearch={[MockFunction]}
7
+ bulkResumeById={[MockFunction]}
8
+ bulkResumeBySearch={[MockFunction]}
6
9
  cancelTask={[MockFunction]}
7
10
  getBreadcrumbs={[MockFunction]}
8
11
  getTableItems={[MockFunction]}
9
- hideSelcetedModal={[MockFunction]}
10
12
  history={
11
13
  Object {
12
14
  "location": Object {
@@ -15,6 +17,15 @@ exports[`TasksIndexPage rendering render with minimal props 1`] = `
15
17
  }
16
18
  }
17
19
  itemCount={2}
20
+ modalProps={
21
+ Object {
22
+ "cancelModal": Object {},
23
+ "cancelSelectedModal": Object {},
24
+ "resumeModal": Object {},
25
+ "resumeSelectedModal": Object {},
26
+ }
27
+ }
28
+ openClickedModal={[MockFunction]}
18
29
  pagination={
19
30
  Object {
20
31
  "page": 1,
@@ -29,17 +40,15 @@ exports[`TasksIndexPage rendering render with minimal props 1`] = `
29
40
  }
30
41
  resumeTask={[MockFunction]}
31
42
  selectAllRows={[MockFunction]}
43
+ selectPage={[MockFunction]}
32
44
  selectRow={[MockFunction]}
33
45
  selectedRows={Array []}
34
- showCancelSelcetedModal={[MockFunction]}
35
- showResumeSelcetedModal={[MockFunction]}
36
46
  sort={
37
47
  Object {
38
48
  "by": "q",
39
49
  "order": "w",
40
50
  }
41
51
  }
42
- status="RESOLVED"
43
52
  unselectAllRows={[MockFunction]}
44
53
  unselectRow={[MockFunction]}
45
54
  />
@@ -1,26 +1,34 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`TasksTable actions should actionSelected CANCEL cancelleble 1`] = `
3
+ exports[`TasksTable actions should cancelTaskRequest and fail 1`] = `
4
4
  Array [
5
5
  Array [
6
- [Function],
6
+ Object {
7
+ "payload": Object {
8
+ "message": Object {
9
+ "message": "Trying to cancel some-name task",
10
+ "type": "info",
11
+ },
12
+ },
13
+ "type": "TOASTS_ADD",
14
+ },
7
15
  ],
8
16
  Array [
9
- "TASKS_TABLE",
17
+ Object {
18
+ "type": "TASKS_CANCEL_REQUEST",
19
+ },
10
20
  ],
11
21
  Array [
12
- [Function],
22
+ Object {
23
+ "payload": undefined,
24
+ "type": "TASKS_CANCEL_FAILURE",
25
+ },
13
26
  ],
14
- ]
15
- `;
16
-
17
- exports[`TasksTable actions should actionSelected CANCEL not cancelleble 1`] = `
18
- Array [
19
27
  Array [
20
28
  Object {
21
29
  "payload": Object {
22
30
  "message": Object {
23
- "message": "Not all the selected tasks can be canceled",
31
+ "message": "some-name Task execution task has to be cancellable",
24
32
  "type": "warning",
25
33
  },
26
34
  },
@@ -30,69 +38,35 @@ Array [
30
38
  ]
31
39
  `;
32
40
 
33
- exports[`TasksTable actions should actionSelected RESUME not resumable 1`] = `
41
+ exports[`TasksTable actions should cancelTaskRequest and succeed 1`] = `
34
42
  Array [
35
43
  Array [
36
44
  Object {
37
45
  "payload": Object {
38
46
  "message": Object {
39
- "message": "Not all the selected tasks can be resumed",
40
- "type": "warning",
47
+ "message": "Trying to cancel some-name task",
48
+ "type": "info",
41
49
  },
42
50
  },
43
51
  "type": "TOASTS_ADD",
44
52
  },
45
53
  ],
46
- ]
47
- `;
48
-
49
- exports[`TasksTable actions should actionSelected RESUME resumable 1`] = `
50
- Array [
51
- Array [
52
- [Function],
53
- ],
54
- Array [
55
- "TASKS_TABLE",
56
- ],
57
- Array [
58
- [Function],
59
- ],
60
- ]
61
- `;
62
-
63
- exports[`TasksTable actions should cancelTask 1`] = `
64
- Array [
65
54
  Array [
66
- [Function],
67
- ],
68
- Array [
69
- "TASKS_TABLE",
55
+ Object {
56
+ "type": "TASKS_CANCEL_REQUEST",
57
+ },
70
58
  ],
71
- Array [
72
- [Function],
73
- ],
74
- ]
75
- `;
76
-
77
- exports[`TasksTable actions should cancelTaskRequest and fail 1`] = `
78
- Array [
79
59
  Array [
80
60
  Object {
81
- "payload": Object {
82
- "message": Object {
83
- "message": "Trying to cancel \\"some-name\\" task",
84
- "type": "info",
85
- },
86
- },
87
- "type": "TOASTS_ADD",
61
+ "type": "TASKS_CANCEL_SUCCESS",
88
62
  },
89
63
  ],
90
64
  Array [
91
65
  Object {
92
66
  "payload": Object {
93
67
  "message": Object {
94
- "message": "\\"some-name\\" Task cannot be cancelled at the moment.",
95
- "type": "error",
68
+ "message": "some-name Task execution was cancelled",
69
+ "type": "success",
96
70
  },
97
71
  },
98
72
  "type": "TOASTS_ADD",
@@ -101,25 +75,25 @@ Array [
101
75
  ]
102
76
  `;
103
77
 
104
- exports[`TasksTable actions should cancelTaskRequest and succeed 1`] = `
78
+ exports[`TasksTable actions should resumeTaskRequest and fail 1`] = `
105
79
  Array [
106
80
  Array [
107
81
  Object {
108
- "payload": Object {
109
- "message": Object {
110
- "message": "Trying to cancel \\"some-name\\" task",
111
- "type": "info",
112
- },
113
- },
114
- "type": "TOASTS_ADD",
82
+ "type": "TASKS_RESUME_REQUEST",
83
+ },
84
+ ],
85
+ Array [
86
+ Object {
87
+ "payload": undefined,
88
+ "type": "TASKS_RESUME_FAILURE",
115
89
  },
116
90
  ],
117
91
  Array [
118
92
  Object {
119
93
  "payload": Object {
120
94
  "message": Object {
121
- "message": "\\"some-name\\" Task cancelled",
122
- "type": "success",
95
+ "message": "some-name Task execution could not be resumed",
96
+ "type": "error",
123
97
  },
124
98
  },
125
99
  "type": "TOASTS_ADD",
@@ -128,29 +102,24 @@ Array [
128
102
  ]
129
103
  `;
130
104
 
131
- exports[`TasksTable actions should resumeTask 1`] = `
105
+ exports[`TasksTable actions should resumeTaskRequest and succeed 1`] = `
132
106
  Array [
133
107
  Array [
134
- [Function],
135
- ],
136
- Array [
137
- "TASKS_TABLE",
108
+ Object {
109
+ "type": "TASKS_RESUME_REQUEST",
110
+ },
138
111
  ],
139
112
  Array [
140
- [Function],
141
- undefined,
113
+ Object {
114
+ "type": "TASKS_RESUME_SUCCESS",
115
+ },
142
116
  ],
143
- ]
144
- `;
145
-
146
- exports[`TasksTable actions should resumeTaskRequest and fail 1`] = `
147
- Array [
148
117
  Array [
149
118
  Object {
150
119
  "payload": Object {
151
120
  "message": Object {
152
- "message": "Task \\"some-name\\" has to be resumable.",
153
- "type": "error",
121
+ "message": "some-name Task execution was resumed",
122
+ "type": "success",
154
123
  },
155
124
  },
156
125
  "type": "TOASTS_ADD",
@@ -159,17 +128,19 @@ Array [
159
128
  ]
160
129
  `;
161
130
 
162
- exports[`TasksTable actions should resumeTaskRequest and succeed 1`] = `
131
+ exports[`TasksTable actions should selectPage and succeed 1`] = `
163
132
  Array [
164
133
  Array [
165
134
  Object {
166
- "payload": Object {
167
- "message": Object {
168
- "message": "\\"some-name\\" Task execution was resumed",
169
- "type": "success",
170
- },
171
- },
172
- "type": "TOASTS_ADD",
135
+ "payload": Array [
136
+ "some-id",
137
+ ],
138
+ "type": "SELECT_ROWS",
139
+ },
140
+ ],
141
+ Array [
142
+ Object {
143
+ "type": "OPEN_SELECT_ALL",
173
144
  },
174
145
  ],
175
146
  ]