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,17 +1,4 @@
1
- export const FOREMAN_TASK_DETAILS_INIT = 'FOREMAN_TASK_DETAILS_INIT';
1
+ export const FOREMAN_TASK_DETAILS = 'FOREMAN_TASK_DETAILS';
2
+ export const FOREMAN_TASK_DETAILS_SUCCESS = 'FOREMAN_TASK_DETAILS_SUCCESS';
2
3
 
3
- export const FOREMAN_TASK_DETAILS_FETCH_TASK_REQUEST =
4
- 'FOREMAN_TASK_DETAILS_FETCH_TASK_REQUEST';
5
- export const FOREMAN_TASK_DETAILS_FETCH_TASK_SUCCESS =
6
- 'FOREMAN_TASK_DETAILS_FETCH_TASK_SUCCESS';
7
- export const FOREMAN_TASK_DETAILS_FETCH_TASK_FAILURE =
8
- 'FOREMAN_TASK_DETAILS_FETCH_TASK_FAILURE';
9
-
10
- export const FOREMAN_TASK_DETAILS_STOP_POLLING =
11
- 'FOREMAN_TASK_DETAILS_STOP_POLLING';
12
- export const FOREMAN_TASK_DETAILS_START_POLLING =
13
- 'FOREMAN_TASK_DETAILS_START_POLLING';
14
-
15
- export const TASK_STEP_CANCEL_REQUEST = 'TASK_STEP_CANCEL_REQUEST';
16
- export const TASK_STEP_CANCEL_FAILURE = 'TASK_STEP_CANCEL_FAILURE';
17
- export const TASK_STEP_CANCEL_SUCCESS = 'TASK_STEP_CANCEL_SUCCESS';
4
+ export const TASK_STEP_CANCEL = 'TASK_STEP_CANCEL';
@@ -1,82 +1,108 @@
1
+ /* eslint-disable camelcase */
2
+ import {
3
+ selectAPIResponse,
4
+ selectAPIByKey,
5
+ } from 'foremanReact/redux/API/APISelectors';
6
+ import { selectDoesIntervalExist } from 'foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors';
7
+ import { STATUS } from 'foremanReact/constants';
1
8
  import { selectForemanTasks } from '../../ForemanTasksSelectors';
9
+ import { FOREMAN_TASK_DETAILS } from './TaskDetailsConstants';
2
10
 
3
11
  export const selectTaskDetails = state =>
4
12
  selectForemanTasks(state).taskDetails || {};
5
13
 
6
- export const selectStartAt = state => selectTaskDetails(state).start_at || null;
14
+ export const selectTaskDetailsResponse = state =>
15
+ selectAPIResponse(state, FOREMAN_TASK_DETAILS);
16
+
17
+ export const selectStartAt = state =>
18
+ selectTaskDetailsResponse(state)?.start_at;
7
19
 
8
20
  export const selectStartBefore = state =>
9
- selectTaskDetails(state).start_before || null;
21
+ selectTaskDetailsResponse(state)?.start_before;
10
22
 
11
23
  export const selectStartedAt = state =>
12
- selectTaskDetails(state).started_at || null;
24
+ selectTaskDetailsResponse(state)?.started_at;
13
25
 
14
- export const selectEndedAt = state => selectTaskDetails(state).ended_at || null;
26
+ export const selectEndedAt = state =>
27
+ selectTaskDetailsResponse(state)?.ended_at;
15
28
 
16
- export const selectInput = state => selectTaskDetails(state).input || [];
29
+ export const selectInput = state =>
30
+ selectTaskDetailsResponse(state).input || [];
17
31
 
18
- export const selectOutput = state => selectTaskDetails(state).output || {};
32
+ export const selectOutput = state =>
33
+ selectTaskDetailsResponse(state).output || {};
19
34
 
20
35
  export const selectResumable = state =>
21
- selectTaskDetails(state).resumable || false;
36
+ selectTaskDetailsResponse(state).resumable || false;
22
37
 
23
38
  export const selectCancellable = state =>
