foreman-tasks 1.1.2 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +2 -0
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +33 -1
- data/app/controllers/foreman_tasks/tasks_controller.rb +9 -14
- data/app/lib/actions/proxy_action.rb +1 -1
- data/app/models/foreman_tasks/task.rb +4 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +3 -1
- 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/app/views/foreman_tasks/api/tasks/show.json.rabl +2 -0
- 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/migrate/20200611090846_add_task_lock_index_on_resource_type_and_task_id.rb +3 -3
- data/db/seeds.d/30-notification_blueprints.rb +7 -0
- data/lib/foreman_tasks/engine.rb +2 -7
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +1 -1
- data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/en/foreman_tasks.po +270 -54
- data/locale/foreman_tasks.pot +630 -292
- data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/fr/foreman_tasks.po +817 -0
- data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ja/foreman_tasks.po +817 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/zh_CN/foreman_tasks.po +816 -0
- data/package.json +1 -0
- data/script/npm_link_foreman_js.sh +26 -0
- 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/RunningSteps.js +17 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +149 -167
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +8 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +68 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +0 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/RunningSteps.test.js.snap +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +124 -76
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +35 -5
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.scss +3 -14
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +40 -16
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -4
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -6
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +4 -10
- data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +8 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +7 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +18 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +30 -13
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +91 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +13 -4
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardActions.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +2 -2
- 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 +46 -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 +55 -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 +32 -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 +135 -35
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +13 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +26 -66
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -12
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +30 -96
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +8 -4
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +50 -2
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +3 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +22 -26
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +2 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +3 -14
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +155 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +3 -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 +63 -133
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionCellFormatter.test.js.snap +1 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionCellFormatter.test.js.snap +2 -0
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionCellFormatter.js +10 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionCellFormatter.js +7 -0
- data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +55 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +75 -19
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +88 -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
- data/webpack/__mocks__/foremanReact/{API.js → redux/API.js} +1 -1
- metadata +41 -21
- 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
@@ -1,21 +1,24 @@
|
|
1
1
|
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
|
-
import API from 'foremanReact/API';
|
2
|
+
import { API } from 'foremanReact/redux/API';
|
3
3
|
import {
|
4
4
|
bulkCancelById,
|
5
5
|
bulkCancelBySearch,
|
6
6
|
bulkResumeById,
|
7
7
|
bulkResumeBySearch,
|
8
|
+
bulkForceCancelById,
|
9
|
+
bulkForceCancelBySearch,
|
8
10
|
} from '../TasksBulkActions';
|
9
11
|
|
10
12
|
jest.mock('foremanReact/components/common/table', () => ({
|
11
13
|
getTableItemsAction: jest.fn(controller => controller),
|
12
14
|
}));
|
13
15
|
|
14
|
-
jest.mock('foremanReact/API');
|
16
|
+
jest.mock('foremanReact/redux/API');
|
15
17
|
|
16
18
|
const task = {
|
17
19
|
id: 'some-id',
|
18
20
|
name: 'some-name',
|
21
|
+
canEdit: true,
|
19
22
|
};
|
20
23
|
|
21
24
|
const fixtures = {
|
@@ -68,6 +71,28 @@ const fixtures = {
|
|
68
71
|
}));
|
69
72
|
return bulkCancelById({ selected, url: 'some-url' });
|
70
73
|
},
|
74
|
+
|
75
|
+
'handles bulkForceCancelById requests': () => {
|
76
|
+
const selected = [{ ...task, isCancellable: true }];
|
77
|
+
|
78
|
+
API.post.mockImplementation(() => ({
|
79
|
+
data: {
|
80
|
+
stopped_length: 2,
|
81
|
+
skipped_length: 4,
|
82
|
+
},
|
83
|
+
}));
|
84
|
+
return bulkForceCancelById({ selected, url: 'some-url' });
|
85
|
+
},
|
86
|
+
|
87
|
+
'handles bulkForceCancelById requests that fail': () => {
|
88
|
+
const selected = [{ ...task, isResumable: true }];
|
89
|
+
|
90
|
+
API.post.mockImplementation(() =>
|
91
|
+
Promise.reject(new Error('Network Error'))
|
92
|
+
);
|
93
|
+
return bulkForceCancelById({ selected, url: 'some-url' });
|
94
|
+
},
|
95
|
+
|
71
96
|
'handles bulkCancelById requests that are not cancellable': () => {
|
72
97
|
const selected = [{ ...task, isCancellable: false }];
|
73
98
|
return bulkCancelById({ selected, url: 'some-url' });
|
@@ -77,6 +102,11 @@ const fixtures = {
|
|
77
102
|
return bulkResumeById({ selected, url: 'some-url' });
|
78
103
|
},
|
79
104
|
|
105
|
+
'handles bulkForceCancelById requests that are stopped': () => {
|
106
|
+
const selected = [{ ...task, isResumable: false, state: 'stopped' }];
|
107
|
+
return bulkForceCancelById({ selected, url: 'some-url' });
|
108
|
+
},
|
109
|
+
|
80
110
|
'handles bulkCancelBySearch requests': () => {
|
81
111
|
API.post.mockImplementation(() => ({
|
82
112
|
data: {
|
@@ -105,6 +135,24 @@ const fixtures = {
|
|
105
135
|
parentTaskID: 'parent',
|
106
136
|
});
|
107
137
|
},
|
138
|
+
'handles bulkForceCancelBySearch requests': () =>
|
139
|
+
bulkForceCancelBySearch({
|
140
|
+
query: { search: {} },
|
141
|
+
url: 'some-url',
|
142
|
+
parentTaskID: 'parent',
|
143
|
+
}),
|
144
|
+
'handles bulkCancelById requests with canEdit false': () => {
|
145
|
+
const selected = [{ ...task, isCancellable: true, canEdit: false }];
|
146
|
+
return bulkCancelById({ selected, url: 'some-url' });
|
147
|
+
},
|
148
|
+
'handles bulkResumeById requests with canEdit false': () => {
|
149
|
+
const selected = [{ ...task, isResumable: false, canEdit: false }];
|
150
|
+
return bulkResumeById({ selected, url: 'some-url' });
|
151
|
+
},
|
152
|
+
'handles bulkForceCancelById requests with canEdit false': () => {
|
153
|
+
const selected = [{ ...task, isResumable: false, canEdit: false }];
|
154
|
+
return bulkForceCancelById({ selected, url: 'some-url' });
|
155
|
+
},
|
108
156
|
};
|
109
157
|
|
110
158
|
describe('TasksTable bulk actions', () => {
|
@@ -4,17 +4,12 @@ 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(),
|
16
10
|
selectRow: jest.fn(),
|
17
11
|
unselectRow: jest.fn(),
|
12
|
+
reloadPage: jest.fn(),
|
18
13
|
selectedRows: [],
|
19
14
|
pagination: {
|
20
15
|
page: 1,
|
@@ -27,12 +22,8 @@ export const minProps = {
|
|
27
22
|
order: 'w',
|
28
23
|
},
|
29
24
|
openClickedModal: jest.fn(),
|
30
|
-
|
31
|
-
|
32
|
-
resumeSelectedModal: {},
|
33
|
-
cancelModal: {},
|
34
|
-
resumeModal: {},
|
35
|
-
},
|
25
|
+
openModalAction: jest.fn(),
|
26
|
+
openModal: jest.fn(),
|
36
27
|
};
|
37
28
|
|
38
29
|
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
|
-
|
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
|
});
|
@@ -12,9 +12,10 @@ const history = {
|
|
12
12
|
const fixtures = {
|
13
13
|
'render with minimal props': { ...minProps, history },
|
14
14
|
|
15
|
-
'render with Breadcrubs': {
|
15
|
+
'render with Breadcrubs and edit permissions': {
|
16
16
|
...minProps,
|
17
17
|
history,
|
18
|
+
results: [{ action: 'a', canEdit: true }],
|
18
19
|
getBreadcrumbs: () => ({
|
19
20
|
breadcrumbItems: [
|
20
21
|
{ caption: 'Tasks', url: `/foreman_tasks/tasks` },
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap
CHANGED
@@ -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,
|
@@ -41,13 +30,13 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
|
|
41
30
|
}
|
42
31
|
}
|
43
32
|
parentTaskID="some-id"
|
33
|
+
reloadPage={[MockFunction]}
|
44
34
|
results={
|
45
35
|
Array [
|
46
36
|
"a",
|
47
37
|
"b",
|
48
38
|
]
|
49
39
|
}
|
50
|
-
resumeTask={[MockFunction]}
|
51
40
|
selectAllRows={[MockFunction]}
|
52
41
|
selectPage={[MockFunction]}
|
53
42
|
selectRow={[MockFunction]}
|
@@ -48,6 +48,22 @@ Array [
|
|
48
48
|
]
|
49
49
|
`;
|
50
50
|
|
51
|
+
exports[`TasksTable bulk actions handles bulkCancelById requests with canEdit false 1`] = `
|
52
|
+
Array [
|
53
|
+
Array [
|
54
|
+
Object {
|
55
|
+
"payload": Object {
|
56
|
+
"message": Object {
|
57
|
+
"message": "Not all the selected tasks can be cancelled",
|
58
|
+
"type": "warning",
|
59
|
+
},
|
60
|
+
},
|
61
|
+
"type": "TOASTS_ADD",
|
62
|
+
},
|
63
|
+
],
|
64
|
+
]
|
65
|
+
`;
|
66
|
+
|
51
67
|
exports[`TasksTable bulk actions handles bulkCancelBySearch requests 1`] = `
|
52
68
|
Array [
|
53
69
|
Array [
|
@@ -69,6 +85,129 @@ Array [
|
|
69
85
|
]
|
70
86
|
`;
|
71
87
|
|
88
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests 1`] = `
|
89
|
+
Array [
|
90
|
+
Array [
|
91
|
+
Object {
|
92
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
93
|
+
},
|
94
|
+
],
|
95
|
+
Array [
|
96
|
+
Object {
|
97
|
+
"type": "TASKS_FORCE_CANCEL_SUCCESS",
|
98
|
+
},
|
99
|
+
],
|
100
|
+
Array [
|
101
|
+
Object {
|
102
|
+
"payload": Object {
|
103
|
+
"message": Object {
|
104
|
+
"message": "2 task(s) cancelled with force",
|
105
|
+
"type": "success",
|
106
|
+
},
|
107
|
+
},
|
108
|
+
"type": "TOASTS_ADD",
|
109
|
+
},
|
110
|
+
],
|
111
|
+
Array [
|
112
|
+
Object {
|
113
|
+
"payload": Object {
|
114
|
+
"message": Object {
|
115
|
+
"message": "4 task(s) are already stopped",
|
116
|
+
"type": "warning",
|
117
|
+
},
|
118
|
+
},
|
119
|
+
"type": "TOASTS_ADD",
|
120
|
+
},
|
121
|
+
],
|
122
|
+
Array [
|
123
|
+
"TASKS_TABLE",
|
124
|
+
],
|
125
|
+
Array [
|
126
|
+
[Function],
|
127
|
+
],
|
128
|
+
]
|
129
|
+
`;
|
130
|
+
|
131
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests that are stopped 1`] = `
|
132
|
+
Array [
|
133
|
+
Array [
|
134
|
+
Object {
|
135
|
+
"payload": Object {
|
136
|
+
"message": Object {
|
137
|
+
"message": "1 task(s) are already stopped",
|
138
|
+
"type": "warning",
|
139
|
+
},
|
140
|
+
},
|
141
|
+
"type": "TOASTS_ADD",
|
142
|
+
},
|
143
|
+
],
|
144
|
+
]
|
145
|
+
`;
|
146
|
+
|
147
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests that fail 1`] = `
|
148
|
+
Array [
|
149
|
+
Array [
|
150
|
+
Object {
|
151
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
152
|
+
},
|
153
|
+
],
|
154
|
+
Array [
|
155
|
+
Object {
|
156
|
+
"error": [Error: Network Error],
|
157
|
+
"type": "TASKS_FORCE_CANCEL_FAILURE",
|
158
|
+
},
|
159
|
+
],
|
160
|
+
Array [
|
161
|
+
Object {
|
162
|
+
"payload": Object {
|
163
|
+
"message": Object {
|
164
|
+
"message": "Cannot force cancel tasks at the moment Error: Network Error",
|
165
|
+
"type": "error",
|
166
|
+
},
|
167
|
+
},
|
168
|
+
"type": "TOASTS_ADD",
|
169
|
+
},
|
170
|
+
],
|
171
|
+
]
|
172
|
+
`;
|
173
|
+
|
174
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests with canEdit false 1`] = `
|
175
|
+
Array [
|
176
|
+
Array [
|
177
|
+
Object {
|
178
|
+
"payload": Object {
|
179
|
+
"message": Object {
|
180
|
+
"message": "User has no permission for 1 task(s)",
|
181
|
+
"type": "warning",
|
182
|
+
},
|
183
|
+
},
|
184
|
+
"type": "TOASTS_ADD",
|
185
|
+
},
|
186
|
+
],
|
187
|
+
]
|
188
|
+
`;
|
189
|
+
|
190
|
+
exports[`TasksTable bulk actions handles bulkForceCancelBySearch requests 1`] = `
|
191
|
+
Array [
|
192
|
+
Array [
|
193
|
+
Object {
|
194
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
195
|
+
},
|
196
|
+
],
|
197
|
+
Array [
|
198
|
+
Object {
|
199
|
+
"payload": Object {
|
200
|
+
"message": Object {
|
201
|
+
"message": "Canceling with force selected tasks, this might take a while",
|
202
|
+
"type": "info",
|
203
|
+
},
|
204
|
+
},
|
205
|
+
"type": "TOASTS_ADD",
|
206
|
+
},
|
207
|
+
],
|
208
|
+
]
|
209
|
+
`;
|
210
|
+
|
72
211
|
exports[`TasksTable bulk actions handles bulkResumeById requests that are not resumable 1`] = `
|
73
212
|
Array [
|
74
213
|
Array [
|
@@ -112,6 +251,22 @@ Array [
|
|
112
251
|
]
|
113
252
|
`;
|
114
253
|
|
254
|
+
exports[`TasksTable bulk actions handles bulkResumeById requests with canEdit false 1`] = `
|
255
|
+
Array [
|
256
|
+
Array [
|
257
|
+
Object {
|
258
|
+
"payload": Object {
|
259
|
+
"message": Object {
|
260
|
+
"message": "Not all the selected tasks can be resumed",
|
261
|
+
"type": "warning",
|
262
|
+
},
|
263
|
+
},
|
264
|
+
"type": "TOASTS_ADD",
|
265
|
+
},
|
266
|
+
],
|
267
|
+
]
|
268
|
+
`;
|
269
|
+
|
115
270
|
exports[`TasksTable bulk actions handles bulkResumeBySearch requests 1`] = `
|
116
271
|
Array [
|
117
272
|
Array [
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap
CHANGED
@@ -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,28 +12,22 @@ 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,
|
32
21
|
"perPage": 10,
|
33
22
|
}
|
34
23
|
}
|
24
|
+
reloadPage={[MockFunction]}
|
35
25
|
results={
|
36
26
|
Array [
|
37
27
|
"a",
|
38
28
|
"b",
|
39
29
|
]
|
40
30
|
}
|
41
|
-
resumeTask={[MockFunction]}
|
42
31
|
selectAllRows={[MockFunction]}
|
43
32
|
selectPage={[MockFunction]}
|
44
33
|
selectRow={[MockFunction]}
|