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.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby_tests.yml +1 -0
  3. data/app/assets/javascripts/foreman-tasks/locale/de/foreman_tasks.js +58 -22
  4. data/app/assets/javascripts/foreman-tasks/locale/en/foreman_tasks.js +56 -20
  5. data/app/assets/javascripts/foreman-tasks/locale/es/foreman_tasks.js +59 -23
  6. data/app/assets/javascripts/foreman-tasks/locale/fr/foreman_tasks.js +61 -25
  7. data/app/assets/javascripts/foreman-tasks/locale/ja/foreman_tasks.js +61 -25
  8. data/app/assets/javascripts/foreman-tasks/locale/ka/foreman_tasks.js +60 -24
  9. data/app/assets/javascripts/foreman-tasks/locale/ko/foreman_tasks.js +61 -25
  10. data/app/assets/javascripts/foreman-tasks/locale/pt_BR/foreman_tasks.js +59 -23
  11. data/app/assets/javascripts/foreman-tasks/locale/ru/foreman_tasks.js +58 -22
  12. data/app/assets/javascripts/foreman-tasks/locale/zh_CN/foreman_tasks.js +61 -25
  13. data/app/assets/javascripts/foreman-tasks/locale/zh_TW/foreman_tasks.js +57 -21
  14. data/app/controllers/foreman_tasks/api/tasks_controller.rb +4 -19
  15. data/app/controllers/foreman_tasks/tasks_controller.rb +4 -5
  16. data/app/models/foreman_tasks/task.rb +1 -1
  17. data/app/views/foreman_tasks/api/tasks/dependency_summary.json.rabl +1 -3
  18. data/app/views/foreman_tasks/api/tasks/show.json.rabl +4 -1
  19. data/config/routes.rb +3 -3
  20. data/foreman-tasks.gemspec +3 -1
  21. data/lib/foreman_tasks/engine.rb +1 -1
  22. data/lib/foreman_tasks/tasks/export_tasks.rake +1 -1
  23. data/lib/foreman_tasks/version.rb +1 -1
  24. data/locale/de/LC_MESSAGES/foreman_tasks.mo +0 -0
  25. data/locale/de/foreman_tasks.po +59 -23
  26. data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
  27. data/locale/en/foreman_tasks.po +56 -20
  28. data/locale/es/LC_MESSAGES/foreman_tasks.mo +0 -0
  29. data/locale/es/foreman_tasks.po +59 -23
  30. data/locale/foreman_tasks.pot +173 -100
  31. data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
  32. data/locale/fr/foreman_tasks.po +61 -25
  33. data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
  34. data/locale/ja/foreman_tasks.po +61 -25
  35. data/locale/ka/LC_MESSAGES/foreman_tasks.mo +0 -0
  36. data/locale/ka/foreman_tasks.po +60 -24
  37. data/locale/ko/LC_MESSAGES/foreman_tasks.mo +0 -0
  38. data/locale/ko/foreman_tasks.po +61 -25
  39. data/locale/pt_BR/LC_MESSAGES/foreman_tasks.mo +0 -0
  40. data/locale/pt_BR/foreman_tasks.po +59 -23
  41. data/locale/ru/LC_MESSAGES/foreman_tasks.mo +0 -0
  42. data/locale/ru/foreman_tasks.po +58 -22
  43. data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
  44. data/locale/zh_CN/foreman_tasks.po +61 -25
  45. data/locale/zh_TW/LC_MESSAGES/foreman_tasks.mo +0 -0
  46. data/locale/zh_TW/foreman_tasks.po +57 -21
  47. data/test/controllers/api/tasks_controller_test.rb +29 -3
  48. data/test/controllers/tasks_controller_test.rb +46 -2
  49. data/webpack/ForemanTasks/Components/TaskActions/TaskAction.test.js +8 -0
  50. data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +8 -2
  51. data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.test.js +25 -33
  52. data/webpack/ForemanTasks/Components/TaskActions/index.js +24 -3
  53. data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +6 -6
  54. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +9 -0
  55. data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +16 -11
  56. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/TasksTimeRow.js +2 -3
  57. data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksTimeRow/__snapshots__/TasksTimeRow.test.js.snap +4 -8
  58. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.js +2 -4
  59. data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss +0 -3
  60. data/webpack/ForemanTasks/Components/TasksDashboard/__tests__/__snapshots__/TasksDashboard.test.js.snap +2 -5
  61. data/webpack/ForemanTasks/Components/{common/ActionButtons/ActionButton.js → TasksTable/Components/CellActionButton.js} +36 -21
  62. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/index.test.js +32 -29
  63. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/createBulkTaskModal.js +14 -18
  64. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/createTaskModal.js +13 -15
  65. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/index.js +7 -7
  66. data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +16 -23
  67. data/webpack/ForemanTasks/Components/TasksTable/TasksColumns.js +56 -0
  68. data/webpack/ForemanTasks/Components/TasksTable/TasksIndexPage.js +277 -3
  69. data/webpack/ForemanTasks/Components/TasksTable/TasksModals.js +96 -0
  70. data/webpack/ForemanTasks/Components/TasksTable/TasksTableConstants.js +10 -18
  71. data/webpack/ForemanTasks/Components/TasksTable/TasksTableHelpers.js +3 -3
  72. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksBulkActions.test.js +130 -63
  73. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksIndexPage.test.js +315 -8
  74. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +214 -41
  75. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableHelpers.test.js +20 -12
  76. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksBulkActions.test.js.snap +18 -35
  77. data/webpack/ForemanTasks/ForemanTasksReducers.js +0 -4
  78. data/webpack/Routes/routes.js +22 -0
  79. data/webpack/Routes/routes.test.js +95 -0
  80. data/webpack/global_index.js +10 -0
  81. data/webpack/index.js +0 -18
  82. data/webpack/test_setup.js +1 -0
  83. metadata +15 -89
  84. data/app/controllers/foreman_tasks/react_controller.rb +0 -17
  85. data/app/views/foreman_tasks/layouts/react.html.erb +0 -13
  86. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/ConfirmModalSelectors.js +0 -30
  87. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/ConfirmModalSelectors.test.js +0 -66
  88. data/webpack/ForemanTasks/Components/TasksTable/Components/ConfirmModal/__test__/__snapshots__/ConfirmModalSelectors.test.js.snap +0 -33
  89. data/webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js +0 -49
  90. data/webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionCell.js +0 -32
  91. data/webpack/ForemanTasks/Components/TasksTable/Components/TableSelectionHeaderCell.js +0 -38
  92. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/SelectAllAlert.test.js +0 -29
  93. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionCell.test.js +0 -15
  94. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/TableSelectionHeaderCell.test.js +0 -15
  95. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/SelectAllAlert.test.js.snap +0 -81
  96. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionCell.test.js.snap +0 -14
  97. data/webpack/ForemanTasks/Components/TasksTable/Components/__test__/__snapshots__/TableSelectionHeaderCell.test.js.snap +0 -15
  98. data/webpack/ForemanTasks/Components/TasksTable/SubTasksPage.js +0 -40
  99. data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +0 -163
  100. data/webpack/ForemanTasks/Components/TasksTable/TasksTableActions.js +0 -108
  101. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +0 -234
  102. data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.scss +0 -20
  103. data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +0 -68
  104. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSchema.js +0 -85
  105. data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +0 -63
  106. data/webpack/ForemanTasks/Components/TasksTable/__tests__/SubTasksPage.test.js +0 -20
  107. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.test.js +0 -9
  108. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableActions.test.js +0 -65
  109. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTablePage.test.js +0 -35
  110. data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTableReducer.test.js +0 -87
  111. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +0 -48
  112. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +0 -39
  113. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap +0 -52
  114. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableActions.test.js.snap +0 -40
  115. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +0 -368
  116. data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +0 -116
  117. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionCellFormatter.test.js.snap +0 -15
  118. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/actionNameCellFormatter.test.js.snap +0 -10
  119. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/dateCellFormmatter.test.js.snap +0 -9
  120. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/durationCellFormmatter.test.js.snap +0 -18
  121. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionCellFormatter.test.js.snap +0 -12
  122. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/__snapshots__/selectionHeaderCellFormatter.test.js.snap +0 -11
  123. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionCellFormatter.test.js +0 -11
  124. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/actionNameCellFormatter.test.js +0 -8
  125. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/dateCellFormmatter.test.js +0 -7
  126. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/durationCellFormmatter.test.js +0 -12
  127. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionCellFormatter.test.js +0 -12
  128. data/webpack/ForemanTasks/Components/TasksTable/formatters/__test__/selectionHeaderCellFormatter.test.js +0 -12
  129. data/webpack/ForemanTasks/Components/TasksTable/formatters/actionCellFormatter.js +0 -19
  130. data/webpack/ForemanTasks/Components/TasksTable/formatters/actionNameCellFormatter.js +0 -9
  131. data/webpack/ForemanTasks/Components/TasksTable/formatters/dateCellFormmatter.js +0 -7
  132. data/webpack/ForemanTasks/Components/TasksTable/formatters/durationCellFormmatter.js +0 -7
  133. data/webpack/ForemanTasks/Components/TasksTable/formatters/index.js +0 -7
  134. data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionCellFormatter.js +0 -17
  135. data/webpack/ForemanTasks/Components/TasksTable/formatters/selectionHeaderCellFormatter.js +0 -11
  136. data/webpack/ForemanTasks/Components/TasksTable/index.js +0 -42
  137. data/webpack/ForemanTasks/Components/common/ActionButtons/ActionButton.test.js +0 -101
  138. data/webpack/ForemanTasks/Components/common/ActionButtons/__snapshots__/ActionButton.test.js.snap +0 -95
  139. data/webpack/ForemanTasks/ForemanTasks.js +0 -11
  140. data/webpack/ForemanTasks/ForemanTasks.test.js +0 -10
  141. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.js +0 -14
  142. data/webpack/ForemanTasks/Routes/ForemanTasksRouter.test.js +0 -26
  143. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.js +0 -23
  144. data/webpack/ForemanTasks/Routes/ForemanTasksRoutes.test.js +0 -16
  145. data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRouter.test.js.snap +0 -16
  146. data/webpack/ForemanTasks/Routes/__snapshots__/ForemanTasksRoutes.test.js.snap +0 -37
  147. data/webpack/ForemanTasks/__snapshots__/ForemanTasks.test.js.snap +0 -7
  148. data/webpack/ForemanTasks/index.js +0 -1
  149. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -7
  150. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -6
  151. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -1
  152. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
  153. data/webpack/__mocks__/foremanReact/components/Pagination/index.js +0 -2
  154. data/webpack/__mocks__/foremanReact/components/ToastsList/index.js +0 -8
  155. data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +0 -3
  156. data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +0 -4
  157. data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +0 -5
  158. data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +0 -3
  159. data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +0 -7
  160. data/webpack/__mocks__/foremanReact/components/common/table.js +0 -5
  161. data/webpack/__mocks__/foremanReact/constants.js +0 -24
  162. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +0 -10
  163. data/webpack/__mocks__/foremanReact/redux/API/index.js +0 -10
  164. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +0 -5
  165. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
  166. 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