24
- selectTaskDetails(state).cancellable || false;
39
+ selectTaskDetailsResponse(state).cancellable || false;
25
40
 
26
41
  export const selectErrors = state => {
27
- const { humanized } = selectTaskDetails(state);
42
+ const { humanized } = selectTaskDetailsResponse(state);
28
43
  return humanized ? humanized.errors : [];
29
44
  };
30
45
 
31
46
  export const selectProgress = state =>
32
- selectTaskDetails(state).progress
33
- ? Math.trunc(selectTaskDetails(state).progress * 100)
47
+ selectTaskDetailsResponse(state).progress
48
+ ? Math.trunc(selectTaskDetailsResponse(state).progress * 100)
34
49
  : 0;
35
50
 
36
51
  export const selectUsername = state =>
37
- selectTaskDetails(state).username || null;
52
+ selectTaskDetailsResponse(state)?.username;
38
53
 
39
- export const selectLabel = state => selectTaskDetails(state).label || null;
54
+ export const selectLabel = state => selectTaskDetailsResponse(state)?.label;
40
55
 
41
56
  export const selectExecutionPlan = state =>
42
- selectTaskDetails(state).execution_plan || {};
57
+ selectTaskDetailsResponse(state).execution_plan || {};
43
58
 
44
59
  export const selectFailedSteps = state =>
45
- selectTaskDetails(state).failed_steps || [];
60
+ selectTaskDetailsResponse(state).failed_steps || [];
46
61
 
47
62
  export const selectRunningSteps = state =>
48
- selectTaskDetails(state).running_steps || [];
63
+ selectTaskDetailsResponse(state).running_steps || [];
49
64
 
50
- export const selectHelp = state => selectTaskDetails(state).help || null;
65
+ export const selectHelp = state => selectTaskDetailsResponse(state)?.help;
51
66
 
52
67
  export const selectHasSubTasks = state =>
53
- selectTaskDetails(state).has_sub_tasks || false;
68
+ selectTaskDetailsResponse(state).has_sub_tasks || false;
54
69
 
55
- export const selectLocks = state => selectTaskDetails(state).locks || [];
70
+ export const selectLocks = state =>
71
+ selectTaskDetailsResponse(state).locks || [];
56
72
 
57
73
  export const selectUsernamePath = state =>
58
- selectTaskDetails(state).username_path || null;
74
+ selectTaskDetailsResponse(state)?.username_path;
59
75
 
60
- export const selectAction = state => selectTaskDetails(state).action || '';
76
+ export const selectAction = state =>
77
+ selectTaskDetailsResponse(state).action || '';
61
78
 
62
- export const selectState = state => selectTaskDetails(state).state || null;
79
+ export const selectState = state => selectTaskDetailsResponse(state)?.state;
63
80
 
64
- export const selectResult = state => selectTaskDetails(state).result || null;
81
+ export const selectResult = state => selectTaskDetailsResponse(state)?.result;
65
82
 
66
83
  export const selectTimeoutId = state =>
67
- selectTaskDetails(state).timeoutId || null;
84
+ selectTaskDetailsResponse(state)?.timeoutId;
68
85
 
69
86
  export const selectTaskReload = state =>
70
- selectTaskDetails(state).taskReload || false;
87
+ !!selectDoesIntervalExist(state, FOREMAN_TASK_DETAILS);
71
88
 
72
89
  export const selectParentTask = state =>
73
- selectTaskDetails(state).parent_task_id || '';
90
+ selectTaskDetailsResponse(state).parent_task_id || '';
74
91
 
75
92
  export const selectExternalId = state =>
76
- selectTaskDetails(state).external_id || null;
93
+ selectTaskDetailsResponse(state)?.external_id;
77
94
 
78
95
  export const selectDynflowEnableConsole = state =>
79
- selectTaskDetails(state).dynflow_enable_console || false;
96
+ selectTaskDetailsResponse(state).dynflow_enable_console || false;
80
97
 
81
98
  export const selectCanEdit = state =>
