foreman-tasks 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_tests.yml +1 -0
- data/app/assets/javascripts/foreman-tasks/locale/de/foreman_tasks.js +58 -22
- data/app/assets/javascripts/foreman-tasks/locale/en/foreman_tasks.js +56 -20
- data/app/assets/javascripts/foreman-tasks/locale/es/foreman_tasks.js +59 -23
- data/app/assets/javascripts/foreman-tasks/locale/fr/foreman_tasks.js +61 -25
- data/app/assets/javascripts/foreman-tasks/locale/ja/foreman_tasks.js +61 -25
- data/app/assets/javascripts/foreman-tasks/locale/ka/foreman_tasks.js +60 -24
- data/app/assets/javascripts/foreman-tasks/locale/ko/foreman_tasks.js +61 -25
- data/app/assets/javascripts/foreman-tasks/locale/pt_BR/foreman_tasks.js +59 -23
- data/app/assets/javascripts/foreman-tasks/locale/ru/foreman_tasks.js +58 -22
- data/app/assets/javascripts/foreman-tasks/locale/zh_CN/foreman_tasks.js +61 -25
- data/app/assets/javascripts/foreman-tasks/locale/zh_TW/foreman_tasks.js +57 -21
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +4 -19
- data/app/controllers/foreman_tasks/tasks_controller.rb +4 -5
- data/app/models/foreman_tasks/task.rb +1 -1
- data/app/views/foreman_tasks/api/tasks/dependency_summary.json.rabl +1 -3
- data/app/views/foreman_tasks/api/tasks/show.json.rabl +4 -1
- data/config/routes.rb +3 -3
- data/foreman-tasks.gemspec +3 -1
- data/lib/foreman_tasks/engine.rb +1 -1
- data/lib/foreman_tasks/tasks/export_tasks.rake +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/de/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/de/foreman_tasks.po +59 -23
- data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/en/foreman_tasks.po +56 -20
- data/locale/es/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/es/foreman_tasks.po +59 -23
- data/locale/foreman_tasks.pot +173 -100
- data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/fr/foreman_tasks.po +61 -25
- data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ja/foreman_tasks.po +61 -25
- data/locale/ka/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ka/foreman_tasks.po +60 -24
- data/locale/ko/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ko/foreman_tasks.po +61 -25
- data/locale/pt_BR/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/pt_BR/foreman_tasks.po +59 -23
- data/locale/ru/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/ru/foreman_tasks.po +58 -22
- data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/zh_CN/foreman_tasks.po +61 -25
- data/locale/zh_TW/LC_MESSAGES/foreman_tasks.mo +0 -0
- data/locale/zh_TW/foreman_tasks.po +57 -21
- data/test/controllers/api/tasks_controller_test.rb +29 -3
- data/test/controllers/tasks_controller_test.rb +46 -2
- data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +8 -0
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +8 -2
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js +25 -33
- data/webpack/ForemanTasks/Components/TaskActions/index.js +24 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +6 -6
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +9 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +16 -11
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.js +2 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/__snapshots__/TasksTimeRow.test.js.snap +4 -8
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.js +2 -4
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss +0 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboard.test.js.snap +2 -5
- data/webpack/ForemanTasks/Components/{common/ActionButtons/ActionButton.js → TasksTable/Components/CellActionButton.js} +36 -21
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/index.test.js +32 -29
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/createBulkTaskModal.js +14 -18
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/createTaskModal.js +13 -15
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +7 -7
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +16 -23
- data/webpack/ForemanTasks/Components/TasksTable/TasksColumns.js +56 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js +277 -3
- data/webpack/ForemanTasks/Components/TasksTable/TasksModals.js +96 -0
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -18
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +3 -3
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +130 -63
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +315 -8
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +214 -41
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +20 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +18 -35
- data/webpack/ForemanTasks/ForemanTasksReducers.js +0 -4
- data/webpack/Routes/routes.js +22 -0
- data/webpack/Routes/routes.test.js +95 -0
- data/webpack/global_index.js +10 -0
- data/webpack/index.js +0 -18
- data/webpack/test_setup.js +1 -0
- metadata +15 -89
- data/app/controllers/foreman_tasks/react_controller.rb +0 -17
- data/app/views/foreman_tasks/layouts/react.html.erb +0 -13
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +0 -30
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +0 -66
- data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +0 -33
- data/webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js +0 -49
- data/webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionCell.js +0 -32
- data/webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionHeaderCell.js +0 -38
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +0 -29
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +0 -15
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +0 -15
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +0 -81
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionCell.test.js.snap +0 -14
- data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionHeaderCell.test.js.snap +0 -15
- data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +0 -40
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +0 -163
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +0 -108
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +0 -234
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.scss +0 -20
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +0 -68
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +0 -85
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +0 -63
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +0 -20
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +0 -9
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +0 -65
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +0 -35
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +0 -87
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +0 -48
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +0 -39
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap +0 -52
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +0 -40
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +0 -368
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +0 -116
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionCellFormatter.test.js.snap +0 -15
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionNameCellFormatter.test.js.snap +0 -10
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/dateCellFormmatter.test.js.snap +0 -9
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/durationCellFormmatter.test.js.snap +0 -18
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionCellFormatter.test.js.snap +0 -12
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionHeaderCellFormatter.test.js.snap +0 -11
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionCellFormatter.test.js +0 -11
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionNameCellFormatter.test.js +0 -8
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/dateCellFormmatter.test.js +0 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/durationCellFormmatter.test.js +0 -12
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionCellFormatter.test.js +0 -12
- data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +0 -12
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionCellFormatter.js +0 -19
- data/webpack/ForemanTasks/Components/TasksTable/formatters/actionNameCellFormatter.js +0 -9
- data/webpack/ForemanTasks/Components/TasksTable/formatters/dateCellFormmatter.js +0 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/durationCellFormmatter.js +0 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/index.js +0 -7
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionCellFormatter.js +0 -17
- data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +0 -11
- data/webpack/ForemanTasks/Components/TasksTable/index.js +0 -42
- data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +0 -101
- data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +0 -95
- data/webpack/ForemanTasks/ForemanTasks.js +0 -11
- data/webpack/ForemanTasks/ForemanTasks.test.js +0 -10
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.js +0 -14
- data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +0 -26
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.js +0 -23
- data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +0 -16
- data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRouter.test.js.snap +0 -16
- data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap +0 -37
- data/webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap +0 -7
- data/webpack/ForemanTasks/index.js +0 -1
- data/webpack/__mocks__/foremanReact/common/I18n.js +0 -7
- data/webpack/__mocks__/foremanReact/common/helpers.js +0 -6
- data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -1
- data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
- data/webpack/__mocks__/foremanReact/components/Pagination/index.js +0 -2
- data/webpack/__mocks__/foremanReact/components/ToastsList/index.js +0 -8
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +0 -3
- data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +0 -4
- data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +0 -5
- data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +0 -3
- data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +0 -7
- data/webpack/__mocks__/foremanReact/components/common/table.js +0 -5
- data/webpack/__mocks__/foremanReact/constants.js +0 -24
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +0 -10
- data/webpack/__mocks__/foremanReact/redux/API/index.js +0 -10
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +0 -5
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js +0 -5
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
column,
|
|
3
|
-
sortableColumn,
|
|
4
|
-
headerFormatterWithProps,
|
|
5
|
-
cellFormatter,
|
|
6
|
-
} from 'foremanReact/components/common/table';
|
|
7
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
8
|
-
import {
|
|
9
|
-
selectionHeaderCellFormatter,
|
|
10
|
-
selectionCellFormatter,
|
|
11
|
-
actionNameCellFormatter,
|
|
12
|
-
durationCellFormmatter,
|
|
13
|
-
actionCellFormatter,
|
|
14
|
-
dateCellFormmatter,
|
|
15
|
-
} from './formatters';
|
|
16
|
-
|
|
17
|
-
const headFormat = [headerFormatterWithProps];
|
|
18
|
-
const cellFormat = [cellFormatter];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generate a table schema to the Hardware Tasks page.
|
|
22
|
-
* @param {Function} setSort a Redux async action that sets new sort values
|
|
23
|
-
* @param {String} by by which column the table is sorted.
|
|
24
|
-
* If none then set it to undefined/null.
|
|
25
|
-
* @param {String} order in what order to sort a column. If none then set it to undefined/null.
|
|
26
|
-
* Otherwise, 'ASC' for ascending and 'DESC' for descending
|
|
27
|
-
* @param {function} cancelTask A function to run when the cancel cell is clicked
|
|
28
|
-
* @return {Array}
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const createTasksTableSchema = (
|
|
32
|
-
setSort,
|
|
33
|
-
by,
|
|
34
|
-
order,
|
|
35
|
-
taskActions,
|
|
36
|
-
selectionController
|
|
37
|
-
) => {
|
|
38
|
-
const sortController = {
|
|
39
|
-
apply: setSort,
|
|
40
|
-
property: by,
|
|
41
|
-
order,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return [
|
|
45
|
-
column(
|
|
46
|
-
'select',
|
|
47
|
-
'Select all rows',
|
|
48
|
-
[label => selectionHeaderCellFormatter(selectionController, label)],
|
|
49
|
-
[
|
|
50
|
-
(value, additionalData) =>
|
|
51
|
-
selectionCellFormatter(selectionController, additionalData),
|
|
52
|
-
]
|
|
53
|
-
),
|
|
54
|
-
column(
|
|
55
|
-
'action',
|
|
56
|
-
__('Action'),
|
|
57
|
-
headFormat,
|
|
58
|
-
[actionNameCellFormatter('foreman_tasks/tasks')],
|
|
59
|
-
{ className: 'col-md-4' }
|
|
60
|
-
),
|
|
61
|
-
column('state', __('State'), headFormat, cellFormat, {
|
|
62
|
-
className: 'col-md-1',
|
|
63
|
-
}),
|
|
64
|
-
column('result', __('Result'), headFormat, cellFormat, {
|
|
65
|
-
className: 'col-md-1',
|
|
66
|
-
}),
|
|
67
|
-
sortableColumn('started_at', __('Started at'), 3, sortController, [
|
|
68
|
-
dateCellFormmatter,
|
|
69
|
-
]),
|
|
70
|
-
sortableColumn('duration', __('Duration'), 2, sortController, [
|
|
71
|
-
durationCellFormmatter,
|
|
72
|
-
]),
|
|
73
|
-
column(
|
|
74
|
-
'availableActions',
|
|
75
|
-
__('Operation'),
|
|
76
|
-
headFormat,
|
|
77
|
-
[actionCellFormatter(taskActions)],
|
|
78
|
-
{
|
|
79
|
-
className: 'col-md-2',
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default createTasksTableSchema;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
3
|
-
import { selectForemanTasks } from '../../ForemanTasksSelectors';
|
|
4
|
-
import { getDuration } from './TasksTableHelpers';
|
|
5
|
-
|
|
6
|
-
export const selectTasksTable = state =>
|
|
7
|
-
selectForemanTasks(state).tasksTable || {};
|
|
8
|
-
|
|
9
|
-
export const selectTasksTableContent = state =>
|
|
10
|
-
selectTasksTable(state).tasksTableContent || {};
|
|
11
|
-
|
|
12
|
-
export const selectTasksTableQuery = state =>
|
|
13
|
-
selectTasksTable(state).tasksTableQuery || {};
|
|
14
|
-
|
|
15
|
-
export const selectPerPage = state =>
|
|
16
|
-
selectTasksTableQuery(state).perPage || 20;
|
|
17
|
-
|
|
18
|
-
export const selectItemCount = state =>
|
|
19
|
-
selectTasksTableQuery(state).itemCount || 0;
|
|
20
|
-
|
|
21
|
-
export const selectActionName = state =>
|
|
22
|
-
selectTasksTableQuery(state).actionName || '';
|
|
23
|
-
|
|
24
|
-
export const selectSelectedRows = state =>
|
|
25
|
-
selectTasksTableQuery(state).selectedRows || [];
|
|
26
|
-
|
|
27
|
-
export const selectPermissions = state =>
|
|
28
|
-
selectTasksTableQuery(state).permissions || { edit: false };
|
|
29
|
-
|
|
30
|
-
export const selectResults = createSelector(
|
|
31
|
-
selectTasksTableContent,
|
|
32
|
-
({ results }) =>
|
|
33
|
-
results.map(result => ({
|
|
34
|
-
...result,
|
|
35
|
-
action:
|
|
36
|
-
result.action ||
|
|
37
|
-
(result.label ? result.label.replace(/::/g, ' ') : result.id),
|
|
38
|
-
username: result.username || '',
|
|
39
|
-
state: result.state + (result.frozen ? ` ${__('Disabled')}` : ''),
|
|
40
|
-
duration: getDuration(result.started_at, result.ended_at),
|
|
41
|
-
availableActions: {
|
|
42
|
-
...result.available_actions,
|
|
43
|
-
stoppable: result.state !== 'stopped',
|
|
44
|
-
},
|
|
45
|
-
canEdit: result.can_edit,
|
|
46
|
-
}))
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
export const selectStatus = state => selectTasksTableContent(state).status;
|
|
50
|
-
|
|
51
|
-
export const selectError = state => selectTasksTableContent(state).error;
|
|
52
|
-
|
|
53
|
-
export const selectSort = state =>
|
|
54
|
-
selectTasksTableQuery(state).sort || { by: 'started_at', order: 'DESC' };
|
|
55
|
-
|
|
56
|
-
export const selectAllRowsSelected = state =>
|
|
57
|
-
selectTasksTableQuery(state).allRowsSelected;
|
|
58
|
-
|
|
59
|
-
export const selectShowSelectAll = state =>
|
|
60
|
-
selectTasksTableQuery(state).showSelectAll;
|
|
61
|
-
|
|
62
|
-
export const selectModalID = state =>
|
|
63
|
-
selectTasksTableQuery(state).modalID || '';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
import { SubTasksPage } from '../SubTasksPage';
|
|
3
|
-
import { minProps } from './TasksTable.fixtures';
|
|
4
|
-
|
|
5
|
-
const fixtures = {
|
|
6
|
-
'render with minimal props': {
|
|
7
|
-
...minProps,
|
|
8
|
-
|
|
9
|
-
match: {
|
|
10
|
-
params: {
|
|
11
|
-
id: 'some-id',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('SubTasksPage', () => {
|
|
18
|
-
describe('rendering', () =>
|
|
19
|
-
testComponentSnapshotsWithFixtures(SubTasksPage, fixtures));
|
|
20
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
import TasksTable from '../TasksTable';
|
|
3
|
-
import fixtures from './TasksTable.fixtures';
|
|
4
|
-
|
|
5
|
-
jest.mock('../TasksTableSchema');
|
|
6
|
-
describe('TasksTable', () => {
|
|
7
|
-
describe('rendering', () =>
|
|
8
|
-
testComponentSnapshotsWithFixtures(TasksTable, fixtures));
|
|
9
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
testActionSnapshotWithFixtures,
|
|
3
|
-
IntegrationTestHelper,
|
|
4
|
-
} from '@theforeman/test';
|
|
5
|
-
import { TASKS_TABLE_ID } from '../TasksTableConstants';
|
|
6
|
-
import {
|
|
7
|
-
getTableItems,
|
|
8
|
-
cancelTask,
|
|
9
|
-
resumeTask,
|
|
10
|
-
forceCancelTask,
|
|
11
|
-
selectPage,
|
|
12
|
-
openClickedModal,
|
|
13
|
-
openModalAction,
|
|
14
|
-
} from '../TasksTableActions';
|
|
15
|
-
|
|
16
|
-
jest.mock('foremanReact/components/common/table', () => ({
|
|
17
|
-
getTableItemsAction: jest.fn(controller => controller),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
const taskInfo = {
|
|
21
|
-
taskId: 'some-id',
|
|
22
|
-
taskName: 'some-name',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const fixtures = {
|
|
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()),
|
|
30
|
-
};
|
|
31
|
-
describe('TasksTable actions', () => {
|
|
32
|
-
it('getTableItems should reuse common/table/getTableItemsAction', () => {
|
|
33
|
-
expect(getTableItems('')).toEqual(TASKS_TABLE_ID);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should resumeTask', async () => {
|
|
37
|
-
const dispatch = jest.fn();
|
|
38
|
-
resumeTask({ ...taskInfo, url: 'some-url' })(dispatch);
|
|
39
|
-
await IntegrationTestHelper.flushAllPromises();
|
|
40
|
-
expect(dispatch.mock.calls).toHaveLength(3);
|
|
41
|
-
});
|
|
42
|
-
it('should cancelTask', async () => {
|
|
43
|
-
const dispatch = jest.fn();
|
|
44
|
-
cancelTask({ ...taskInfo, url: 'some-url' })(dispatch);
|
|
45
|
-
await IntegrationTestHelper.flushAllPromises();
|
|
46
|
-
expect(dispatch.mock.calls).toHaveLength(3);
|
|
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
|
-
});
|
|
64
|
-
testActionSnapshotWithFixtures(fixtures);
|
|
65
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
import TasksTablePage from '../TasksTablePage';
|
|
3
|
-
import { minProps } from './TasksTable.fixtures';
|
|
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
|
-
};
|
|
12
|
-
const fixtures = {
|
|
13
|
-
'render with minimal props': { ...minProps, history },
|
|
14
|
-
|
|
15
|
-
'render with Breadcrubs and edit permissions': {
|
|
16
|
-
...minProps,
|
|
17
|
-
history,
|
|
18
|
-
results: [{ action: 'a', canEdit: true }],
|
|
19
|
-
getBreadcrumbs: () => ({
|
|
20
|
-
breadcrumbItems: [
|
|
21
|
-
{ caption: 'Tasks', url: `/foreman_tasks/tasks` },
|
|
22
|
-
{
|
|
23
|
-
caption: 'action Name',
|
|
24
|
-
url: `/foreman_tasks/tasks/someid`,
|
|
25
|
-
},
|
|
26
|
-
{ caption: 'Sub tasks' },
|
|
27
|
-
],
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
describe('TasksTablePage', () => {
|
|
33
|
-
describe('rendering', () =>
|
|
34
|
-
testComponentSnapshotsWithFixtures(TasksTablePage, fixtures));
|
|
35
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import Immutable from 'seamless-immutable';
|
|
2
|
-
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
|
|
3
|
-
import {
|
|
4
|
-
TASKS_TABLE_ID,
|
|
5
|
-
TASKS_TABLE_SET_SORT,
|
|
6
|
-
TASKS_TABLE_SET_PAGINATION,
|
|
7
|
-
SELECT_ROWS,
|
|
8
|
-
UNSELECT_ROWS,
|
|
9
|
-
UNSELECT_ALL_ROWS,
|
|
10
|
-
UPDATE_CLICKED,
|
|
11
|
-
SELECT_ALL_ROWS,
|
|
12
|
-
OPEN_SELECT_ALL,
|
|
13
|
-
} from '../TasksTableConstants';
|
|
14
|
-
import reducer from '../TasksTableReducer';
|
|
15
|
-
|
|
16
|
-
const fixtures = {
|
|
17
|
-
'should return the initial state': {},
|
|
18
|
-
'should handle TASKS_TABLE_SUCCESS': {
|
|
19
|
-
action: {
|
|
20
|
-
type: `${TASKS_TABLE_ID}_SUCCESS`,
|
|
21
|
-
response: {
|
|
22
|
-
subtotal: 120,
|
|
23
|
-
page: 3,
|
|
24
|
-
per_page: 12,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
'should handle TASKS_TABLE_SET_SORT': {
|
|
29
|
-
action: {
|
|
30
|
-
type: TASKS_TABLE_SET_SORT,
|
|
31
|
-
payload: { by: 'a', order: 'b' },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
'should handle TASKS_TABLE_SET_PAGINATION': {
|
|
36
|
-
action: {
|
|
37
|
-
type: TASKS_TABLE_SET_PAGINATION,
|
|
38
|
-
payload: { page: 4, perPage: 7 },
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
'should handle SELECT_ROWS': {
|
|
42
|
-
action: {
|
|
43
|
-
type: SELECT_ROWS,
|
|
44
|
-
payload: [1, 2, 3, 4, 5, 6, 7],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
'should handle UNSELECT_ROWS': {
|
|
48
|
-
action: {
|
|
49
|
-
type: UNSELECT_ROWS,
|
|
50
|
-
payload: [{ id: 4 }],
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
'should handle UNSELECT_ALL_ROWS': {
|
|
54
|
-
action: {
|
|
55
|
-
type: UNSELECT_ALL_ROWS,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
'should handle UPDATE_CLICKED': {
|
|
59
|
-
action: {
|
|
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({
|
|
77
|
-
tasksTableQuery: { allRowsSelected: true, selectedRows: [3, 4, 5] },
|
|
78
|
-
}),
|
|
79
|
-
action: {
|
|
80
|
-
type: UNSELECT_ROWS,
|
|
81
|
-
payload: { id: [4], results: [{ id: 3 }, { id: 4 }, { id: 5 }] },
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
describe('TasksTableReducer reducer', () =>
|
|
87
|
-
testReducerSnapshotWithFixtures(reducer, fixtures));
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`SubTasksPage rendering render with minimal props 1`] = `
|
|
4
|
-
<Connect(TasksTablePage)
|
|
5
|
-
createHeader={[Function]}
|
|
6
|
-
getBreadcrumbs={[MockFunction]}
|
|
7
|
-
getTableItems={[MockFunction]}
|
|
8
|
-
history={
|
|
9
|
-
Object {
|
|
10
|
-
"location": Object {
|
|
11
|
-
"search": "",
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
itemCount={2}
|
|
16
|
-
match={
|
|
17
|
-
Object {
|
|
18
|
-
"params": Object {
|
|
19
|
-
"id": "some-id",
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
openClickedModal={[MockFunction]}
|
|
24
|
-
openModal={[MockFunction]}
|
|
25
|
-
openModalAction={[MockFunction]}
|
|
26
|
-
parentTaskID="some-id"
|
|
27
|
-
perPage={10}
|
|
28
|
-
reloadPage={[MockFunction]}
|
|
29
|
-
results={
|
|
30
|
-
Array [
|
|
31
|
-
"a",
|
|
32
|
-
"b",
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
selectAllRows={[MockFunction]}
|
|
36
|
-
selectPage={[MockFunction]}
|
|
37
|
-
selectRow={[MockFunction]}
|
|
38
|
-
selectedRows={Array []}
|
|
39
|
-
sort={
|
|
40
|
-
Object {
|
|
41
|
-
"by": "q",
|
|
42
|
-
"order": "w",
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
unselectAllRows={[MockFunction]}
|
|
46
|
-
unselectRow={[MockFunction]}
|
|
47
|
-
/>
|
|
48
|
-
`;
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TasksIndexPage rendering render with minimal props 1`] = `
|
|
4
|
-
<Connect(TasksTablePage)
|
|
5
|
-
getBreadcrumbs={[MockFunction]}
|
|
6
|
-
getTableItems={[MockFunction]}
|
|
7
|
-
history={
|
|
8
|
-
Object {
|
|
9
|
-
"location": Object {
|
|
10
|
-
"search": "",
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
itemCount={2}
|
|
15
|
-
openClickedModal={[MockFunction]}
|
|
16
|
-
openModal={[MockFunction]}
|
|
17
|
-
openModalAction={[MockFunction]}
|
|
18
|
-
perPage={10}
|
|
19
|
-
reloadPage={[MockFunction]}
|
|
20
|
-
results={
|
|
21
|
-
Array [
|
|
22
|
-
"a",
|
|
23
|
-
"b",
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
selectAllRows={[MockFunction]}
|
|
27
|
-
selectPage={[MockFunction]}
|
|
28
|
-
selectRow={[MockFunction]}
|
|
29
|
-
selectedRows={Array []}
|
|
30
|
-
sort={
|
|
31
|
-
Object {
|
|
32
|
-
"by": "q",
|
|
33
|
-
"order": "w",
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
unselectAllRows={[MockFunction]}
|
|
37
|
-
unselectRow={[MockFunction]}
|
|
38
|
-
/>
|
|
39
|
-
`;
|
data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TasksTable rendering render with error Props 1`] = `
|
|
4
|
-
<MessageBox
|
|
5
|
-
icontype="error-circle-o"
|
|
6
|
-
key="tasks-table-error"
|
|
7
|
-
msg="Could not receive data: "
|
|
8
|
-
/>
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`TasksTable rendering render with loading Props 1`] = `
|
|
12
|
-
<div
|
|
13
|
-
className="tasks-table"
|
|
14
|
-
>
|
|
15
|
-
<Table
|
|
16
|
-
key="tasks-table"
|
|
17
|
-
rows={
|
|
18
|
-
Array [
|
|
19
|
-
"a",
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
/>
|
|
23
|
-
<Pagination
|
|
24
|
-
itemCount={2}
|
|
25
|
-
/>
|
|
26
|
-
</div>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
exports[`TasksTable rendering render with minimal Props 1`] = `
|
|
30
|
-
<div
|
|
31
|
-
className="tasks-table"
|
|
32
|
-
>
|
|
33
|
-
<Table
|
|
34
|
-
key="tasks-table"
|
|
35
|
-
rows={
|
|
36
|
-
Array [
|
|
37
|
-
"a",
|
|
38
|
-
"b",
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
/>
|
|
42
|
-
<Pagination
|
|
43
|
-
itemCount={2}
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
exports[`TasksTable rendering render with no results 1`] = `
|
|
49
|
-
<span>
|
|
50
|
-
No Tasks
|
|
51
|
-
</span>
|
|
52
|
-
`;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TasksTable actions handles openClickedModal 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"payload": Object {
|
|
6
|
-
"clicked": Object {
|
|
7
|
-
"taskId": "some-id",
|
|
8
|
-
"taskName": "some-name",
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
"type": "UPDATE_CLICKED",
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`TasksTable actions handles openModalAction 1`] = `
|
|
16
|
-
Object {
|
|
17
|
-
"payload": Object {
|
|
18
|
-
"modalID": "some-modal-id",
|
|
19
|
-
},
|
|
20
|
-
"type": "UPDATE_MODAL",
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
exports[`TasksTable actions should selectPage and succeed 1`] = `
|
|
25
|
-
Array [
|
|
26
|
-
Array [
|
|
27
|
-
Object {
|
|
28
|
-
"payload": Array [
|
|
29
|
-
"some-id",
|
|
30
|
-
],
|
|
31
|
-
"type": "SELECT_ROWS",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
Array [
|
|
35
|
-
Object {
|
|
36
|
-
"type": "OPEN_SELECT_ALL",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
]
|
|
40
|
-
`;
|