foreman-tasks 0.17.6 → 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/.eslintrc +2 -22
- data/.rubocop.yml +12 -12
- data/.rubocop_todo.yml +34 -116
- data/.travis.yml +2 -2
- data/app/controllers/foreman_tasks/api/recurring_logics_controller.rb +20 -1
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +66 -11
- data/app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb +1 -1
- data/app/controllers/foreman_tasks/recurring_logics_controller.rb +19 -0
- data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +0 -2
- data/app/lib/actions/helpers/humanizer.rb +1 -3
- data/app/lib/actions/proxy_action.rb +33 -12
- data/app/lib/foreman_tasks/concerns/polling_action_extensions.rb +12 -0
- data/app/models/foreman_tasks/concerns/action_triggering.rb +1 -1
- data/app/models/foreman_tasks/recurring_logic.rb +1 -0
- data/app/models/foreman_tasks/remote_task.rb +1 -0
- data/app/models/foreman_tasks/task.rb +8 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +1 -1
- data/app/models/foreman_tasks/task/search.rb +11 -1
- data/app/models/setting/foreman_tasks.rb +7 -2
- data/app/services/ui_notifications/tasks/task_bulk_cancel.rb +36 -0
- data/app/services/ui_notifications/tasks/task_bulk_resume.rb +38 -0
- data/app/services/ui_notifications/tasks/task_bulk_stop.rb +36 -0
- data/app/views/foreman_tasks/api/recurring_logics/base.json.rabl +2 -1
- data/app/views/foreman_tasks/api/tasks/details.json.rabl +1 -1
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +1 -1
- data/app/views/foreman_tasks/recurring_logics/index.html.erb +30 -0
- data/app/views/foreman_tasks/tasks/show.html.erb +3 -0
- data/babel.config.js +3 -0
- data/config/routes.rb +8 -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 +21 -0
- data/foreman-tasks.gemspec +5 -6
- data/gemfile.d/foreman-tasks.rb +1 -0
- data/lib/foreman_tasks/dynflow/console_authorizer.rb +2 -2
- data/lib/foreman_tasks/engine.rb +17 -14
- data/lib/foreman_tasks/tasks/cleanup.rake +1 -1
- data/lib/foreman_tasks/tasks/export_tasks.rake +2 -2
- data/lib/foreman_tasks/test_extensions.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +2 -2
- data/locale/en/foreman_tasks.po +227 -41
- data/locale/foreman_tasks.pot +579 -288
- data/package.json +19 -79
- data/script/rails +2 -2
- data/script/travis_run_js_tests.sh +2 -2
- data/test/controllers/api/tasks_controller_test.rb +9 -0
- data/test/factories/task_factory.rb +34 -2
- data/test/foreman_tasks_test_helper.rb +4 -0
- data/test/lib/concerns/polling_action_extensions_test.rb +34 -0
- data/test/unit/actions/action_with_sub_plans_test.rb +1 -1
- data/test/unit/task_test.rb +160 -74
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +60 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +67 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js +46 -0
- 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 +132 -150
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +1 -4
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Errors.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Locks.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Raw.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +68 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskInfo.test.js +1 -2
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +104 -71
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +9 -15
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.stories.js +6 -2
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +2 -17
- 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 +3 -9
- data/webpack/ForemanTasks/Components/TaskDetails/TasksDetailsHelper.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +6 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +3 -7
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +5 -1
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.stories.js +44 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/PausedTasksCard/PausedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.stories.js +45 -40
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/RunningTasksCard/RunningTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.stories.js +27 -22
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/ScheduledTasksCard/ScheduledTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.stories.js +61 -56
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/StoppedTasksCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.stories.js +40 -35
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutCard/TasksDonutCard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.stories.js +21 -20
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/TasksDonutChart/TasksDonutChart.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js +40 -39
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.stories.js +16 -17
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.test.js +1 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.mdx +57 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.stories.js +36 -18
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardConstants.js +5 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboardHelper.js +3 -2
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboard.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardActions.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardReducer.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/TasksDashboardSelectors.test.js +1 -1
- 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/SelectAllAlert.js +43 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionSelectButton.test.js +2 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +29 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionSelectButton.test.js.snap +11 -0
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +75 -0
- data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +4 -1
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +247 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +50 -22
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +62 -101
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +18 -5
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +4 -3
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +65 -38
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +26 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +27 -16
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +147 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +4 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +46 -74
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +17 -1
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +10 -2
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +28 -8
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +5 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +336 -0
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +4 -7
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +22 -158
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +66 -44
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +43 -16
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/index.js +11 -4
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.js +49 -21
- 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/ToastsHelpers/ToastTypesConstants.js +11 -0
- data/webpack/ForemanTasks/Components/common/ToastsHelpers/index.js +15 -0
- data/webpack/ForemanTasks/ForemanTasks.test.js +1 -1
- data/webpack/ForemanTasks/ForemanTasksReducers.js +2 -0
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +1 -1
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +4 -4
- data/webpack/ForemanTasks/Routes/ShowTask/__tests__/ShowTask.test.js +1 -1
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +10 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +18 -0
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- metadata +71 -30
- data/.babelrc +0 -35
- data/.storybook/addons.js +0 -2
- data/.storybook/config.js +0 -7
- data/.storybook/webpack.config.js +0 -63
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/Components/TimeDropDown/TimeDropDown.stories.js +0 -23
- data/webpack/ForemanTasks/Components/TasksTable/Components/ActionConfirmation.js +0 -49
- data/webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js +0 -51
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/ActionConfirmation.test.js +0 -18
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/CancelResumeConfirm.test.js +0 -28
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/ActionConfirmation.test.js.snap +0 -89
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/CancelResumeConfirm.test.js.snap +0 -37
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.js +0 -23
- data/webpack/ForemanTasks/Components/common/ActionButtons/CancelButton.test.js +0 -27
- 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
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -6
@@ -1,4 +1,4 @@
|
|
1
|
-
import { updateURlQuery, getDuration } from '../TasksTableHelpers';
|
1
|
+
import { updateURlQuery, getDuration, getCSVurl } from '../TasksTableHelpers';
|
2
2
|
|
3
3
|
describe('updateURlQuery', () => {
|
4
4
|
it('should use url with new query', () => {
|
@@ -26,3 +26,19 @@ describe('updateURlQuery', () => {
|
|
26
26
|
expect(duration.tooltip).toEqual('Task was canceled');
|
27
27
|
});
|
28
28
|
});
|
29
|
+
|
30
|
+
describe('getCSVurl', () => {
|
31
|
+
it('should return currect url for tasks with search', () => {
|
32
|
+
const url = '/foreman_tasks/tasks';
|
33
|
+
const query = { state: 'stopped' };
|
34
|
+
expect(getCSVurl(url, query)).toEqual(
|
35
|
+
'/foreman_tasks/tasks.csv?state=stopped'
|
36
|
+
);
|
37
|
+
});
|
38
|
+
it('should return currect url for subtasks', () => {
|
39
|
+
const url = '/foreman_tasks/tasks/some-id/sub_tasks';
|
40
|
+
expect(getCSVurl(url, {})).toEqual(
|
41
|
+
'/foreman_tasks/tasks/some-id/sub_tasks.csv'
|
42
|
+
);
|
43
|
+
});
|
44
|
+
});
|
@@ -1,12 +1,20 @@
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
2
|
import TasksTablePage from '../TasksTablePage';
|
3
3
|
import { minProps } from './TasksTable.fixtures';
|
4
4
|
|
5
|
+
jest.mock('foremanReact/common/helpers', () => ({
|
6
|
+
getURIQuery: () => ({ state: 'stopped' }),
|
7
|
+
}));
|
8
|
+
|
9
|
+
const history = {
|
10
|
+
location: { pathname: '/foreman_tasks/tasks', search: '?action="some-name"' },
|
11
|
+
};
|
5
12
|
const fixtures = {
|
6
|
-
'render with minimal props': minProps,
|
13
|
+
'render with minimal props': { ...minProps, history },
|
7
14
|
|
8
15
|
'render with Breadcrubs': {
|
9
16
|
...minProps,
|
17
|
+
history,
|
10
18
|
getBreadcrumbs: () => ({
|
11
19
|
breadcrumbItems: [
|
12
20
|
{ caption: 'Tasks', url: `/foreman_tasks/tasks` },
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import Immutable from 'seamless-immutable';
|
2
|
+
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
|
2
3
|
import {
|
3
4
|
TASKS_TABLE_ID,
|
4
5
|
TASKS_TABLE_SET_SORT,
|
@@ -6,8 +7,9 @@ import {
|
|
6
7
|
SELECT_ROWS,
|
7
8
|
UNSELECT_ROWS,
|
8
9
|
UNSELECT_ALL_ROWS,
|
9
|
-
|
10
|
-
|
10
|
+
UPDATE_CLICKED,
|
11
|
+
SELECT_ALL_ROWS,
|
12
|
+
OPEN_SELECT_ALL,
|
11
13
|
} from '../TasksTableConstants';
|
12
14
|
import reducer from '../TasksTableReducer';
|
13
15
|
|
@@ -16,7 +18,7 @@ const fixtures = {
|
|
16
18
|
'should handle TASKS_TABLE_SUCCESS': {
|
17
19
|
action: {
|
18
20
|
type: `${TASKS_TABLE_ID}_SUCCESS`,
|
19
|
-
|
21
|
+
response: {
|
20
22
|
subtotal: 120,
|
21
23
|
page: 3,
|
22
24
|
per_page: 12,
|
@@ -45,7 +47,7 @@ const fixtures = {
|
|
45
47
|
'should handle UNSELECT_ROWS': {
|
46
48
|
action: {
|
47
49
|
type: UNSELECT_ROWS,
|
48
|
-
payload: 4,
|
50
|
+
payload: [{ id: 4 }],
|
49
51
|
},
|
50
52
|
},
|
51
53
|
'should handle UNSELECT_ALL_ROWS': {
|
@@ -53,10 +55,28 @@ const fixtures = {
|
|
53
55
|
type: UNSELECT_ALL_ROWS,
|
54
56
|
},
|
55
57
|
},
|
56
|
-
'should handle
|
58
|
+
'should handle UPDATE_CLICKED': {
|
57
59
|
action: {
|
58
|
-
type:
|
59
|
-
payload:
|
60
|
+
type: UPDATE_CLICKED,
|
61
|
+
payload: { clicked: 'task' },
|
62
|
+
},
|
63
|
+
},
|
64
|
+
'should handle SELECT_ALL_ROWS': {
|
65
|
+
action: {
|
66
|
+
type: SELECT_ALL_ROWS,
|
67
|
+
payload: { clicked: 'task' },
|
68
|
+
},
|
69
|
+
},
|
70
|
+
'should handle OPEN_SELECT_ALL': {
|
71
|
+
action: {
|
72
|
+
type: OPEN_SELECT_ALL,
|
73
|
+
},
|
74
|
+
},
|
75
|
+
'should handle UNSELECT_ROWS with all rows selected': {
|
76
|
+
state: Immutable({ tasksTableQuery: { allRowsSelected: true } }),
|
77
|
+
action: {
|
78
|
+
type: UNSELECT_ROWS,
|
79
|
+
payload: { id: [4], results: [{ id: 3 }, { id: 4 }, { id: 5 }] },
|
60
80
|
},
|
61
81
|
},
|
62
82
|
};
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
exports[`SubTasksPage rendering render with minimal props 1`] = `
|
4
4
|
<Connect(TasksTablePage)
|
5
|
-
|
6
|
-
cancelTask={[MockFunction]}
|
5
|
+
createHeader={[Function]}
|
7
6
|
getBreadcrumbs={[MockFunction]}
|
8
7
|
getTableItems={[MockFunction]}
|
9
|
-
hideSelcetedModal={[MockFunction]}
|
10
8
|
history={
|
11
9
|
Object {
|
12
10
|
"location": Object {
|
@@ -22,6 +20,9 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
|
|
22
20
|
},
|
23
21
|
}
|
24
22
|
}
|
23
|
+
openClickedModal={[MockFunction]}
|
24
|
+
openModal={[MockFunction]}
|
25
|
+
openModalAction={[MockFunction]}
|
25
26
|
pagination={
|
26
27
|
Object {
|
27
28
|
"page": 1,
|
@@ -35,19 +36,16 @@ exports[`SubTasksPage rendering render with minimal props 1`] = `
|
|
35
36
|
"b",
|
36
37
|
]
|
37
38
|
}
|
38
|
-
resumeTask={[MockFunction]}
|
39
39
|
selectAllRows={[MockFunction]}
|
40
|
+
selectPage={[MockFunction]}
|
40
41
|
selectRow={[MockFunction]}
|
41
42
|
selectedRows={Array []}
|
42
|
-
showCancelSelcetedModal={[MockFunction]}
|
43
|
-
showResumeSelcetedModal={[MockFunction]}
|
44
43
|
sort={
|
45
44
|
Object {
|
46
45
|
"by": "q",
|
47
46
|
"order": "w",
|
48
47
|
}
|
49
48
|
}
|
50
|
-
status="RESOLVED"
|
51
49
|
unselectAllRows={[MockFunction]}
|
52
50
|
unselectRow={[MockFunction]}
|
53
51
|
/>
|
@@ -0,0 +1,336 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`TasksTable bulk actions handles bulkCancelById requests 1`] = `
|
4
|
+
Array [
|
5
|
+
Array [
|
6
|
+
Object {
|
7
|
+
"type": "TASKS_CANCEL_REQUEST",
|
8
|
+
},
|
9
|
+
],
|
10
|
+
Array [
|
11
|
+
Object {
|
12
|
+
"type": "TASKS_CANCEL_SUCCESS",
|
13
|
+
},
|
14
|
+
],
|
15
|
+
Array [
|
16
|
+
Object {
|
17
|
+
"payload": Object {
|
18
|
+
"message": Object {
|
19
|
+
"message": "I am cancelled Task execution was cancelled",
|
20
|
+
"type": "success",
|
21
|
+
},
|
22
|
+
},
|
23
|
+
"type": "TOASTS_ADD",
|
24
|
+
},
|
25
|
+
],
|
26
|
+
Array [
|
27
|
+
"TASKS_TABLE",
|
28
|
+
],
|
29
|
+
Array [
|
30
|
+
[Function],
|
31
|
+
],
|
32
|
+
]
|
33
|
+
`;
|
34
|
+
|
35
|
+
exports[`TasksTable bulk actions handles bulkCancelById requests that are not cancellable 1`] = `
|
36
|
+
Array [
|
37
|
+
Array [
|
38
|
+
Object {
|
39
|
+
"payload": Object {
|
40
|
+
"message": Object {
|
41
|
+
"message": "Not all the selected tasks can be cancelled",
|
42
|
+
"type": "warning",
|
43
|
+
},
|
44
|
+
},
|
45
|
+
"type": "TOASTS_ADD",
|
46
|
+
},
|
47
|
+
],
|
48
|
+
]
|
49
|
+
`;
|
50
|
+
|
51
|
+
exports[`TasksTable bulk actions handles bulkCancelBySearch requests 1`] = `
|
52
|
+
Array [
|
53
|
+
Array [
|
54
|
+
Object {
|
55
|
+
"type": "TASKS_CANCEL_REQUEST",
|
56
|
+
},
|
57
|
+
],
|
58
|
+
Array [
|
59
|
+
Object {
|
60
|
+
"payload": Object {
|
61
|
+
"message": Object {
|
62
|
+
"message": "Canceling selected tasks, this might take a while",
|
63
|
+
"type": "info",
|
64
|
+
},
|
65
|
+
},
|
66
|
+
"type": "TOASTS_ADD",
|
67
|
+
},
|
68
|
+
],
|
69
|
+
]
|
70
|
+
`;
|
71
|
+
|
72
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests 1`] = `
|
73
|
+
Array [
|
74
|
+
Array [
|
75
|
+
Object {
|
76
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
77
|
+
},
|
78
|
+
],
|
79
|
+
Array [
|
80
|
+
Object {
|
81
|
+
"type": "TASKS_FORCE_CANCEL_SUCCESS",
|
82
|
+
},
|
83
|
+
],
|
84
|
+
Array [
|
85
|
+
Object {
|
86
|
+
"payload": Object {
|
87
|
+
"message": Object {
|
88
|
+
"message": "2 task(s) cancelled with force",
|
89
|
+
"type": "success",
|
90
|
+
},
|
91
|
+
},
|
92
|
+
"type": "TOASTS_ADD",
|
93
|
+
},
|
94
|
+
],
|
95
|
+
Array [
|
96
|
+
Object {
|
97
|
+
"payload": Object {
|
98
|
+
"message": Object {
|
99
|
+
"message": "4 task(s) are already stopped",
|
100
|
+
"type": "warning",
|
101
|
+
},
|
102
|
+
},
|
103
|
+
"type": "TOASTS_ADD",
|
104
|
+
},
|
105
|
+
],
|
106
|
+
Array [
|
107
|
+
"TASKS_TABLE",
|
108
|
+
],
|
109
|
+
Array [
|
110
|
+
[Function],
|
111
|
+
],
|
112
|
+
]
|
113
|
+
`;
|
114
|
+
|
115
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests that are stopped 1`] = `
|
116
|
+
Array [
|
117
|
+
Array [
|
118
|
+
Object {
|
119
|
+
"payload": Object {
|
120
|
+
"message": Object {
|
121
|
+
"message": "1 task(s) are already stopped",
|
122
|
+
"type": "warning",
|
123
|
+
},
|
124
|
+
},
|
125
|
+
"type": "TOASTS_ADD",
|
126
|
+
},
|
127
|
+
],
|
128
|
+
]
|
129
|
+
`;
|
130
|
+
|
131
|
+
exports[`TasksTable bulk actions handles bulkForceCancelById requests that fail 1`] = `
|
132
|
+
Array [
|
133
|
+
Array [
|
134
|
+
Object {
|
135
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
136
|
+
},
|
137
|
+
],
|
138
|
+
Array [
|
139
|
+
Object {
|
140
|
+
"error": [Error: Network Error],
|
141
|
+
"type": "TASKS_FORCE_CANCEL_FAILURE",
|
142
|
+
},
|
143
|
+
],
|
144
|
+
Array [
|
145
|
+
Object {
|
146
|
+
"payload": Object {
|
147
|
+
"message": Object {
|
148
|
+
"message": "Cannot force cancel tasks at the moment Error: Network Error",
|
149
|
+
"type": "error",
|
150
|
+
},
|
151
|
+
},
|
152
|
+
"type": "TOASTS_ADD",
|
153
|
+
},
|
154
|
+
],
|
155
|
+
]
|
156
|
+
`;
|
157
|
+
|
158
|
+
exports[`TasksTable bulk actions handles bulkForceCancelBySearch requests 1`] = `
|
159
|
+
Array [
|
160
|
+
Array [
|
161
|
+
Object {
|
162
|
+
"type": "TASKS_FORCE_CANCEL_REQUEST",
|
163
|
+
},
|
164
|
+
],
|
165
|
+
Array [
|
166
|
+
Object {
|
167
|
+
"payload": Object {
|
168
|
+
"message": Object {
|
169
|
+
"message": "Canceling with force selected tasks, this might take a while",
|
170
|
+
"type": "info",
|
171
|
+
},
|
172
|
+
},
|
173
|
+
"type": "TOASTS_ADD",
|
174
|
+
},
|
175
|
+
],
|
176
|
+
]
|
177
|
+
`;
|
178
|
+
|
179
|
+
exports[`TasksTable bulk actions handles bulkResumeById requests that are not resumable 1`] = `
|
180
|
+
Array [
|
181
|
+
Array [
|
182
|
+
Object {
|
183
|
+
"payload": Object {
|
184
|
+
"message": Object {
|
185
|
+
"message": "Not all the selected tasks can be resumed",
|
186
|
+
"type": "warning",
|
187
|
+
},
|
188
|
+
},
|
189
|
+
"type": "TOASTS_ADD",
|
190
|
+
},
|
191
|
+
],
|
192
|
+
]
|
193
|
+
`;
|
194
|
+
|
195
|
+
exports[`TasksTable bulk actions handles bulkResumeById requests that fail 1`] = `
|
196
|
+
Array [
|
197
|
+
Array [
|
198
|
+
Object {
|
199
|
+
"type": "TASKS_RESUME_REQUEST",
|
200
|
+
},
|
201
|
+
],
|
202
|
+
Array [
|
203
|
+
Object {
|
204
|
+
"error": [Error: Network Error],
|
205
|
+
"type": "TASKS_RESUME_FAILURE",
|
206
|
+
},
|
207
|
+
],
|
208
|
+
Array [
|
209
|
+
Object {
|
210
|
+
"payload": Object {
|
211
|
+
"message": Object {
|
212
|
+
"message": "Cannot resume tasks at the moment Error: Network Error",
|
213
|
+
"type": "error",
|
214
|
+
},
|
215
|
+
},
|
216
|
+
"type": "TOASTS_ADD",
|
217
|
+
},
|
218
|
+
],
|
219
|
+
]
|
220
|
+
`;
|
221
|
+
|
222
|
+
exports[`TasksTable bulk actions handles bulkResumeBySearch requests 1`] = `
|
223
|
+
Array [
|
224
|
+
Array [
|
225
|
+
Object {
|
226
|
+
"type": "TASKS_RESUME_REQUEST",
|
227
|
+
},
|
228
|
+
],
|
229
|
+
Array [
|
230
|
+
Object {
|
231
|
+
"payload": Object {
|
232
|
+
"message": Object {
|
233
|
+
"message": "Resuming selected tasks, this might take a while",
|
234
|
+
"type": "info",
|
235
|
+
},
|
236
|
+
},
|
237
|
+
"type": "TOASTS_ADD",
|
238
|
+
},
|
239
|
+
],
|
240
|
+
]
|
241
|
+
`;
|
242
|
+
|
243
|
+
exports[`TasksTable bulk actions handles resumable bulkResumeById requests 1`] = `
|
244
|
+
Array [
|
245
|
+
Array [
|
246
|
+
Object {
|
247
|
+
"type": "TASKS_RESUME_REQUEST",
|
248
|
+
},
|
249
|
+
],
|
250
|
+
Array [
|
251
|
+
Object {
|
252
|
+
"type": "TASKS_RESUME_SUCCESS",
|
253
|
+
},
|
254
|
+
],
|
255
|
+
Array [
|
256
|
+
Object {
|
257
|
+
"payload": Object {
|
258
|
+
"message": Object {
|
259
|
+
"message": "I am resumed Task execution was resumed",
|
260
|
+
"type": "success",
|
261
|
+
},
|
262
|
+
},
|
263
|
+
"type": "TOASTS_ADD",
|
264
|
+
},
|
265
|
+
],
|
266
|
+
Array [
|
267
|
+
Object {
|
268
|
+
"payload": Object {
|
269
|
+
"message": Object {
|
270
|
+
"message": "I am failed Task execution could not be resumed",
|
271
|
+
"type": "error",
|
272
|
+
},
|
273
|
+
},
|
274
|
+
"type": "TOASTS_ADD",
|
275
|
+
},
|
276
|
+
],
|
277
|
+
Array [
|
278
|
+
"TASKS_TABLE",
|
279
|
+
],
|
280
|
+
Array [
|
281
|
+
[Function],
|
282
|
+
],
|
283
|
+
]
|
284
|
+
`;
|
285
|
+
|
286
|
+
exports[`TasksTable bulk actions handles skipped bulkCancelById requests 1`] = `
|
287
|
+
Array [
|
288
|
+
Array [
|
289
|
+
Object {
|
290
|
+
"type": "TASKS_CANCEL_REQUEST",
|
291
|
+
},
|
292
|
+
],
|
293
|
+
Array [
|
294
|
+
Object {
|
295
|
+
"type": "TASKS_CANCEL_SUCCESS",
|
296
|
+
},
|
297
|
+
],
|
298
|
+
Array [
|
299
|
+
Object {
|
300
|
+
"payload": Object {
|
301
|
+
"message": Object {
|
302
|
+
"message": "I am skipped Task execution task has to be cancellable",
|
303
|
+
"type": "warning",
|
304
|
+
},
|
305
|
+
},
|
306
|
+
"type": "TOASTS_ADD",
|
307
|
+
},
|
308
|
+
],
|
309
|
+
]
|
310
|
+
`;
|
311
|
+
|
312
|
+
exports[`TasksTable bulk actions handles skipped bulkResumeById requests 1`] = `
|
313
|
+
Array [
|
314
|
+
Array [
|
315
|
+
Object {
|
316
|
+
"type": "TASKS_RESUME_REQUEST",
|
317
|
+
},
|
318
|
+
],
|
319
|
+
Array [
|
320
|
+
Object {
|
321
|
+
"type": "TASKS_RESUME_SUCCESS",
|
322
|
+
},
|
323
|
+
],
|
324
|
+
Array [
|
325
|
+
Object {
|
326
|
+
"payload": Object {
|
327
|
+
"message": Object {
|
328
|
+
"message": "I am skipped Task execution task has to be resumable",
|
329
|
+
"type": "warning",
|
330
|
+
},
|
331
|
+
},
|
332
|
+
"type": "TOASTS_ADD",
|
333
|
+
},
|
334
|
+
],
|
335
|
+
]
|
336
|
+
`;
|