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
@@ -1,6 +1,15 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
1
+ import React from 'react';
2
+ import {
3
+ testComponentSnapshotsWithFixtures,
4
+ mount,
5
+ shallow,
6
+ } from '@theforeman/test';
7
+ import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
3
8
  import Task from '../Task';
9
+ import {
10
+ UNLOCK_MODAL,
11
+ FORCE_UNLOCK_MODAL,
12
+ } from '../../../TaskActions/TaskActionsConstants';
4
13
 
5
14
  const fixtures = {
6
15
  'render without Props': { id: 'test' },
@@ -8,12 +17,67 @@ const fixtures = {
8
17
  id: 'test',
9
18
  state: 'paused',
10
19
  hasSubTasks: true,
11
- allowDangerousActions: true,
12
20
  dynflowEnableConsole: true,
21
+ parentTask: 'parent-id',
22
+ taskReload: true,
13
23
  },
14
24
  };
15
25
 
16
26
  describe('Task', () => {
17
27
  describe('rendering', () =>
18
28
  testComponentSnapshotsWithFixtures(Task, fixtures));
29
+ describe('click test', () => {
30
+ const setModalOpen = jest.fn();
31
+ useForemanModal.mockImplementation(id => ({
32
+ setModalOpen: () => setModalOpen(id),
33
+ }));
34
+ const cancelTaskRequest = jest.fn();
35
+ const resumeTaskRequest = jest.fn();
36
+ const taskReloadStart = jest.fn();
37
+ const id = 'some-id';
38
+ const action = 'some-action';
39
+ const props = {
40
+ taskReload: false,
41
+ taskReloadStart,
42
+ id,
43
+ action,
44
+ cancelTaskRequest,
45
+ resumeTaskRequest,
46
+ };
47
+ afterEach(() => {
48
+ jest.clearAllMocks();
49
+ });
50
+ it('reload', () => {
51
+ const component = mount(<Task {...props} />);
52
+ const reloadButton = component.find('.reload-button').at(0);
53
+ reloadButton.simulate('click');
54
+ expect(taskReloadStart).toBeCalled();
55
+ });
56
+ it('resume', () => {
57
+ const component = shallow(<Task {...props} />);
58
+ const resumeButton = component.find('.resume-button').at(0);
59
+ resumeButton.props().onClick();
60
+ expect(taskReloadStart).toBeCalled();
61
+ expect(resumeTaskRequest).toBeCalledWith(id, action);
62
+ });
63
+ it('cancel', () => {
64
+ const component = shallow(<Task {...props} />);
65
+ const cancelButton = component.find('.cancel-button').at(0);
66
+ cancelButton.props().onClick();
67
+ expect(taskReloadStart).toBeCalled();
68
+ expect(cancelTaskRequest).toBeCalledWith(id, action);
69
+ });
70
+ it('unlock', () => {
71
+ const component = shallow(<Task {...props} />);
72
+ const unlockButton = component.find('.unlock-button').at(0);
73
+ unlockButton.props().onClick();
74
+ expect(setModalOpen).toBeCalledWith({ id: UNLOCK_MODAL });
75
+ });
76
+ it('focrce unlock', () => {
77
+ const component = shallow(<Task {...props} />);
78
+ const forceUnlockButton = component.find('.force-unlock-button').at(0);
79
+ forceUnlockButton.props().onClick();
80
+ expect(setModalOpen).toBeCalledWith({ id: FORCE_UNLOCK_MODAL });
81
+ });
82
+ });
19
83
  });
