foreman-tasks 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_tasks/api/tasks_controller.rb +29 -1
  3. data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
  4. data/app/models/foreman_tasks/task.rb +4 -0
  5. data/app/models/setting/foreman_tasks.rb +1 -1
  6. data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
  7. data/app/views/foreman_tasks/api/tasks/details.json.rabl +0 -1
  8. data/config/routes.rb +1 -0
  9. data/db/migrate/20200517215015_rename_bookmarks_controller.rb +35 -0
  10. data/db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb +5 -0
  11. data/db/seeds.d/30-notification_blueprints.rb +7 -0
  12. data/lib/foreman_tasks/engine.rb +1 -1
  13. data/lib/foreman_tasks/tasks/cleanup.rake +2 -2
  14. data/lib/foreman_tasks/tasks/export_tasks.rake +1 -1
  15. data/lib/foreman_tasks/version.rb +1 -1
  16. data/locale/action_names.rb +1 -1
  17. data/locale/en/foreman_tasks.po +227 -41
  18. data/locale/foreman_tasks.pot +579 -288
  19. data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
  20. data/webpack/ForemanTasks/Components/{TasksTable/TasksTableActionHelpers.js → TaskActions/TaskActionHelpers.js} +21 -6
  21. data/webpack/ForemanTasks/Components/{TasksTable/__tests__/TasksTableActionHelpers.test.js → TaskActions/TaskActionHelpers.test.js} +2 -2
  22. data/webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js +16 -0
  23. data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.js +60 -0
  24. data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js +14 -0
  25. data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap +233 -0
  26. data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap +25 -0
  27. data/webpack/ForemanTasks/Components/TaskActions/index.js +115 -0
  28. data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +130 -152
  29. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +67 -3
  30. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
  31. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +101 -70
  32. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +0 -15
  33. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +0 -5
  34. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
  35. data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +0 -9
  36. data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
  37. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +5 -0
  38. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +2 -7
  39. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +4 -0
  40. data/webpack/ForemanTasks/Components/TaskDetails/index.js +4 -8
  41. data/webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js +14 -1
  42. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js +83 -0
  43. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js +106 -0
  44. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js +38 -0
  45. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +45 -0
  46. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js +36 -0
  47. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js +205 -0
  48. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js +27 -0
  49. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +54 -0
  50. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap +41 -0
  51. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap +19 -0
  52. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +30 -0
  53. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
  54. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -0
  55. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
  56. data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +113 -30
  57. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +13 -9
  58. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +23 -63
  59. data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -12
  60. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +24 -94
  61. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
  62. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +7 -4
  63. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +35 -0
  64. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +2 -12
  65. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +22 -26
  66. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +2 -14
  67. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +107 -0
  68. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +2 -14
  69. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +17 -124
  70. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +24 -128
  71. data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
  72. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +47 -19
  73. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +61 -14
  74. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +80 -21
  75. data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss +9 -0
  76. data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js +44 -0
  77. data/webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap +52 -0
  78. data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +59 -66
  79. data/webpack/ForemanTasks/Components/common/{ToastTypesConstants.js → ToastsHelpers/ToastTypesConstants.js} +0 -0
  80. data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
  81. data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
  82. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -1
  83. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +2 -2
  84. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +17 -3
  85. data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
  86. metadata +32 -22
  87. data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +0 -9
  88. data/lib/foreman_tasks/tasks/dynflow.rake +0 -6
  89. data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +0 -53
  90. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +0 -56
  91. data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +0 -52
  92. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +0 -26
  93. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +0 -24
  94. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +0 -26
  95. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +0 -65
  96. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +0 -30
  97. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +0 -63
  98. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
  99. data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -26
  100. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +0 -23
  101. data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +0 -27
  102. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +0 -15
  103. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +0 -15