82
- selectTaskDetails(state).can_edit || false;
99
+ selectTaskDetailsResponse(state).can_edit || false;
100
+
101
+ export const selectStatus = state => selectTaskDetailsResponse(state).status;
102
+
103
+ export const selectAPIError = state =>
104
+ selectTaskDetailsResponse(state)?.APIerror;
105
+
106
+ export const selectIsLoading = state =>
107
+ !!selectAPIByKey(state, FOREMAN_TASK_DETAILS).response &&
108
+ selectStatus(state) === STATUS.PENDING;
@@ -1,8 +1,8 @@
1
1
  export const minProps = {
2
2
  cancelStep: jest.fn(),
3
+ taskReload: false,
3
4
  taskReloadStop: jest.fn(),
4
5
  taskReloadStart: jest.fn(),
5
- refetchTaskDetails: jest.fn(),
6
- fetchTaskDetails: jest.fn(),
7
6
  taskProgressToggle: jest.fn(),
7
+ status: 'RESOLVED',
8
8
  };
@@ -4,6 +4,12 @@ import TaskDetails from '../TaskDetails';
4
4
  import { minProps } from './TaskDetails.fixtures';
5
5
 
6
6
  const fixtures = {
7
+ 'render with loading Props': { ...minProps, isLoading: true },
8
+ 'render with error Props': {
9
+ ...minProps,
10
+ status: 'ERROR',
11
+ APIerror: { message: 'some-error' },
12
+ },
7
13
  'render with min Props': minProps,
8
14
  };
9
15
 
@@ -3,33 +3,17 @@ import { API } from 'foremanReact/redux/API';
3
3
  import {
4
4
  taskReloadStop,
5
5
  taskReloadStart,
6
- fetchTaskDetails,
7
6
  cancelStep,
8
7
  } from '../TaskDetailsActions';
9
8
 
10
9
  jest.mock('foremanReact/redux/API');
11
10
 
12
- API.get.mockImplementation(async () => ({ data: 'some-data' }));
13
11
  API.post.mockImplementation(async () => ({ data: 'some-data' }));
14
12
 
15
13
  const fixtures = {
16
14
  'should start reload': () => taskReloadStart(1),
17
- 'should stop reload': () => taskReloadStop(2),
18
- 'should fetch-task-details and success': () => fetchTaskDetails(),
19
- 'should cancelStep and success': () => cancelStep('task-id', 'step-id'),
20
-
21
- 'should fetch-task-details and fail': () => {
22
- API.get.mockImplementationOnce(() =>
23
- Promise.reject(new Error('Network Error'))
24
- );
25
- return fetchTaskDetails();
26
- },
27
- 'should cancelStep and fail': () => {
28
- API.post.mockImplementationOnce(() =>
29
- Promise.reject(new Error('Network Error'))
30
- );
31
- return cancelStep('task-id', 'step-id');
32
- },
15
+ 'should stop reload': () => taskReloadStop(),
16
+ 'should cancelStep': () => cancelStep('task-id', 'step-id'),
33
17
  };
34
18
 
