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.
- checksums.yaml +4 -4
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +29 -1
- data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
- data/app/models/foreman_tasks/task.rb +4 -0
- data/app/models/setting/foreman_tasks.rb +1 -1
- data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
- data/app/views/foreman_tasks/api/tasks/details.json.rabl +0 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20200517215015_rename_bookmarks_controller.rb +35 -0
- data/db/migrate/20200519093217_drop_dynflow_allow_dangerous_actions_setting.foreman_tasks.rb +5 -0
- data/db/seeds.d/30-notification_blueprints.rb +7 -0
- data/lib/foreman_tasks/engine.rb +1 -1
- data/lib/foreman_tasks/tasks/cleanup.rake +2 -2
- data/lib/foreman_tasks/tasks/export_tasks.rake +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +1 -1
- data/locale/en/foreman_tasks.po +227 -41
- data/locale/foreman_tasks.pot +579 -288
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
- data/webpack/ForemanTasks/Components/{TasksTable/TasksTableActionHelpers.js → TaskActions/TaskActionHelpers.js} +21 -6
- data/webpack/ForemanTasks/Components/{TasksTable/__tests__/TasksTableActionHelpers.test.js → TaskActions/TaskActionHelpers.test.js} +2 -2
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionsConstants.js +16 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/UnlockModals.test.js +14 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/TaskAction.test.js.snap +233 -0
- data/webpack/ForemanTasks/Components/TaskActions/__snapshots__/UnlockModals.test.js.snap +25 -0
- data/webpack/ForemanTasks/Components/TaskActions/index.js +115 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +130 -152
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +67 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +101 -70
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +0 -15
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +0 -5
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +0 -9
- data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +5 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +2 -7
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +4 -0
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +4 -8
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionSelectButton.js +14 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModal.js +83 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalActions.js +106 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalReducer.js +38 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +45 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModal.test.js +36 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalActions.test.js +205 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalReducer.test.js +27 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +54 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModal.test.js.snap +41 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalReducer.test.js.snap +19 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +30 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +1 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +113 -30
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +13 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +23 -63
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -12
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +24 -94
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +7 -4
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +35 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +2 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +22 -26
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +2 -14
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +107 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +2 -14
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +17 -124
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +24 -128
- data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +47 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +61 -14
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +80 -21
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.scss +9 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/ClickConfirmation.test.js +44 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/__snapshots__/ClickConfirmation.test.js.snap +52 -0
- data/webpack/ForemanTasks/Components/common/ClickConfirmation/index.js +59 -66
- data/webpack/ForemanTasks/Components/common/{ToastTypesConstants.js → ToastsHelpers/ToastTypesConstants.js} +0 -0
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +2 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +2 -2
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +17 -3
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- metadata +32 -22
- data/db/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +0 -9
- data/lib/foreman_tasks/tasks/dynflow.rake +0 -6
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelConfirm.js +0 -53
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmationModals.js +0 -56
- data/webpack/ForemanTasks/Components/TasksTable/Components/ResumeConfirm.js +0 -52
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ConfirmationModals.test.js +0 -24
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ResumeConfirm.test.js +0 -26
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelConfirm.test.js.snap +0 -65
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ConfirmationModals.test.js.snap +0 -30
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ResumeConfirm.test.js.snap +0 -63
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -26
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/ResumeButton.test.js +0 -27
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/CancelButton.test.js.snap +0 -15
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ResumeButton.test.js.snap +0 -15
@@ -0,0 +1,60 @@
|
|
1
|
+
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
+
import API from 'foremanReact/API';
|
3
|
+
import {
|
4
|
+
cancelTaskRequest,
|
5
|
+
resumeTaskRequest,
|
6
|
+
forceCancelTaskRequest,
|
7
|
+
unlockTaskRequest,
|
8
|
+
} from './';
|
9
|
+
|
10
|
+
jest.mock('foremanReact/components/common/table', () => ({
|
11
|
+
getTableItemsAction: jest.fn(controller => controller),
|
12
|
+
}));
|
13
|
+
|
14
|
+
jest.mock('foremanReact/API');
|
15
|
+
|
16
|
+
const task = ['some-id', 'some-name'];
|
17
|
+
|
18
|
+
const fixtures = {
|
19
|
+
'should cancelTaskRequest and succeed': () => cancelTaskRequest(...task),
|
20
|
+
'should cancelTaskRequest and fail': () => {
|
21
|
+
API.post.mockImplementation(() =>
|
22
|
+
Promise.reject(new Error('Network Error'))
|
23
|
+
);
|
24
|
+
return cancelTaskRequest(...task);
|
25
|
+
},
|
26
|
+
|
27
|
+
'should resumeTaskRequest and succeed': () => {
|
28
|
+
API.post.mockImplementation(() => ({ data: 'some-data' }));
|
29
|
+
return resumeTaskRequest(...task);
|
30
|
+
},
|
31
|
+
'should resumeTaskRequest and fail': () => {
|
32
|
+
API.post.mockImplementation(() =>
|
33
|
+
Promise.reject(new Error('Network Error'))
|
34
|
+
);
|
35
|
+
return resumeTaskRequest(...task);
|
36
|
+
},
|
37
|
+
'should forceCancelTaskRequest and succeed': () => {
|
38
|
+
API.post.mockImplementation(() => ({ data: 'some-data' }));
|
39
|
+
return forceCancelTaskRequest(...task);
|
40
|
+
},
|
41
|
+
'should forceCancelTaskRequest and fail': () => {
|
42
|
+
API.post.mockImplementation(() =>
|
43
|
+
Promise.reject(new Error('Network Error'))
|
44
|
+
);
|
45
|
+
return forceCancelTaskRequest(...task);
|
46
|
+
},
|
47
|
+
'should unlockTaskRequest and succeed': () => {
|
48
|
+
API.post.mockImplementation(() => ({ data: 'some-data' }));
|
49
|
+
return unlockTaskRequest(...task);
|
50
|
+
},
|
51
|
+
'should unlockTaskRequest and fail': () => {
|
52
|
+
API.post.mockImplementation(() =>
|
53
|
+
Promise.reject(new Error('Network Error'))
|
54
|
+
);
|
55
|
+
return forceCancelTaskRequest(...task);
|
56
|
+
},
|
57
|
+
};
|
58
|
+
describe('Tasks actions', () => {
|
59
|
+
testActionSnapshotWithFixtures(fixtures);
|
60
|
+
});
|
@@ -2,6 +2,11 @@ import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
|
2
2
|
import { addToast } from 'foremanReact/redux/actions/toasts';
|
3
3
|
import { TASKS_DASHBOARD_JS_QUERY_MODES } from '../TasksDashboard/TasksDashboardConstants';
|
4
4
|
import { timeToHoursNumber } from '../TasksDashboard/TasksDashboardHelper';
|
5
|
+
import {
|
6
|
+
successToastData,
|
7
|
+
errorToastData,
|
8
|
+
warningToastData,
|
9
|
+
} from '../common/ToastsHelpers';
|
5
10
|
|
6
11
|
export const convertDashboardQuery = query => {
|
7
12
|
const {
|
@@ -29,14 +34,24 @@ export const convertDashboardQuery = query => {
|
|
29
34
|
};
|
30
35
|
|
31
36
|
export const resumeToastInfo = {
|
32
|
-
resumed:
|
33
|
-
failed:
|
34
|
-
skipped:
|
37
|
+
resumed: successToastData(__('was resumed')),
|
38
|
+
failed: errorToastData(__('could not be resumed')),
|
39
|
+
skipped: warningToastData(__('task has to be resumable')),
|
35
40
|
};
|
36
41
|
|
37
42
|
export const cancelToastInfo = {
|
38
|
-
cancelled:
|
39
|
-
skipped:
|
43
|
+
cancelled: successToastData(__('was cancelled')),
|
44
|
+
skipped: warningToastData(__('task has to be cancellable')),
|
45
|
+
};
|
46
|
+
|
47
|
+
export const forceCancelToastInfo = {
|
48
|
+
forceCancelled: successToastData(__('resources were unlocked with force.')),
|
49
|
+
failed: warningToastData(__('cannot be cancelled with force at the moment.')),
|
50
|
+
};
|
51
|
+
|
52
|
+
export const unlockToastInfo = {
|
53
|
+
unlocked: successToastData(__('resources were unlocked ')),
|
54
|
+
failed: warningToastData(__('resources cannot be unlocked at the moment.')),
|
40
55
|
};
|
41
56
|
|
42
57
|
export const toastDispatch = ({ type, name, toastInfo, dispatch }) => {
|
@@ -45,7 +60,7 @@ export const toastDispatch = ({ type, name, toastInfo, dispatch }) => {
|
|
45
60
|
type: toastInfo[type].type,
|
46
61
|
message: sprintf('%(name)s Task execution %(type)s', {
|
47
62
|
name,
|
48
|
-
type: toastInfo[type].
|
63
|
+
type: toastInfo[type].message,
|
49
64
|
}),
|
50
65
|
})
|
51
66
|
);
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { convertDashboardQuery } from '
|
1
|
+
import { convertDashboardQuery } from './TaskActionHelpers';
|
2
2
|
import {
|
3
3
|
TASKS_DASHBOARD_JS_QUERY_MODES,
|
4
4
|
TASKS_DASHBOARD_AVAILABLE_TIMES,
|
5
|
-
} from '
|
5
|
+
} from '../TasksDashboard/TasksDashboardConstants';
|
6
6
|
|
7
7
|
let realDate;
|
8
8
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const UNLOCK_MODAL = 'unlockModal';
|
2
|
+
export const FORCE_UNLOCK_MODAL = 'forceUnlockModal';
|
3
|
+
|
4
|
+
export const TASKS_RESUME_REQUEST = 'TASKS_RESUME_REQUEST';
|
5
|
+
export const TASKS_RESUME_SUCCESS = 'TASKS_RESUME_SUCCESS';
|
6
|
+
export const TASKS_RESUME_FAILURE = 'TASKS_RESUME_FAILURE';
|
7
|
+
export const TASKS_CANCEL_REQUEST = 'TASKS_CANCEL_REQUEST';
|
8
|
+
export const TASKS_CANCEL_SUCCESS = 'TASKS_CANCEL_SUCCESS';
|
9
|
+
export const TASKS_CANCEL_FAILURE = 'TASKS_CANCEL_FAILURE';
|
10
|
+
|
11
|
+
export const TASKS_FORCE_CANCEL_REQUEST = 'TASKS_FORCE_CANCEL_REQUEST';
|
12
|
+
export const TASKS_FORCE_CANCEL_SUCCESS = 'TASKS_FORCE_CANCEL_SUCCESS';
|
13
|
+
export const TASKS_FORCE_CANCEL_FAILURE = 'TASKS_FORCE_CANCEL_FAILURE';
|
14
|
+
export const TASKS_UNLOCK_REQUEST = 'TASKS_UNLOCK_REQUEST';
|
15
|
+
export const TASKS_UNLOCK_SUCCESS = 'TASKS_UNLOCK_SUCCESS';
|
16
|
+
export const TASKS_UNLOCK_FAILURE = 'TASKS_UNLOCK_FAILURE';
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
4
|
+
import { ClickConfirmation } from '../common/ClickConfirmation';
|
5
|
+
import { UNLOCK_MODAL, FORCE_UNLOCK_MODAL } from './TaskActionsConstants';
|
6
|
+
|
7
|
+
const confirmationMessage = __(
|
8
|
+
'I understand that this may cause harm and have working database backups of all backend services.'
|
9
|
+
);
|
10
|
+
|
11
|
+
export const UnlockModal = ({ onClick, id }) => (
|
12
|
+
<ClickConfirmation
|
13
|
+
id={id}
|
14
|
+
title={__('Unlock')}
|
15
|
+
body={__(
|
16
|
+
"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."
|
17
|
+
)}
|
18
|
+
confirmationMessage={confirmationMessage}
|
19
|
+
confirmAction={__('Unlock')}
|
20
|
+
onClick={onClick}
|
21
|
+
confirmType="warning"
|
22
|
+
/>
|
23
|
+
);
|
24
|
+
|
25
|
+
export const ForceUnlockModal = ({ onClick, id, selectedRowsLen }) => (
|
26
|
+
<ClickConfirmation
|
27
|
+
id={id}
|
28
|
+
title={__('Force Unlock')}
|
29
|
+
body={sprintf(
|
30
|
+
__(
|
31
|
+
`Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck.`
|
32
|
+
),
|
33
|
+
selectedRowsLen
|
34
|
+
)}
|
35
|
+
confirmationMessage={confirmationMessage}
|
36
|
+
confirmAction={__('Force Unlock')}
|
37
|
+
onClick={onClick}
|
38
|
+
confirmType="danger"
|
39
|
+
/>
|
40
|
+
);
|
41
|
+
|
42
|
+
UnlockModal.propTypes = {
|
43
|
+
onClick: PropTypes.func.isRequired,
|
44
|
+
id: PropTypes.string,
|
45
|
+
};
|
46
|
+
|
47
|
+
ForceUnlockModal.propTypes = {
|
48
|
+
onClick: PropTypes.func.isRequired,
|
49
|
+
id: PropTypes.string,
|
50
|
+
selectedRowsLen: PropTypes.number,
|
51
|
+
};
|
52
|
+
|
53
|
+
UnlockModal.defaultProps = {
|
54
|
+
id: UNLOCK_MODAL,
|
55
|
+
};
|
56
|
+
|
57
|
+
ForceUnlockModal.defaultProps = {
|
58
|
+
id: FORCE_UNLOCK_MODAL,
|
59
|
+
selectedRowsLen: 1,
|
60
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
|
+
|
3
|
+
import { UnlockModal, ForceUnlockModal } from './UnlockModals';
|
4
|
+
|
5
|
+
const fixtures = {
|
6
|
+
render: { taskID: 'some-id', onClick: jest.fn() },
|
7
|
+
};
|
8
|
+
|
9
|
+
describe('UnlockModal', () => {
|
10
|
+
testComponentSnapshotsWithFixtures(UnlockModal, fixtures);
|
11
|
+
});
|
12
|
+
describe('ForceUnlockModal', () => {
|
13
|
+
testComponentSnapshotsWithFixtures(ForceUnlockModal, fixtures);
|
14
|
+
});
|
@@ -0,0 +1,233 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Tasks 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": [Error: Network Error],
|
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[`Tasks 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[`Tasks actions should forceCancelTaskRequest and fail 1`] = `
|
79
|
+
Array [
|
80
|
+
Array [
|
81
|
+
Object {
|
82
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
83
|
+
},
|
84
|
+
],
|
85
|
+
Array [
|
86
|
+
Object {
|
87
|
+
"type": "TASKS_FORCE_CANCEL_FAILURE",
|
88
|
+
},
|
89
|
+
],
|
90
|
+
Array [
|
91
|
+
Object {
|
92
|
+
"payload": Object {
|
93
|
+
"message": Object {
|
94
|
+
"message": "some-name Task execution cannot be cancelled with force at the moment.",
|
95
|
+
"type": "warning",
|
96
|
+
},
|
97
|
+
},
|
98
|
+
"type": "TOASTS_ADD",
|
99
|
+
},
|
100
|
+
],
|
101
|
+
]
|
102
|
+
`;
|
103
|
+
|
104
|
+
exports[`Tasks actions should forceCancelTaskRequest and succeed 1`] = `
|
105
|
+
Array [
|
106
|
+
Array [
|
107
|
+
Object {
|
108
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
109
|
+
},
|
110
|
+
],
|
111
|
+
Array [
|
112
|
+
Object {
|
113
|
+
"type": "TASKS_FORCE_CANCEL_SUCCESS",
|
114
|
+
},
|
115
|
+
],
|
116
|
+
Array [
|
117
|
+
Object {
|
118
|
+
"payload": Object {
|
119
|
+
"message": Object {
|
120
|
+
"message": "some-name Task execution resources were unlocked with force.",
|
121
|
+
"type": "success",
|
122
|
+
},
|
123
|
+
},
|
124
|
+
"type": "TOASTS_ADD",
|
125
|
+
},
|
126
|
+
],
|
127
|
+
]
|
128
|
+
`;
|
129
|
+
|
130
|
+
exports[`Tasks actions should resumeTaskRequest and fail 1`] = `
|
131
|
+
Array [
|
132
|
+
Array [
|
133
|
+
Object {
|
134
|
+
"type": "TASKS_RESUME_REQUEST",
|
135
|
+
},
|
136
|
+
],
|
137
|
+
Array [
|
138
|
+
Object {
|
139
|
+
"payload": [Error: Network Error],
|
140
|
+
"type": "TASKS_RESUME_FAILURE",
|
141
|
+
},
|
142
|
+
],
|
143
|
+
Array [
|
144
|
+
Object {
|
145
|
+
"payload": Object {
|
146
|
+
"message": Object {
|
147
|
+
"message": "some-name Task execution could not be resumed",
|
148
|
+
"type": "error",
|
149
|
+
},
|
150
|
+
},
|
151
|
+
"type": "TOASTS_ADD",
|
152
|
+
},
|
153
|
+
],
|
154
|
+
]
|
155
|
+
`;
|
156
|
+
|
157
|
+
exports[`Tasks actions should resumeTaskRequest and succeed 1`] = `
|
158
|
+
Array [
|
159
|
+
Array [
|
160
|
+
Object {
|
161
|
+
"type": "TASKS_RESUME_REQUEST",
|
162
|
+
},
|
163
|
+
],
|
164
|
+
Array [
|
165
|
+
Object {
|
166
|
+
"type": "TASKS_RESUME_SUCCESS",
|
167
|
+
},
|
168
|
+
],
|
169
|
+
Array [
|
170
|
+
Object {
|
171
|
+
"payload": Object {
|
172
|
+
"message": Object {
|
173
|
+
"message": "some-name Task execution was resumed",
|
174
|
+
"type": "success",
|
175
|
+
},
|
176
|
+
},
|
177
|
+
"type": "TOASTS_ADD",
|
178
|
+
},
|
179
|
+
],
|
180
|
+
]
|
181
|
+
`;
|
182
|
+
|
183
|
+
exports[`Tasks actions should unlockTaskRequest and fail 1`] = `
|
184
|
+
Array [
|
185
|
+
Array [
|
186
|
+
Object {
|
187
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
188
|
+
},
|
189
|
+
],
|
190
|
+
Array [
|
191
|
+
Object {
|
192
|
+
"type": "TASKS_FORCE_CANCEL_FAILURE",
|
193
|
+
},
|
194
|
+
],
|
195
|
+
Array [
|
196
|
+
Object {
|
197
|
+
"payload": Object {
|
198
|
+
"message": Object {
|
199
|
+
"message": "some-name Task execution cannot be cancelled with force at the moment.",
|
200
|
+
"type": "warning",
|
201
|
+
},
|
202
|
+
},
|
203
|
+
"type": "TOASTS_ADD",
|
204
|
+
},
|
205
|
+
],
|
206
|
+
]
|
207
|
+
`;
|
208
|
+
|
209
|
+
exports[`Tasks actions should unlockTaskRequest and succeed 1`] = `
|
210
|
+
Array [
|
211
|
+
Array [
|
212
|
+
Object {
|
213
|
+
"type": "TASKS_UNLOCK_REQUEST",
|
214
|
+
},
|
215
|
+
],
|
216
|
+
Array [
|
217
|
+
Object {
|
218
|
+
"type": "TASKS_UNLOCK_SUCCESS",
|
219
|
+
},
|
220
|
+
],
|
221
|
+
Array [
|
222
|
+
Object {
|
223
|
+
"payload": Object {
|
224
|
+
"message": Object {
|
225
|
+
"message": "some-name Task execution resources were unlocked ",
|
226
|
+
"type": "success",
|
227
|
+
},
|
228
|
+
},
|
229
|
+
"type": "TOASTS_ADD",
|
230
|
+
},
|
231
|
+
],
|
232
|
+
]
|
233
|
+
`;
|