@@ -4,12 +4,6 @@ export const minProps = {
4
4
  getTableItems: jest.fn(),
5
5
  getBreadcrumbs: jest.fn(),
6
6
  itemCount: 2,
7
- cancelTask: jest.fn(),
8
- resumeTask: jest.fn(),
9
- bulkResumeById: jest.fn(),
10
- bulkCancelById: jest.fn(),
11
- bulkResumeBySearch: jest.fn(),
12
- bulkCancelBySearch: jest.fn(),
13
7
  selectPage: jest.fn(),
14
8
  selectAllRows: jest.fn(),
15
9
  unselectAllRows: jest.fn(),
@@ -27,12 +21,8 @@ export const minProps = {
27
21
  order: 'w',
28
22
  },
29
23
  openClickedModal: jest.fn(),
30
- modalProps: {
31
- cancelSelectedModal: {},
32
- resumeSelectedModal: {},
33
- cancelModal: {},
34
- resumeModal: {},
35
- },
24
+ openModalAction: jest.fn(),
25
+ openModal: jest.fn(),
36
26
  };
37
27
 
38
28
  export default {
@@ -2,51 +2,31 @@ import {
2
2
  testActionSnapshotWithFixtures,
3
3
  IntegrationTestHelper,
4
4
  } from '@theforeman/test';
5
- import API from 'foremanReact/API';
6
5
  import { TASKS_TABLE_ID } from '../TasksTableConstants';
7
6
  import {
8
7
  getTableItems,
9
8
  cancelTask,
10
- cancelTaskRequest,
11
9
  resumeTask,
12
- resumeTaskRequest,
10
+ forceCancelTask,
13
11
  selectPage,
12
+ openClickedModal,
13
+ openModalAction,
14
14
  } from '../TasksTableActions';
15
15
 
16
16
  jest.mock('foremanReact/components/common/table', () => ({
17
17
  getTableItemsAction: jest.fn(controller => controller),
18
18
  }));
19
19
 
20
- jest.mock('foremanReact/API');
21
-
22
- API.post.mockImplementation(() => ({ data: 'some-data' }));
23
-
24
20
  const taskInfo = {
25
21
  taskId: 'some-id',
26
22
  taskName: 'some-name',
27
23
  };
28
24
 
29
25
  const fixtures = {
30
- 'should cancelTaskRequest and succeed': () =>
31
- cancelTaskRequest('some-id', 'some-name'),
32
- 'should cancelTaskRequest and fail': () => {
33
- API.post.mockImplementation(() =>
34
- Promise.reject(new Error('Network Error'))
35
- );
36
- return cancelTaskRequest('some-id', 'some-name');
37
- },
38
-
39
- 'should resumeTaskRequest and succeed': () => {
40
- API.post.mockImplementation(() => ({ data: 'some-data' }));
41
- return resumeTaskRequest('some-id', 'some-name');
42
- },
43
- 'should resumeTaskRequest and fail': () => {
44
- API.post.mockImplementation(() =>
45
- Promise.reject(new Error('Network Error'))
46
- );
47
- return resumeTaskRequest('some-id', 'some-name');
48
- },
49
26
  'should selectPage and succeed': () => selectPage([{ id: 'some-id' }]),
27
+ 'handles openClickedModal': () =>
28
+ openClickedModal({ ...taskInfo, setModalOpen: jest.fn() }),
29
+ 'handles openModalAction': () => openModalAction('some-modal-id', jest.fn()),
50
30
  };
51
31
  describe('TasksTable actions', () => {
52
32
  it('getTableItems should reuse common/table/getTableItemsAction', () => {
@@ -65,5 +45,21 @@ describe('TasksTable actions', () => {
65
45
  await IntegrationTestHelper.flushAllPromises();
66
46
  expect(dispatch.mock.calls).toHaveLength(3);
67
47
  });
48
+ it('should forceCancelTask', async () => {
49
+ const dispatch = jest.fn();
50
+ forceCancelTask({ ...taskInfo, url: 'some-url' })(dispatch);
51
+ await IntegrationTestHelper.flushAllPromises();
52
+ expect(dispatch.mock.calls).toHaveLength(3);
53
+ });
54
+ it('openClickedModal opens modal', () => {
55
+ const setModalOpen = jest.fn();
56
+ openClickedModal({ ...taskInfo, setModalOpen });
57
+ expect(setModalOpen).toHaveBeenCalled();
58
+ });
59
+ it('openModalAction opens modal', () => {
60
+ const setModalOpen = jest.fn();
61
+ openModalAction('some-modal-id', setModalOpen);
62
+ expect(setModalOpen).toHaveBeenCalled();
63
+ });
68
64
  testActionSnapshotWithFixtures(fixtures);
69
65
  });
@@ -2,11 +2,6 @@
2
2
 
3
3
  exports[`SubTasksPage rendering render with minimal props 1`] = `
4
4
  <Connect(TasksTablePage)
5
- bulkCancelById={[MockFunction]}
6
- bulkCancelBySearch={[MockFunction]}
7
- bulkResumeById={[MockFunction]}
8
- bulkResumeBySearch={[MockFunction]}
9
- cancelTask={[MockFunction]}
10
5
  createHeader={[Function]}
11
6
  getBreadcrumbs={[MockFunction]}
12
7
  getTableItems={[MockFunction]}
@@ -25,15 +20,9 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
25
20
  },
26
21
  }
27
22
  }
28
- modalProps={
29
- Object {
30
- "cancelModal": Object {},
31
- "cancelSelectedModal": Object {},
32
- "resumeModal": Object {},
33
- "resumeSelectedModal": Object {},
34
- }
35
- }
36
23
  openClickedModal={[MockFunction]}
24
+ openModal={[MockFunction]}
25
+ openModalAction={[MockFunction]}
37
26
  pagination={
38
27
  Object {
39
28
  "page": 1,
@@ -47,7 +36,6 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
47
36
  "b",
48
37
  ]
49
38
  }
50
- resumeTask={[MockFunction]}
51
39
  selectAllRows={[MockFunction]}
52
40
  selectPage={[MockFunction]}
53
41
  selectRow={[MockFunction]}
@@ -69,6 +69,113 @@ Array [
69
69
  ]
70
70
  `;
71
71
 
72
+ exports[`TasksTable bulk actions handles bulkForceCancelById requests 1`] = `
73
+ Array [
74
+ Array [
75
+ Object {
76
+ "type": "TASKS_FORCE_CANCEL_REQUEST",
77
+ },
78
+ ],
79
+ Array [
80
+ Object {
81
+ "type": "TASKS_FORCE_CANCEL_SUCCESS",
82
+ },
83
+ ],
84
+ Array [
85
+ Object {
86
+ "payload": Object {
87
+ "message": Object {
88
+ "message": "2 task(s) cancelled with force",
89
+ "type": "success",
90
+ },
91
+ },
92
+ "type": "TOASTS_ADD",
93
+ },
94
+ ],
95
+ Array [
96
+ Object {
97
+ "payload": Object {
98
+ "message": Object {
99
+ "message": "4 task(s) are already stopped",
100
+ "type": "warning",
101
+ },
102
+ },
103
+ "type": "TOASTS_ADD",
104
+ },
105
+ ],
106
+ Array [
107
+ "TASKS_TABLE",
108
+ ],
109
+ Array [
110
+ [Function],
111
+ ],
112
+ ]
113
+ `;
114
+
115
+ exports[`TasksTable bulk actions handles bulkForceCancelById requests that are stopped 1`] = `
116
+ Array [
117
+ Array [
118
+ Object {
119
+ "payload": Object {
120
+ "message": Object {
121
+ "message": "1 task(s) are already stopped",
122
+ "type": "warning",
123
+ },
124
+ },
125
+ "type": "TOASTS_ADD",
126
+ },
127
+ ],
128
+ ]
129
+ `;
130
+
131
+ exports[`TasksTable bulk actions handles bulkForceCancelById requests that fail 1`] = `
132
+ Array [
133
+ Array [
134
+ Object {
135
+ "type": "TASKS_FORCE_CANCEL_REQUEST",
136
+ },
137
+ ],
138
+ Array [
139
+ Object {
140
+ "error": [Error: Network Error],
141
+ "type": "TASKS_FORCE_CANCEL_FAILURE",
142
+ },
143
+ ],
144
+ Array [
145
+ Object {
146
+ "payload": Object {
147
+ "message": Object {
148
+ "message": "Cannot force cancel tasks at the moment Error: Network Error",
149
+ "type": "error",
150
+ },
151
+ },
152
+ "type": "TOASTS_ADD",
153
+ },
154
+ ],
155
+ ]
156
+ `;
157
+
158
+ exports[`TasksTable bulk actions handles bulkForceCancelBySearch requests 1`] = `
159
+ Array [
160
+ Array [
161
+ Object {
162
+ "type": "TASKS_FORCE_CANCEL_REQUEST",
163
+ },
164
+ ],
165
+ Array [
166
+ Object {
167
+ "payload": Object {
168
+ "message": Object {
169
+ "message": "Canceling with force selected tasks, this might take a while",
170
+ "type": "info",
171
+ },
172
+ },
173
+ "type": "TOASTS_ADD",
174
+ },
175
+ ],
176
+ ]
177
+ `;
178
+
72
179
  exports[`TasksTable bulk actions handles bulkResumeById requests that are not resumable 1`] = `
73
180
  Array [
74
181
  Array [
@@ -2,11 +2,6 @@
2
2
 
3
3
  exports[`TasksIndexPage rendering render with minimal props 1`] = `
4
4
  <Connect(TasksTablePage)
5
- bulkCancelById={[MockFunction]}
6
- bulkCancelBySearch={[MockFunction]}
7
- bulkResumeById={[MockFunction]}
8
- bulkResumeBySearch={[MockFunction]}
9
- cancelTask={[MockFunction]}
10
5
  getBreadcrumbs={[MockFunction]}
11
6
  getTableItems={[MockFunction]}
12
7
  history={
@@ -17,15 +12,9 @@ exports[`TasksIndexPage rendering render with minimal props 1`] = `
17
12
  }
18
13
  }
19
14
  itemCount={2}
20
- modalProps={
21
- Object {
22
- "cancelModal": Object {},
23
- "cancelSelectedModal": Object {},
24
- "resumeModal": Object {},
25
- "resumeSelectedModal": Object {},
26
- }
27
- }
28
15
  openClickedModal={[MockFunction]}
16
+ openModal={[MockFunction]}
17
+ openModalAction={[MockFunction]}
29
18
  pagination={
30
19
  Object {
31
20
  "page": 1,
@@ -38,7 +27,6 @@ exports[`TasksIndexPage rendering render with minimal props 1`] = `
38
27
  "b",
39
28
  ]
40
29
  }
41
- resumeTask={[MockFunction]}
42
30
  selectAllRows={[MockFunction]}
43
31
  selectPage={[MockFunction]}
44
32
  selectRow={[MockFunction]}
@@ -1,131 +1,24 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`TasksTable actions should cancelTaskRequest and fail 1`] = `
4
- Array [
5
- Array [
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
- },
15
- ],
16
- Array [
17
- Object {
18
- "type": "TASKS_CANCEL_REQUEST",
19
- },
20
- ],
21
- Array [
22
- Object {
23
- "payload": undefined,
24
- "type": "TASKS_CANCEL_FAILURE",
25
- },
26
- ],
27
- Array [
28
- Object {
29
- "payload": Object {
30
- "message": Object {
31
- "message": "some-name Task execution task has to be cancellable",
32
- "type": "warning",
33
- },
34
- },
35
- "type": "TOASTS_ADD",
36
- },
37
- ],
38
- ]
39
- `;
40
-
41
- exports[`TasksTable actions should cancelTaskRequest and succeed 1`] = `
42
- Array [
43
- Array [
44
- Object {
45
- "payload": Object {
46
- "message": Object {
47
- "message": "Trying to cancel some-name task",
48
- "type": "info",
49
- },
50
- },
51
- "type": "TOASTS_ADD",
52
- },
53
- ],
54
- Array [
55
- Object {
56
- "type": "TASKS_CANCEL_REQUEST",
57
- },
58
- ],
59
- Array [
60
- Object {
61
- "type": "TASKS_CANCEL_SUCCESS",
62
- },
63
- ],
64
- Array [
65
- Object {
66
- "payload": Object {
67
- "message": Object {
68
- "message": "some-name Task execution was cancelled",
69
- "type": "success",
70
- },
71
- },
72
- "type": "TOASTS_ADD",
73
- },
74
- ],
75
- ]
76
- `;
77
-
78
- exports[`TasksTable actions should resumeTaskRequest and fail 1`] = `
79
- Array [
80
- Array [
81
- Object {
82
- "type": "TASKS_RESUME_REQUEST",
83
- },
84
- ],
85
- Array [
86
- Object {
87
- "payload": undefined,
88
- "type": "TASKS_RESUME_FAILURE",
89
- },
90
- ],
91
- Array [
92
- Object {
93
- "payload": Object {
94
- "message": Object {
95
- "message": "some-name Task execution could not be resumed",
96
- "type": "error",
97
- },
98
- },
99
- "type": "TOASTS_ADD",
100
- },
101
- ],
102
- ]
3
+ exports[`TasksTable actions handles openClickedModal 1`] = `
4
+ Object {
5
+ "payload": Object {
6
+ "clicked": Object {
7
+ "taskId": "some-id",
8
+ "taskName": "some-name",
9
+ },
10
+ },
11
+ "type": "UPDATE_CLICKED",
12
+ }
103
13
  `;
104
14
 
105
- exports[`TasksTable actions should resumeTaskRequest and succeed 1`] = `
106
- Array [
107
- Array [
108
- Object {
109
- "type": "TASKS_RESUME_REQUEST",
110
- },
111
- ],
112
- Array [
113
- Object {
114
- "type": "TASKS_RESUME_SUCCESS",
115
- },
116
- ],
117
- Array [
118
- Object {
119
- "payload": Object {
120
- "message": Object {
121
- "message": "some-name Task execution was resumed",
122
- "type": "success",
123
- },
124
- },
125
- "type": "TOASTS_ADD",
126
- },
127
- ],
128
- ]
15
+ exports[`TasksTable actions handles openModalAction 1`] = `
16
+ Object {
17
+ "payload": Object {
18
+ "modalID": "some-modal-id",
19
+ },
20
+ "type": "UPDATE_MODAL",
21
+ }
129
22
  `;
130
23
 
131
24
  exports[`TasksTable actions should selectPage and succeed 1`] = `
@@ -4,40 +4,16 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
4
4
  <div
5
5
  className="tasks-table-wrapper"
6
6
  >
7
- <ConfirmationModals
8
- modalProps={
7
+ <Connect(ConfirmModal)
8
+ id="ConfirmModal"
9
+ parentTaskID={null}
10
+ setModalClosed={[MockFunction]}
11
+ uriQuery={
9
12
  Object {
10
- "cancelModal": Object {
11
- "modalOpen": true,
12
- "setModalClosed": [MockFunction],
13
- "setModalOpen": [MockFunction],
14
- },
15
- "cancelSelectedModal": Object {
16
- "modalOpen": true,
17
- "setModalClosed": [MockFunction],
18
- "setModalOpen": [MockFunction],
19
- },
20
- "resumeModal": Object {
21
- "modalOpen": true,
22
- "setModalClosed": [MockFunction],
23
- "setModalOpen": [MockFunction],
24
- },
25
- "resumeSelectedModal": Object {
26
- "modalOpen": true,
27
- "setModalClosed": [MockFunction],
28
- "setModalOpen": [MockFunction],
29
- },
30
- }
31
- }
32
- selectedRowsLen={0}
33
- tasksActions={
34
- Object {
35
- "cancelSelectedTasks": [Function],
36
- "cancelTask": [Function],
37
- "resumeSelectedTasks": [Function],
38
- "resumeTask": [Function],
13
+ "state": "stopped",
39
14
  }
40
15
  }
16
+ url="/foreman_tasks/tasks?action=\\"some-name\\""
41
17
  />
42
18
  <PageLayout
43
19
  beforeToolbarComponent={
@@ -85,7 +61,7 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
85
61
  "documentationUrl": "4.1.5Searching",
86
62
  "url": "/api/bookmarks",
87
63
  },
88
- "controller": "foreman_tasks/tasks",
64
+ "controller": "foreman_tasks_tasks",
89
65
  }
90
66
  }
91
67
  searchQuery="a=b"
@@ -106,8 +82,9 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
106
82
  />
107
83
  <ActionSelectButton
108
84
  disabled={true}
109
- onCancel={[MockFunction]}
110
- onResume={[MockFunction]}
85
+ onCancel={[Function]}
86
+ onForceCancel={[Function]}
87
+ onResume={[Function]}
111
88
  />
112
89
  </React.Fragment>
113
90
  }
@@ -115,11 +92,6 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
115
92
  <TasksTable
116
93
  actionName=""
117
94
  allRowsSelected={false}
118
- bulkCancelById={[MockFunction]}
119
- bulkCancelBySearch={[MockFunction]}
120
- bulkResumeById={[MockFunction]}
121
- bulkResumeBySearch={[MockFunction]}
122
- cancelTask={[MockFunction]}
123
95
  error={null}
124
96
  getTableItems={[MockFunction]}
125
97
  history={
@@ -131,31 +103,8 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
131
103
  }
132
104
  }
133
105
  itemCount={2}
134
- modalProps={
135
- Object {
136
- "cancelModal": Object {
137
- "modalOpen": true,
138
- "setModalClosed": [MockFunction],
139
- "setModalOpen": [MockFunction],
140
- },
141
- "cancelSelectedModal": Object {
142
- "modalOpen": true,
143
- "setModalClosed": [MockFunction],
144
- "setModalOpen": [MockFunction],
145
- },
146
- "resumeModal": Object {
147
- "modalOpen": true,
148
- "setModalClosed": [MockFunction],
149
- "setModalOpen": [MockFunction],
150
- },
151
- "resumeSelectedModal": Object {
152
- "modalOpen": true,
153
- "setModalClosed": [MockFunction],
154
- "setModalOpen": [MockFunction],
155
- },
156
- }
157
- }
158
106
  openClickedModal={[MockFunction]}
107
+ openModal={[Function]}
159
108
  pagination={
160
109
  Object {
161
110
  "page": 1,
@@ -169,7 +118,6 @@ exports[`TasksTablePage rendering render with Breadcrubs 1`] = `
169
118
  "b",
170
119
  ]