35
19
  describe('TaskDetails - Actions', () =>
@@ -1,5 +1,79 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`TaskDetails rendering render with error Props 1`] = `
4
+ <MessageBox
5
+ icontype="error-circle-o"
6
+ key="task-details-error"
7
+ msg="Could not receive data: some-error"
8
+ />
9
+ `;
10
+
11
+ exports[`TaskDetails rendering render with loading Props 1`] = `
12
+ <div
13
+ className="task-details-react well"
14
+ >
15
+ <ForwardRef
16
+ animation={false}
17
+ defaultActiveKey={1}
18
+ id="task-details-tabs"
19
+ >
20
+ <Tab
21
+ eventKey={1}
22
+ title="Task"
23
+ >
24
+ <TaskSkeleton />
25
+ </Tab>
26
+ <Tab
27
+ disabled={true}
28
+ eventKey={2}
29
+ title="Running Steps"
30
+ >
31
+ <RunningSteps
32
+ cancelStep={[MockFunction]}
33
+ id="a15dd820-32f1-4ced-9ab7-c0fab8234c47"
34
+ runningSteps={Array []}
35
+ taskReload={false}
36
+ taskReloadStart={[MockFunction]}
37
+ />
38
+ </Tab>
39
+ <Tab
40
+ disabled={true}
41
+ eventKey={3}
42
+ title="Errors"
43
+ >
44
+ <Errors
45
+ executionPlan={Object {}}
46
+ failedSteps={Array []}
47
+ />
48
+ </Tab>
49
+ <Tab
50
+ disabled={true}
51
+ eventKey={4}
52
+ title="Locks"
53
+ >
54
+ <Locks
55
+ locks={Array []}
56
+ />
57
+ </Tab>
58
+ <Tab
59
+ disabled={true}
60
+ eventKey={5}
61
+ title="Raw"
62
+ >
63
+ <Raw
64
+ endedAt=""
65
+ externalId=""
66
+ id="a15dd820-32f1-4ced-9ab7-c0fab8234c47"
67
+ input={Array []}
68
+ label=""
69
+ output={Object {}}
70
+ startedAt=""
71
+ />
72
+ </Tab>
73
+ </ForwardRef>
74
+ </div>
75
+ `;
76
+
3
77
  exports[`TaskDetails rendering render with min Props 1`] = `
4
78
  <div
5
79
  className="task-details-react well"
@@ -16,55 +90,31 @@ exports[`TaskDetails rendering render with min Props 1`] = `
16
90
  <Task
17
91
  action=""
18
92
  canEdit={false}
19
- cancelStep={[MockFunction]}
20
93
  cancelTaskRequest={[Function]}
21
94
  cancellable={false}
22
95
  dynflowEnableConsole={false}
23
96
  endedAt=""
24
- error={Array []}
25
- executionPlan={Object {}}
97
+ errors={Array []}
26
98
  externalId=""
27
- failedSteps={Array []}
28
- fetchTaskDetails={
29
- [MockFunction] {
30
- "calls": Array [
31
- Array [
32
- "a15dd820-32f1-4ced-9ab7-c0fab8234c47",
33
- null,
34
- [MockFunction],
35
- ],
36
- ],
37
- "results": Array [
38
- Object {
39
- "type": "return",
40
- "value": undefined,
41
- },
42
- ],
43
- }
44
- }
45
99
  hasSubTasks={false}
46
100
  help=""
47
101
  id="a15dd820-32f1-4ced-9ab7-c0fab8234c47"
48
102
  input={Array []}
49
103
  label=""
50
- locks={Array []}
51
104
  output={Object {}}
52
105
  parentTask=""
53
106
  progress={0}
54
- refetchTaskDetails={[MockFunction]}
55
107
  result="error"
56
108
  resumable={false}
57
109
  resumeTaskRequest={[Function]}
58
- runningSteps={Array []}
59
110
  startAt=""
60
111
  startBefore=""
61
112
  startedAt=""
62
113
  state=""
114
+ status="RESOLVED"
63
115
  taskProgressToggle={[Function]}
64
116
  taskReload={false}
65
117
  taskReloadStart={[MockFunction]}
66
- taskReloadStop={[MockFunction]}
67
- timeoutId={null}
68
118
  username=""
69
119
  usernamePath=""
70
120
  />
@@ -77,8 +127,8 @@ exports[`TaskDetails rendering render with min Props 1`] = `
77
127
  cancelStep={[MockFunction]}
78
128
  id="a15dd820-32f1-4ced-9ab7-c0fab8234c47"
79
129
  runningSteps={Array []}
80
- taskProgressToggle={[Function]}
81
130
  taskReload={false}
131
+ taskReloadStart={[MockFunction]}
82
132
  />
83
133
  </Tab>
84
134
  <Tab
@@ -1,12 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`TaskDetails - Actions should cancelStep and fail 1`] = `
3
+ exports[`TaskDetails - Actions should cancelStep 1`] = `
4
4
  Array [
5
- Array [
6
- Object {
7
- "type": "TASK_STEP_CANCEL_REQUEST",
8
- },
9
- ],
10
5
  Array [
11
6
  Object {
12
7
  "payload": Object {
@@ -20,115 +15,33 @@ Array [
20
15
  ],
21
16
  Array [
22
17
  Object {
23
- "payload": [Error: Network Error],
24
- "type": "TASK_STEP_CANCEL_FAILURE",
25
- },
26
- ],
27
- Array [
28
- Object {
29
- "payload": Object {
30
- "message": Object {
31
- "message": "Could not cancel step. Error: step-id undefined",
32
- "type": "error",
33
- },
34
- },
35
- "type": "TOASTS_ADD",
18
+ "handleError": [Function],
19
+ "handleSuccess": [Function],
20
+ "key": "TASK_STEP_CANCEL",
21
+ "type": "post-some-type",
22
+ "url": "foreman/foreman_tasks/tasks/task-id/cancel_step?step_id=step-id",
36
23
  },
37
24
  ],
38
25
  ]
39
26
  `;