- });
@@ -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,7 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ForemanTasks render without Props 1`] = `
4
- <BrowserRouter>
5
- <ForemanTasksRouter />
6
- </BrowserRouter>
7
- `;
@@ -1 +0,0 @@
1
- export { default } from './ForemanTasks';
@@ -1,7 +0,0 @@
1
- export { sprintf } from 'jed';
2
-
3
- export const translate = s => s;
4
-
5
- export const ngettext = s => s;
6
-
7
- export const documentLocale = () => 'en';
@@ -1,6 +0,0 @@
1
- export const getURIQuery = jest.fn(() => ({}));
2
-
3
- export const isoCompatibleDate = date => date;
4
- export const noop = Function.prototype;
5
-
6
- export const foremanUrl = path => `foreman${path}`;
@@ -1 +0,0 @@
1
- export const getURIsearch = () => 'a=b';
@@ -1,2 +0,0 @@
1
- export const showLoading = () => null;
2
- export const hideLoading = () => null;
@@ -1,2 +0,0 @@
1
- const Pagination = () => jest.fn();
2
- export default Pagination;
@@ -1,8 +0,0 @@
1
- export const addToast = toast => ({
2
- type: 'TOASTS_ADD',
3
- payload: {
4
- message: toast,
5
- },
6
- });
7
-
8
- export default addToast;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export const ActionButtons = props => <button>{JSON.stringify(props)}</button>;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
-
3
- export const MessageBox = () => <div className="message-box-root" />;
4
- export default MessageBox;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- export const LongDateTime = value => <p>{value}</p>;
4
-
5
- export default LongDateTime;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export default date => <p>{`${date} time ago`}</p>;
@@ -1,7 +0,0 @@
1
- const createTableActionTypes = tableID => ({
2
- REQUEST: `${tableID.toUpperCase()}_REQUEST`,
3
- SUCCESS: `${tableID.toUpperCase()}_SUCCESS`,
4
- FAILURE: `${tableID.toUpperCase()}_FAILURE`,
5
- });
6
-
7
- export default createTableActionTypes;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- export const Table = () => <div className="table" />;
4
- export const createTableReducer = jest.fn(controller => controller);
5
- export const cellFormatter = cell => cell;
@@ -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` });
@@ -1,10 +0,0 @@
1
- export const API = {
2
- get: jest.fn(),
3
- put: jest.fn(),
4
- post: jest.fn(),
5
- delete: jest.fn(),
6
- patch: jest.fn(),
7
- };
8
-
9
- export const get = data => ({ type: 'get-some-type', ...data });
10
- export const post = data => ({ type: 'post-some-type', ...data });
@@ -1,5 +0,0 @@
1
- export const stopInterval = () => ({
2
- type: 'stop',
3
- });
4
-
5
- export const withInterval = (object, interval) => ({ ...object, interval });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const PageLayout = ({ children }) => <div>{children}</div>;
5
-
6
- PageLayout.propTypes = {
7
- children: PropTypes.node.isRequired,
8
- };
9
-
10
- export default PageLayout;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- const ExportButton = () => <button>export</button>;
4
-
5
- export default ExportButton;