171
120
  }
172
- resumeTask={[MockFunction]}
173
121
  selectPage={[MockFunction]}
174
122
  selectRow={[MockFunction]}
175
123
  selectedRows={Array []}
@@ -191,40 +139,16 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
191
139
  <div
192
140
  className="tasks-table-wrapper"
193
141
  >
194
- <ConfirmationModals
195
- modalProps={
142
+ <Connect(ConfirmModal)
143
+ id="ConfirmModal"
144
+ parentTaskID={null}
145
+ setModalClosed={[MockFunction]}
146
+ uriQuery={
196
147
  Object {
197
- "cancelModal": Object {
198
- "modalOpen": true,
199
- "setModalClosed": [MockFunction],
200
- "setModalOpen": [MockFunction],
201
- },
202
- "cancelSelectedModal": Object {
203
- "modalOpen": true,
204
- "setModalClosed": [MockFunction],
205
- "setModalOpen": [MockFunction],
206
- },
207
- "resumeModal": Object {
208
- "modalOpen": true,
209
- "setModalClosed": [MockFunction],
210
- "setModalOpen": [MockFunction],
211
- },
212
- "resumeSelectedModal": Object {
213
- "modalOpen": true,
214
- "setModalClosed": [MockFunction],
215
- "setModalOpen": [MockFunction],
216
- },
217
- }
218
- }
219
- selectedRowsLen={0}
220
- tasksActions={
221
- Object {
222
- "cancelSelectedTasks": [Function],
223
- "cancelTask": [Function],
224
- "resumeSelectedTasks": [Function],
225
- "resumeTask": [Function],
148
+ "state": "stopped",
226
149
  }
227
150
  }
151
+ url="/foreman_tasks/tasks?action=\\"some-name\\""
228
152
  />
229
153
  <PageLayout
230
154
  beforeToolbarComponent={
@@ -255,7 +179,7 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
255
179
  "documentationUrl": "4.1.5Searching",
256
180
  "url": "/api/bookmarks",
257
181
  },
258
- "controller": "foreman_tasks/tasks",
182
+ "controller": "foreman_tasks_tasks",
259
183
  }
