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,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
3
|
-
import TableSelectionCell from '../Components/TableSelectionCell';
|
|
4
|
-
|
|
5
|
-
export default (selectionController, additionalData) => (
|
|
6
|
-
<TableSelectionCell
|
|
7
|
-
id={`select${additionalData.rowIndex}`}
|
|
8
|
-
disabled={!additionalData.rowData.canEdit}
|
|
9
|
-
title={
|
|
10
|
-
additionalData.rowData.canEdit
|
|
11
|
-
? undefined
|
|
12
|
-
: __('You do not have permission')
|
|
13
|
-
}
|
|
14
|
-
checked={selectionController.isSelected(additionalData)}
|
|
15
|
-
onChange={() => selectionController.selectRow(additionalData)}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import TableSelectionHeaderCell from '../Components/TableSelectionHeaderCell';
|
|
3
|
-
|
|
4
|
-
export default (selectionController, label) => (
|
|
5
|
-
<TableSelectionHeaderCell
|
|
6
|
-
label={label}
|
|
7
|
-
checked={selectionController.allPageSelected()}
|
|
8
|
-
disabled={!selectionController.permissions.edit}
|
|
9
|
-
onChange={selectionController.selectPage}
|
|
10
|
-
/>
|
|
11
|
-
);
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { connect } from 'react-redux';
|
|
2
|
-
import { bindActionCreators } from 'redux';
|
|
3
|
-
import TasksTablePage from './TasksTablePage';
|
|
4
|
-
import reducer from './TasksTableReducer';
|
|
5
|
-
import * as tableActions from './TasksTableActions';
|
|
6
|
-
import * as bulkActions from './TasksBulkActions';
|
|
7
|
-
import {
|
|
8
|
-
selectStatus,
|
|
9
|
-
selectError,
|
|
10
|
-
selectResults,
|
|
11
|
-
selectPerPage,
|
|
12
|
-
selectItemCount,
|
|
13
|
-
selectSort,
|
|
14
|
-
selectActionName,
|
|
15
|
-
selectSelectedRows,
|
|
16
|
-
selectAllRowsSelected,
|
|
17
|
-
selectShowSelectAll,
|
|
18
|
-
selectModalID,
|
|
19
|
-
selectPermissions,
|
|
20
|
-
} from './TasksTableSelectors';
|
|
21
|
-
|
|
22
|
-
const mapStateToProps = state => ({
|
|
23
|
-
status: selectStatus(state),
|
|
24
|
-
error: selectError(state),
|
|
25
|
-
sort: selectSort(state),
|
|
26
|
-
results: selectResults(state),
|
|
27
|
-
perPage: selectPerPage(state),
|
|
28
|
-
itemCount: selectItemCount(state),
|
|
29
|
-
actionName: selectActionName(state),
|
|
30
|
-
selectedRows: selectSelectedRows(state),
|
|
31
|
-
allRowsSelected: selectAllRowsSelected(state),
|
|
32
|
-
showSelectAll: selectShowSelectAll(state),
|
|
33
|
-
modalID: selectModalID(state),
|
|
34
|
-
permissions: selectPermissions(state),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const mapDispatchToProps = dispatch =>
|
|
38
|
-
bindActionCreators({ ...tableActions, ...bulkActions }, dispatch);
|
|
39
|
-
|
|
40
|
-
export const reducers = { tasksTable: reducer };
|
|
41
|
-
|
|
42
|
-
export default connect(mapStateToProps, mapDispatchToProps)(TasksTablePage);
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { testComponentSnapshotsWithFixtures, shallow } from '@theforeman/test';
|
|
3
|
-
|
|
4
|
-
import { ActionButton } from './ActionButton';
|
|
5
|
-
|
|
6
|
-
const resumeTask = jest.fn();
|
|
7
|
-
const cancelTask = jest.fn();
|
|
8
|
-
const forceCancelTask = jest.fn();
|
|
9
|
-
const taskActions = { resumeTask, cancelTask, forceCancelTask };
|
|
10
|
-
const minProps = { canEdit: true, id: 'id', name: 'some-name' };
|
|
11
|
-
const fixtures = {
|
|
12
|
-
'render with cancellable true props': {
|
|
13
|
-
availableActions: {
|
|
14
|
-
cancellable: true,
|
|
15
|
-
resumable: false,
|
|
16
|
-
},
|
|
17
|
-
taskActions,
|
|
18
|
-
...minProps,
|
|
19
|
-
},
|
|
20
|
-
'render with resumable true props': {
|
|
21
|
-
availableActions: {
|
|
22
|
-
cancellable: false,
|
|
23
|
-
resumable: true,
|
|
24
|
-
},
|
|
25
|
-
taskActions,
|
|
26
|
-
...minProps,
|
|
27
|
-
},
|
|
28
|
-
'render with stoppable and cancellable true props': {
|
|
29
|
-
availableActions: {
|
|
30
|
-
cancellable: true,
|
|
31
|
-
stoppable: true,
|
|
32
|
-
},
|
|
33
|
-
taskActions,
|
|
34
|
-
...minProps,
|
|
35
|
-
},
|
|
36
|
-
'render with cancellable false props': {
|
|
37
|
-
availableActions: {
|
|
38
|
-
cancellable: false,
|
|
39
|
-
resumable: false,
|
|
40
|
-
},
|
|
41
|
-
taskActions,
|
|
42
|
-
...minProps,
|
|
43
|
-
},
|
|
44
|
-
'render with canEdit false': {
|
|
45
|
-
availableActions: {
|
|
46
|
-
cancellable: false,
|
|
47
|
-
resumable: false,
|
|
48
|
-
},
|
|
49
|
-
taskActions,
|
|
50
|
-
...minProps,
|
|
51
|
-
canEdit: false,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
describe('ActionButton', () => {
|
|
56
|
-
describe('snapshot test', () =>
|
|
57
|
-
testComponentSnapshotsWithFixtures(ActionButton, fixtures));
|
|
58
|
-
describe('click test', () => {
|
|
59
|
-
const id = 'some-id';
|
|
60
|
-
const name = 'some-name';
|
|
61
|
-
it('cancel', () => {
|
|
62
|
-
const component = shallow(
|
|
63
|
-
<ActionButton
|
|
64
|
-
id={id}
|
|
65
|
-
name={name}
|
|
66
|
-
canEdit
|
|
67
|
-
availableActions={{ cancellable: true }}
|
|
68
|
-
taskActions={taskActions}
|
|
69
|
-
/>
|
|
70
|
-
).children();
|
|
71
|
-
component.props().buttons[0].action.onClick();
|
|
72
|
-
expect(cancelTask).toHaveBeenCalledWith(id, name);
|
|
73
|
-
});
|
|
74
|
-
it('resume', () => {
|
|
75
|
-
const component = shallow(
|
|
76
|
-
<ActionButton
|
|
77
|
-
id={id}
|
|
78
|
-
name={name}
|
|
79
|
-
canEdit
|
|
80
|
-
availableActions={{ resumable: true }}
|
|
81
|
-
taskActions={taskActions}
|
|
82
|
-
/>
|
|
83
|
-
).children();
|
|
84
|
-
component.props().buttons[0].action.onClick();
|
|
85
|
-
expect(resumeTask).toHaveBeenCalledWith(id, name);
|
|
86
|
-
});
|
|
87
|
-
it('force cancel', () => {
|
|
88
|
-
const component = shallow(
|
|
89
|
-
<ActionButton
|
|
90
|
-
id={id}
|
|
91
|
-
name={name}
|
|
92
|
-
canEdit
|
|
93
|
-
availableActions={{ stoppable: true }}
|
|
94
|
-
taskActions={taskActions}
|
|
95
|
-
/>
|
|
96
|
-
).children();
|
|
97
|
-
component.props().buttons[0].action.onClick();
|
|
98
|
-
expect(cancelTask).toHaveBeenCalledWith(id, name);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ActionButton snapshot test render with canEdit false 1`] = `
|
|
4
|
-
<span>
|
|
5
|
-
<ActionButtons
|
|
6
|
-
buttons={Array []}
|
|
7
|
-
/>
|
|
8
|
-
</span>
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`ActionButton snapshot test render with cancellable false props 1`] = `
|
|
12
|
-
<span
|
|
13
|
-
title="Task cannot be canceled"
|
|
14
|
-
>
|
|
15
|
-
<ActionButtons
|
|
16
|
-
buttons={
|
|
17
|
-
Array [
|
|
18
|
-
Object {
|
|
19
|
-
"action": Object {
|
|
20
|
-
"disabled": true,
|
|
21
|
-
"id": "task-cancel-button-id",
|
|
22
|
-
"onClick": [Function],
|
|
23
|
-
},
|
|
24
|
-
"title": "Cancel",
|
|
25
|
-
},
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
/>
|
|
29
|
-
</span>
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
exports[`ActionButton snapshot test render with cancellable true props 1`] = `
|
|
33
|
-
<span>
|
|
34
|
-
<ActionButtons
|
|
35
|
-
buttons={
|
|
36
|
-
Array [
|
|
37
|
-
Object {
|
|
38
|
-
"action": Object {
|
|
39
|
-
"disabled": false,
|
|
40
|
-
"id": "task-cancel-button-id",
|
|
41
|
-
"onClick": [Function],
|
|
42
|
-
},
|
|
43
|
-
"title": "Cancel",
|
|
44
|
-
},
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
/>
|
|
48
|
-
</span>
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`ActionButton snapshot test render with resumable true props 1`] = `
|
|
52
|
-
<span>
|
|
53
|
-
<ActionButtons
|
|
54
|
-
buttons={
|
|
55
|
-
Array [
|
|
56
|
-
Object {
|
|
57
|
-
"action": Object {
|
|
58
|
-
"disabled": false,
|
|
59
|
-
"id": "task-resume-button-id",
|
|
60
|
-
"onClick": [Function],
|
|
61
|
-
},
|
|
62
|
-
"title": "Resume",
|
|
63
|
-
},
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
</span>
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
exports[`ActionButton snapshot test render with stoppable and cancellable true props 1`] = `
|
|
71
|
-
<span>
|
|
72
|
-
<ActionButtons
|
|
73
|
-
buttons={
|
|
74
|
-
Array [
|
|
75
|
-
Object {
|
|
76
|
-
"action": Object {
|
|
77
|
-
"disabled": false,
|
|
78
|
-
"id": "task-cancel-button-id",
|
|
79
|
-
"onClick": [Function],
|
|
80
|
-
},
|
|
81
|
-
"title": "Cancel",
|
|
82
|
-
},
|
|
83
|
-
Object {
|
|
84
|
-
"action": Object {
|
|
85
|
-
"disabled": false,
|
|
86
|
-
"id": "task-force-cancel-button-id",
|
|
87
|
-
"onClick": [Function],
|
|
88
|
-
},
|
|
89
|
-
"title": "Force Cancel",
|
|
90
|
-
},
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
/>
|
|
94
|
-
</span>
|
|
95
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
-
import ForemanTasksRouter from './Routes/ForemanTasksRouter';
|
|
4
|
-
|
|
5
|
-
const ForemanTasks = () => (
|
|
6
|
-
<BrowserRouter>
|
|
7
|
-
<ForemanTasksRouter />
|
|
8
|
-
</BrowserRouter>
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
export default ForemanTasks;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import ForemanTasks from './ForemanTasks';
|
|
4
|
-
|
|
5
|
-
const fixtures = {
|
|
6
|
-
'render without Props': {},
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
describe('ForemanTasks', () =>
|
|
10
|
-
testComponentSnapshotsWithFixtures(ForemanTasks, fixtures));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Switch, Route } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
import routes from './ForemanTasksRoutes';
|
|
5
|
-
|
|
6
|
-
const ForemanTasksRouter = () => (
|
|
7
|
-
<Switch>
|
|
8
|
-
{Object.entries(routes).map(([key, props]) => (
|
|
9
|
-
<Route key={key} {...props} />
|
|
10
|
-
))}
|
|
11
|
-
</Switch>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
export default ForemanTasksRouter;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
3
|
-
|
|
4
|
-
import ForemanTasksRouter from './ForemanTasksRouter';
|
|
5
|
-
|
|
6
|
-
jest.mock('./ForemanTasksRoutes', () => ({
|
|
7
|
-
someRoute: {
|
|
8
|
-
path: '/some-route',
|
|
9
|
-
render: props => <span {...props}>some-route</span>,
|
|
10
|
-
},
|
|
11
|
-
someOtherRoute: {
|
|
12
|
-
path: '/some-other-route',
|
|
13
|
-
render: props => <span {...props}>some-other-route</span>,
|
|
14
|
-
},
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
const fixtures = {
|
|
18
|
-
'render without Props': {
|
|
19
|
-
history: {
|
|
20
|
-
push: jest.fn(),
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
describe('ForemanTasksRouter', () =>
|
|
26
|
-
testComponentSnapshotsWithFixtures(ForemanTasksRouter, fixtures));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TasksIndexPage } from '../Components/TasksTable/TasksIndexPage';
|
|
3
|
-
import { SubTasksPage } from '../Components/TasksTable/SubTasksPage';
|
|
4
|
-
import ShowTask from './ShowTask';
|
|
5
|
-
|
|
6
|
-
const ForemanTasksRoutes = {
|
|
7
|
-
indexTasks: {
|
|
8
|
-
path: '/foreman_tasks/tasks',
|
|
9
|
-
exact: true,
|
|
10
|
-
render: props => <TasksIndexPage {...props} />,
|
|
11
|
-
},
|
|
12
|
-
subTasks: {
|
|
13
|
-
path: '/foreman_tasks/tasks/:id/sub_tasks',
|
|
14
|
-
exact: true,
|
|
15
|
-
render: props => <SubTasksPage {...props} />,
|
|
16
|
-
},
|
|
17
|
-
showTask: {
|
|
18
|
-
path: '/foreman_tasks/ex_tasks/:id',
|
|
19
|
-
render: props => <ShowTask {...props} />,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default ForemanTasksRoutes;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from '@theforeman/test';
|
|
3
|
-
|
|
4
|
-
import ForemanTasksRoutes from './ForemanTasksRoutes';
|
|
5
|
-
|
|
6
|
-
describe('ForemanTasksRoutes', () => {
|
|
7
|
-
it('should create routes', () => {
|
|
8
|
-
Object.entries(ForemanTasksRoutes).forEach(([key, Route]) => {
|
|
9
|
-
const RouteRender = Route.render;
|
|
10
|
-
const component = shallow(<RouteRender history={{}} some="props" />);
|
|
11
|
-
Route.renderResult = component;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
expect(ForemanTasksRoutes).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ForemanTasksRouter render without Props 1`] = `
|
|
4
|
-
<Switch>
|
|
5
|
-
<Route
|
|
6
|
-
key="someRoute"
|
|
7
|
-
path="/some-route"
|
|
8
|
-
render={[Function]}
|
|
9
|
-
/>
|
|
10
|
-
<Route
|
|
11
|
-
key="someOtherRoute"
|
|
12
|
-
path="/some-other-route"
|
|
13
|
-
render={[Function]}
|
|
14
|
-
/>
|
|
15
|
-
</Switch>
|
|
16
|
-
`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ForemanTasksRoutes should create routes 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"indexTasks": Object {
|
|
6
|
-
"exact": true,
|
|
7
|
-
"path": "/foreman_tasks/tasks",
|
|
8
|
-
"render": [Function],
|
|
9
|
-
"renderResult": <TasksIndexPage
|
|
10
|
-
history={Object {}}
|
|
11
|
-
some="props"
|
|
12
|
-
/>,
|
|
13
|
-
},
|
|
14
|
-
"showTask": Object {
|
|
15
|
-
"path": "/foreman_tasks/ex_tasks/:id",
|
|
16
|
-
"render": [Function],
|
|
17
|
-
"renderResult": <ShowTask
|
|
18
|
-
history={Object {}}
|
|
19
|
-
some="props"
|
|
20
|
-
/>,
|
|
21
|
-
},
|
|
22
|
-
"subTasks": Object {
|
|
23
|
-
"exact": true,
|
|
24
|
-
"path": "/foreman_tasks/tasks/:id/sub_tasks",
|
|
25
|
-
"render": [Function],
|
|
26
|
-
"renderResult": <SubTasksPage
|
|
27
|
-
history={Object {}}
|
|
28
|
-
match={
|
|
29
|
-
Object {
|
|
30
|
-
"params": Object {},
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
some="props"
|
|
34
|
-
/>,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ForemanTasks';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const getURIsearch = () => 'a=b';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const STATUS = {
|
|
2
|
-
PENDING: 'PENDING',
|
|
3
|
-
RESOLVED: 'RESOLVED',
|
|
4
|
-
ERROR: 'ERROR',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const getControllerSearchProps = (
|
|
8
|
-
controller,
|
|
9
|
-
id = 'searchBar',
|
|
10
|
-
canCreateBookmarks = true
|
|
11
|
-
) => ({
|
|
12
|
-
controller,
|
|
13
|
-
autocomplete: {
|
|
14
|
-
id,
|
|
15
|
-
searchQuery: '',
|
|
16
|
-
url: `${controller}/auto_complete_search`,
|
|
17
|
-
useKeyShortcuts: true,
|
|
18
|
-
},
|
|
19
|
-
bookmarks: {
|
|
20
|
-
url: '/api/bookmarks',
|
|
21
|
-
canCreateBookmarks,
|
|
22
|
-
documentationUrl: `4.1.5Searching`,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const selectAPIResponse = (state, key) => ({
|
|
2
|
-
data: {
|
|
3
|
-
text: 'some-data',
|
|
4
|
-
key,
|
|
5
|
-
},
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
export const selectAPIStatus = (state, key) => 'PENDING';
|
|
9
|
-
export const selectAPIByKey = (state, key) => state[key];
|
|
10
|
-
export const selectAPIError = (state, key) => ({ error: `${key} ERRROR` });
|