40
27
 
41
- exports[`TaskDetails - Actions should cancelStep and success 1`] = `
42
- Array [
43
- Array [
44
- Object {
45
- "type": "TASK_STEP_CANCEL_REQUEST",
46
- },
47
- ],
48
- Array [
49
- Object {
50
- "payload": Object {
51
- "message": Object {
52
- "message": "Trying to cancel step step-id",
53
- "type": "info",
54
- },
55
- },
56
- "type": "TOASTS_ADD",
57
- },
58
- ],
59
- Array [
60
- Object {
61
- "type": "TASK_STEP_CANCEL_SUCCESS",
62
- },
63
- ],
64
- Array [
65
- Object {
66
- "payload": Object {
67
- "message": Object {
68
- "message": "step-id {__('Step Canceled')}",
69
- "type": "success",
70
- },
71
- },
72
- "type": "TOASTS_ADD",
73
- },
74
- ],
75
- ]
76
- `;
77
-
78
- exports[`TaskDetails - Actions should fetch-task-details and fail 1`] = `
79
- Array [
80
- Array [
81
- Object {
82
- "type": "FOREMAN_TASK_DETAILS_FETCH_TASK_REQUEST",
83
- },
84
- ],
85
- Array [
86
- Object {
87
- "payload": [Error: Network Error],
88
- "type": "FOREMAN_TASK_DETAILS_FETCH_TASK_FAILURE",
89
- },
90
- ],
91
- ]
92
- `;
93
-
94
- exports[`TaskDetails - Actions should fetch-task-details and success 1`] = `
28
+ exports[`TaskDetails - Actions should start reload 1`] = `
95
29
  Array [
96
30
  Array [
97
31
  Object {
98
- "type": "FOREMAN_TASK_DETAILS_FETCH_TASK_REQUEST",
99
- },
100
- ],
101
- Array [
102
- Object {
103
- "payload": "some-data",
104
- "type": "FOREMAN_TASK_DETAILS_FETCH_TASK_SUCCESS",
105
- },
106
- ],
107
- Array [
108
- Object {
109
- "payload": Object {
110
- "timeoutId": 7,
111
- },
112
- "type": "FOREMAN_TASK_DETAILS_START_POLLING",
32
+ "handleError": [Function],
33
+ "handleSuccess": [Function],
34
+ "interval": 5000,
35
+ "key": "FOREMAN_TASK_DETAILS",
36
+ "type": "get-some-type",
37
+ "url": "foreman/foreman_tasks/api/tasks/1/details?include_permissions",
113
38
  },
114
39
  ],
115
40
  ]
116
41
  `;
117
42
 
118
- exports[`TaskDetails - Actions should start reload 1`] = `
119
- Object {
120
- "payload": Object {
121
- "timeoutId": 1,
122
- },
123
- "type": "FOREMAN_TASK_DETAILS_START_POLLING",
124
- }
125
- `;
126
-
127
43
  exports[`TaskDetails - Actions should stop reload 1`] = `
128
44
  Object {
129
- "payload": Object {
130
- "timeoutId": 2,
131
- },
132
- "type": "FOREMAN_TASK_DETAILS_STOP_POLLING",
45
+ "type": "stop",
133
46
  }
134
47
  `;