@@ -41,7 +41,6 @@ const fixtures = {
41
41
  help:
42
42
  "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.\nThe recommended approach is to investigate the error messages below and in 'errors' tab, address the primary cause of the issue and resume the task.",
43
43
  hasSubTasks: false,
44
- allowDangerousActions: false,
45
44
  locks: [
46
45
  {
47
46
  name: 'task_owner',
@@ -2,25 +2,14 @@
2
2
 
3
3
  exports[`Task rendering render with some Props 1`] = `
4
4
  <Fragment>
5
- <ClickConfirmation
6
- body="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."
7
- closeModal={[Function]}
8
- confirmAction="Unlock"
9
- confirmType="warning"
10
- confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
11
- path="/foreman_tasks/tasks/test/unlock"
12
- showModal={false}
13
- title="Unlock"
5
+ <UnlockModal
6
+ id="unlockModal"
7
+ onClick={[Function]}
14
8
  />
15
- <ClickConfirmation
16
- body="Resources will be unlocked and will not prevent other tasks from being run. As the task might be still running, it should be avoided to use this unless you are really sure the task got stuck"
17
- closeModal={[Function]}
18
- confirmAction="Force Unlock"
19
- confirmType="danger"
20
- confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
21
- path="/foreman_tasks/tasks/test/force_unlock"
22
- showModal={false}
23
- title="Force Unlock"
9
+ <ForceUnlockModal
10
+ id="forceUnlockModal"
11
+ onClick={[Function]}
12
+ selectedRowsLen={1}
24
13
  />
25
14
  <Grid
26
15
  bsClass="container"
@@ -44,13 +33,12 @@ exports[`Task rendering render with some Props 1`] = `
44
33
  bsStyle="default"
45
34
  className="reload-button"
46
35
  disabled={false}
47
- hidden={false}
48
36
  onClick={[Function]}
49
37
  >
50
38
  <span
51
- className="glyphicon glyphicon-refresh "
39
+ className="glyphicon glyphicon-refresh spin"
52
40
  />
53
- Start auto-reloading
41
+ Stop auto-reloading
54
42
  </Button>
55
43
  <Button
56
44
  active={false}
@@ -58,29 +46,55 @@ exports[`Task rendering render with some Props 1`] = `
58
46
  bsClass="btn"
59
47
  bsSize="small"
60
48
  bsStyle="default"
49
+ className="dynflow-button"
61
50
  disabled={false}
62
51
  href="/foreman_tasks/dynflow/"
63
52
  >
64
53
  Dynflow console
65
54
  </Button>
66
- <ResumeButton
55
+ <Button
56
+ active={false}
57
+ block={false}
58
+ bsClass="btn"
59
+ bsSize="small"
60
+ bsStyle="default"
61
+ className="resume-button"
67
62
  disabled={true}
68
- id="test"
69
- name=""
70
63
  onClick={[Function]}
71
- />
72
- <CancelButton
64
+ >
65
+ Resume
66
+ </Button>
67
+ <Button
68
+ active={false}
69
+ block={false}
70
+ bsClass="btn"
71
+ bsSize="small"
72
+ bsStyle="default"
73
+ className="cancel-button"
73
74
  disabled={true}
74
- id="test"
75
- name=""
76
75
  onClick={[Function]}
77
- />
76
+ >
77
+ Cancel
78
+ </Button>
78
79
  <Button
79
80
  active={false}
80
81
  block={false}
81
82
  bsClass="btn"
82
83
  bsSize="small"
83
84
  bsStyle="default"
85
+ className="parent-button"
86
+ disabled={false}
87
+ href="/foreman_tasks/tasks/parent-id"
88
+ >
89
+ Parent task
90
+ </Button>
91
+ <Button
92
+ active={false}
93
+ block={false}
94
+ bsClass="btn"
95
+ bsSize="small"
96
+ bsStyle="default"
97
+ className="subtask-button"
84
98
  disabled={false}
85
99
  href="/foreman_tasks/tasks/test/sub_tasks"
86
100
  >
@@ -92,8 +106,9 @@ exports[`Task rendering render with some Props 1`] = `
92
106
  bsClass="btn"
93
107
  bsSize="small"
94
108
  bsStyle="default"
109
+ className="unlock-button"
95
110
  disabled={false}
96
- onClick={[Function]}
111
+ onClick={[MockFunction]}
97
112
  >
98
113
  Unlock
99
114
  </Button>
@@ -103,8 +118,9 @@ exports[`Task rendering render with some Props 1`] = `
103
118
  bsClass="btn"
104
119
  bsSize="small"
105
120
  bsStyle="default"
121
+ className="force-unlock-button"
106
122
  disabled={false}
107
- onClick={[Function]}
123
+ onClick={[MockFunction]}
108
124
  >
109
125
  Force Unlock
110
126
  </Button>
@@ -112,7 +128,6 @@ exports[`Task rendering render with some Props 1`] = `
112
128
  </Row>
113
129
  <TaskInfo
114
130
  action=""
115
- allowDangerousActions={true}
116
131
  cancelTaskRequest={[Function]}
117
132
  cancellable={false}
118
133
  dynflowEnableConsole={true}
@@ -123,24 +138,20 @@ exports[`Task rendering render with some Props 1`] = `
123
138
  help=""
124
139
  id="test"
125
140
  output=""
126
- parentTask=""
141
+ parentTask="parent-id"
127
142
  progress={0}
128
143
  refetchTaskDetails={[Function]}
129
144
  result="error"
130
145
  resumable={false}
131
146
  resumeTaskRequest={[Function]}
132
- showForceUnlockModal={false}
133
- showUnlockModal={false}
134
147
  startAt=""
135
148
  startBefore=""
136
149
  startedAt=""
137
150
  state="paused"
138
- taskReload={false}
151
+ taskReload={true}
139
152
  taskReloadStart={[Function]}
140
153
  taskReloadStop={[Function]}
141
154
  timeoutId={null}
142
- toggleForceUnlockModal={[Function]}
143
- toggleUnlockModal={[Function]}
144
155
  username=""
145
156
  usernamePath=""
146
157
  />
@@ -150,25 +161,14 @@ exports[`Task rendering render with some Props 1`] = `
150
161
 
151
162
  exports[`Task rendering render without Props 1`] = `
152
163
  <Fragment>
153
- <ClickConfirmation
154
- body="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."
155
- closeModal={[Function]}
156
- confirmAction="Unlock"
157
- confirmType="warning"
158
- confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
159
- path="/foreman_tasks/tasks/test/unlock"
160
- showModal={false}
161
- title="Unlock"
164
+ <UnlockModal
165
+ id="unlockModal"
166
+ onClick={[Function]}
162
167
  />
163
- <ClickConfirmation
164
- body="Resources will be unlocked and will not prevent other tasks from being run. As the task might be still running, it should be avoided to use this unless you are really sure the task got stuck"
165
- closeModal={[Function]}
166
- confirmAction="Force Unlock"
167
- confirmType="danger"
168
- confirmationMessage="I understand that this may cause harm and have working database backups of all backend services."
169
- path="/foreman_tasks/tasks/test/force_unlock"
170
- showModal={false}
171
- title="Force Unlock"
168
+ <ForceUnlockModal
169
+ id="forceUnlockModal"
170
+ onClick={[Function]}
171
+ selectedRowsLen={1}
172
172
  />
173
173
  <Grid
174
174
  bsClass="container"
@@ -192,7 +192,6 @@ exports[`Task rendering render without Props 1`] = `
192
192
  bsStyle="default"
193
193
  className="reload-button"
194
194
  disabled={false}
195
- hidden={true}
196
195
  onClick={[Function]}
197
196
  >
198
197
  <span
@@ -206,28 +205,64 @@ exports[`Task rendering render without Props 1`] = `
206
205
  bsClass="btn"
207
206
  bsSize="small"
208
207
  bsStyle="default"
208
+ className="dynflow-button"
209
209
  disabled={true}
210
210
  href="/foreman_tasks/dynflow/"
211
211
  >
212
212
  Dynflow console
213
213
  </Button>
214
- <ResumeButton
214
+ <Button
215
+ active={false}
216
+ block={false}
217
+ bsClass="btn"
218
+ bsSize="small"
219
+ bsStyle="default"
220
+ className="resume-button"
215
221
  disabled={true}
216
- id="test"
217
- name=""
218
222
  onClick={[Function]}
219
- />
220
- <CancelButton
223
+ >
224
+ Resume
225
+ </Button>
226
+ <Button
227
+ active={false}
228
+ block={false}
229
+ bsClass="btn"
230
+ bsSize="small"
231
+ bsStyle="default"
232
+ className="cancel-button"
221
233
  disabled={true}
222
- id="test"
223
- name=""
224
234
  onClick={[Function]}
225
- />
235
+ >
236
+ Cancel
237
+ </Button>
238
+ <Button
239
+ active={false}
240
+ block={false}
241
+ bsClass="btn"
242
+ bsSize="small"
243
+ bsStyle="default"
244
+ className="unlock-button"
245
+ disabled={true}
246
+ onClick={[MockFunction]}
247
+ >
248
+ Unlock
249
+ </Button>
250
+ <Button
251
+ active={false}
252
+ block={false}
253
+ bsClass="btn"
254
+ bsSize="small"
255
+ bsStyle="default"
256
+ className="force-unlock-button"
257
+ disabled={false}
258
+ onClick={[MockFunction]}
259
+ >
260
+ Force Unlock
261
+ </Button>
226
262
  </Col>
227
263
  </Row>
228
264
  <TaskInfo
229
265
  action=""
230
- allowDangerousActions={false}
231
266
  cancelTaskRequest={[Function]}
232
267
  cancellable={false}
233
268
  dynflowEnableConsole={false}
@@ -244,8 +279,6 @@ exports[`Task rendering render without Props 1`] = `
244
279
  result="error"
245
280
  resumable={false}
246
281
  resumeTaskRequest={[Function]}
247
- showForceUnlockModal={false}
248
- showUnlockModal={false}
249
282
  startAt=""
250
283
  startBefore=""
251
284
  startedAt=""
@@ -254,8 +287,6 @@ exports[`Task rendering render without Props 1`] = `
254
287
  taskReloadStart={[Function]}
255
288
  taskReloadStop={[Function]}
256
289
  timeoutId={null}
257
- toggleForceUnlockModal={[Function]}
258
- toggleUnlockModal={[Function]}
259
290
  username=""
260
291
  usernamePath=""
261
292
  />
@@ -9,13 +9,7 @@ import {
9
9
  FOREMAN_TASK_DETAILS_FETCH_TASK_FAILURE,
10
10
  FOREMAN_TASK_DETAILS_STOP_POLLING,
11
11
  FOREMAN_TASK_DETAILS_START_POLLING,
12
- FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL,
13
- FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL,
14
12
  } from './TaskDetailsConstants';
15
- import {
16
- cancelTaskRequest,
17
- resumeTaskRequest,
18
- } from '../TasksTable/TasksTableActions';
19
13
 
20
14
  export const taskReloadStop = timeoutId => {
21
15
  if (timeoutId) {
@@ -104,12 +98,3 @@ const requestFailure = error => ({
104
98
  type: FOREMAN_TASK_DETAILS_FETCH_TASK_FAILURE,
105
99
  payload: error,
106
100
  });
107
-
108
- export const toggleUnlockModal = () => ({
109
- type: FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL,
110
- });
111
- export const toggleForceUnlockModal = () => ({
112
- type: FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL,
113
- });
114
-
115
- export { cancelTaskRequest, resumeTaskRequest };
@@ -11,8 +11,3 @@ export const FOREMAN_TASK_DETAILS_STOP_POLLING =
11
11
  'FOREMAN_TASK_DETAILS_STOP_POLLING';
12
12
  export const FOREMAN_TASK_DETAILS_START_POLLING =
13
13
  'FOREMAN_TASK_DETAILS_START_POLLING';
14
-
15
- export const FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL =
16
- 'FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL';
17
- export const FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL =
18
- 'FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL';
@@ -4,8 +4,6 @@ import {
4
4
  FOREMAN_TASK_DETAILS_FETCH_TASK_SUCCESS,
5
5
  FOREMAN_TASK_DETAILS_STOP_POLLING,
6
6
  FOREMAN_TASK_DETAILS_START_POLLING,
7
- FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL,
8
- FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL,
9
7
  } from './TaskDetailsConstants';
10
8
 
11
9
  const initialState = Immutable({});
@@ -34,10 +32,6 @@ export default (state = initialState, action) => {
34
32
  case FOREMAN_TASK_DETAILS_START_POLLING:
35
33
  clearTimeout(state.timeoutId);
36
34
  return state.merge({ taskReload: true, timeoutId: payload.timeoutId });
37
- case FOREMAN_TASK_DETAILS_TOGGLE_UNLOCK_MODAL:
38
- return state.set('showUnlockModal', !state.showUnlockModal);
39
- case FOREMAN_TASK_DETAILS_TOGGLE_FORCE_UNLOCK_MODAL:
40
- return state.set('showForceUnlockModal', !state.showForceUnlockModal);
41
35
  default:
42
36
  return state;
43
37
  }
@@ -52,9 +52,6 @@ export const selectHelp = state => selectTaskDetails(state).help || null;
52
52
  export const selectHasSubTasks = state =>
53
53
  selectTaskDetails(state).has_sub_tasks || false;
54
54
 
55
- export const selectAllowDangerousActions = state =>
56
- selectTaskDetails(state).allowDangerousActions || false;
57
-
58
55
  export const selectLocks = state => selectTaskDetails(state).locks || [];
59
56
 
60
57
  export const selectUsernamePath = state =>
@@ -75,12 +72,6 @@ export const selectTaskReload = state =>
75
72
  export const selectParentTask = state =>
76
73
  selectTaskDetails(state).parent_task_id || '';
77
74
 
78
- export const selectShowUnlockModal = state =>
79
- selectTaskDetails(state).showUnlockModal || false;
80
-
81
- export const selectShowForceUnlockModal = state =>
82
- selectTaskDetails(state).showForceUnlockModal || false;
83
-
84
75
  export const selectExternalId = state =>
85
76
  selectTaskDetails(state).external_id || null;
86
77