260
184
  }
261
185
  searchQuery="a=b"
@@ -276,8 +200,9 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
276
200
  />
277
201
  <ActionSelectButton
278
202
  disabled={true}
279
- onCancel={[MockFunction]}
280
- onResume={[MockFunction]}
203
+ onCancel={[Function]}
204
+ onForceCancel={[Function]}
205
+ onResume={[Function]}
281
206
  />
282
207
  </React.Fragment>
283
208
  }
@@ -285,11 +210,6 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
285
210
  <TasksTable
286
211
  actionName=""
287
212
  allRowsSelected={false}
288
- bulkCancelById={[MockFunction]}
289
- bulkCancelBySearch={[MockFunction]}
290
- bulkResumeById={[MockFunction]}
291
- bulkResumeBySearch={[MockFunction]}
292
- cancelTask={[MockFunction]}
293
213
  error={null}
294
214
  getTableItems={[MockFunction]}
295
215
  history={
@@ -301,31 +221,8 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
301
221
  }
302
222
  }
303
223
  itemCount={2}
304
- modalProps={
305
- Object {
306
- "cancelModal": Object {
307
- "modalOpen": true,
308
- "setModalClosed": [MockFunction],
309
- "setModalOpen": [MockFunction],
310
- },
311
- "cancelSelectedModal": Object {
312
- "modalOpen": true,
313
- "setModalClosed": [MockFunction],
314
- "setModalOpen": [MockFunction],
315
- },
316
- "resumeModal": Object {
317
- "modalOpen": true,
318
- "setModalClosed": [MockFunction],
319
- "setModalOpen": [MockFunction],
320
- },
321
- "resumeSelectedModal": Object {
322
- "modalOpen": true,
323
- "setModalClosed": [MockFunction],
324
- "setModalOpen": [MockFunction],
325
- },
326
- }
327
- }
328
224
  openClickedModal={[MockFunction]}
225
+ openModal={[Function]}
329
226
  pagination={
330
227
  Object {
331
228
  "page": 1,
@@ -339,7 +236,6 @@ exports[`TasksTablePage rendering render with minimal props 1`] = `
339
236
  "b",
340
237
  ]
341
238
  }
342
- resumeTask={[MockFunction]}
343
239
  selectPage={[MockFunction]}
344
240
  selectRow={[MockFunction]}
345
241
  selectedRows={Array []}