foreman_webhooks 5.0.3 → 5.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -15
  3. data/app/models/webhook.rb +1 -1
  4. data/lib/foreman_webhooks/version.rb +1 -1
  5. data/webpack/ForemanWebhooks/Routes/ForemanWebhooksRoutes.js +1 -1
  6. data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookTable/Components/Formatters/__tests__/actionCellFormatter.test.js +109 -0
  7. data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookTable/Components/Formatters/__tests__/enabledCellFormatter.test.js +38 -0
  8. data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookTable/Components/Formatters/__tests__/nameToEditFormatter.test.js +82 -0
  9. data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookTable/Components/Formatters/actionCellFormatter.js +23 -0
  10. data/webpack/ForemanWebhooks/Routes/Webhooks/{WebhooksIndexPage/Components/WebhooksTable/Components/EnabledCell.js → Components/WebhookTable/Components/Formatters/enabledCellFormatter.js} +6 -1
  11. data/webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookTable/Components/Formatters/nameToEditFormatter.js +33 -0
  12. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookCreateModal.js +1 -0
  13. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js +5 -1
  14. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookEditModal.js +1 -0
  15. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/WebhooksIndexPage.js +120 -16
  16. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/WebhooksIndexPage.test.js +130 -22
  17. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/integration.test.js +10 -3
  18. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/mocks/MockForemanTableIndexPage.js +37 -0
  19. data/webpack/ForemanWebhooks/Routes/Webhooks/constants.js +3 -3
  20. data/webpack/test_setup.js +3 -0
  21. metadata +18 -93
  22. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/EmptyWebhooksTable/index.js +0 -29
  23. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/__tests__/__snapshots__/enabledCellFormatter.test.js.snap +0 -7
  24. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/__tests__/enabledCellFormatter.test.js +0 -7
  25. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/actionCellFormatter.js +0 -20
  26. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/enabledCellFormatter.js +0 -6
  27. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/index.js +0 -3
  28. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/nameToEditFormatter.js +0 -19
  29. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/NameToEditCell.js +0 -42
  30. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/__tests__/EnabledCell.test.js +0 -14
  31. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/__tests__/__snapshots__/EnabledCell.test.js.snap +0 -5
  32. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/WebhooksTable.js +0 -121
  33. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/WebhooksTableSchema.js +0 -48
  34. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/WebhooksTable.test.js +0 -64
  35. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/__tests__/__snapshots__/WebhooksTable.test.js.snap +0 -250
  36. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js +0 -76
  37. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/__tests__/__snapshots__/WebhooksIndexPage.test.js.snap +0 -17
  38. data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/index.js +0 -3
  39. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -1
  40. data/webpack/__mocks__/foremanReact/common/HOC.js +0 -30
  41. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -7
  42. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -7
  43. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -8
  44. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
  45. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +0 -10
  46. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -23
  47. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
  48. data/webpack/__mocks__/foremanReact/components/Loading/Loading.js +0 -2
  49. data/webpack/__mocks__/foremanReact/components/Loading/index.js +0 -3
  50. data/webpack/__mocks__/foremanReact/components/PF4/TableIndexPage/TableIndexPage.js +0 -10
  51. data/webpack/__mocks__/foremanReact/components/Pagination/index.js +0 -4
  52. data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +0 -3
  53. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +0 -5
  54. data/webpack/__mocks__/foremanReact/components/common/forms/ForemanForm.js +0 -9
  55. data/webpack/__mocks__/foremanReact/components/common/forms/FormField.js +0 -3
  56. data/webpack/__mocks__/foremanReact/components/common/table.js +0 -26
  57. data/webpack/__mocks__/foremanReact/constants.js +0 -24
  58. data/webpack/__mocks__/foremanReact/history.js +0 -3
  59. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +0 -6
  60. data/webpack/__mocks__/foremanReact/redux/API/index.js +0 -10
  61. data/webpack/__mocks__/foremanReact/redux/actions/common/forms.js +0 -1
  62. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
  63. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
  64. /data/webpack/ForemanWebhooks/Routes/Webhooks/{WebhooksIndexPage/Components/WebhooksTable → Components/WebhookTable}/Components/ActionButtons/ActionButton.js +0 -0
@@ -1,121 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useSelector } from 'react-redux';
4
- import { isEmpty } from 'lodash';
5
-
6
- import { Table } from 'foremanReact/components/common/table';
7
- import Pagination from 'foremanReact/components/Pagination';
8
- import Loading from 'foremanReact/components/Loading';
9
-
10
- import WebhookDeleteModal from '../WebhookDeleteModal';
11
- import WebhookEditModal from '../WebhookEditModal';
12
- import WebhookTestModal from '../WebhookTestModal';
13
- import EmptyWebhooksTable from './Components/EmptyWebhooksTable';
14
-
15
- import createWebhooksTableSchema from './WebhooksTableSchema';
16
-
17
- import {
18
- selectWebhooks,
19
- selectPage,
20
- selectPerPage,
21
- selectSearch,
22
- selectSort,
23
- selectHasData,
24
- selectHasError,
25
- selectIsLoading,
26
- selectSubtotal,
27
- selectMessage,
28
- } from '../../../WebhooksPageSelectors';
29
-
30
- const WebhooksTable = ({
31
- fetchAndPush,
32
- toDelete,
33
- toTest,
34
- toEdit,
35
- onEditClick,
36
- reloadWithSearch,
37
- webhookActions,
38
- modalsStates,
39
- }) => {
40
- const webhooks = useSelector(selectWebhooks);
41
- const page = useSelector(selectPage);
42
- const perPage = useSelector(selectPerPage);
43
- const search = useSelector(selectSearch);
44
- const sort = useSelector(selectSort);
45
- const isLoading = useSelector(selectIsLoading);
46
- const hasData = useSelector(selectHasData);
47
- const hasError = useSelector(selectHasError);
48
- const itemCount = useSelector(selectSubtotal);
49
- const message = useSelector(selectMessage);
50
-
51
- const onDeleteSuccess = () => {
52
- modalsStates.deleteModal.closeModal();
53
- const currentPage = page;
54
- const maxPage = Math.ceil((itemCount - 1) / perPage);
55
- fetchAndPush({ page: maxPage < currentPage ? maxPage : currentPage });
56
- };
57
-
58
- if (isLoading && !hasError) return <Loading />;
59
-
60
- if (!isLoading && !hasData && isEmpty(search)) {
61
- return <EmptyWebhooksTable message={message} />;
62
- }
63
-
64
- return (
65
- <React.Fragment>
66
- <WebhookDeleteModal
67
- toDelete={toDelete}
68
- onSuccess={onDeleteSuccess}
69
- modalState={modalsStates.deleteModal}
70
- />
71
- <WebhookEditModal
72
- toEdit={toEdit}
73
- onSuccess={() => {
74
- modalsStates.editModal.closeModal();
75
- reloadWithSearch(search);
76
- }}
77
- modalState={modalsStates.editModal}
78
- />
79
- <WebhookTestModal toTest={toTest} modalState={modalsStates.testModal} />
80
- <Table
81
- key="webhooks-table"
82
- columns={createWebhooksTableSchema(
83
- fetchAndPush,
84
- sort.by,
85
- sort.order,
86
- webhookActions,
87
- onEditClick
88
- )}
89
- rows={webhooks}
90
- id="webhooks-table"
91
- />
92
- <Pagination itemCount={itemCount} onChange={fetchAndPush} />
93
- </React.Fragment>
94
- );
95
- };
96
-
97
- WebhooksTable.propTypes = {
98
- fetchAndPush: PropTypes.func.isRequired,
99
- onEditClick: PropTypes.func.isRequired,
100
- toDelete: PropTypes.object.isRequired,
101
- toTest: PropTypes.object.isRequired,
102
- toEdit: PropTypes.number.isRequired,
103
- reloadWithSearch: PropTypes.func.isRequired,
104
- webhookActions: PropTypes.object.isRequired,
105
- modalsStates: PropTypes.shape({
106
- deleteModal: PropTypes.shape({
107
- isOpen: PropTypes.bool.isRequired,
108
- closeModal: PropTypes.func.isRequired,
109
- }).isRequired,
110
- editModal: PropTypes.shape({
111
- isOpen: PropTypes.bool.isRequired,
112
- closeModal: PropTypes.func.isRequired,
113
- }).isRequired,
114
- testModal: PropTypes.shape({
115
- isOpen: PropTypes.bool.isRequired,
116
- closeModal: PropTypes.func.isRequired,
117
- }).isRequired,
118
- }).isRequired,
119
- };
120
-
121
- export default WebhooksTable;
@@ -1,48 +0,0 @@
1
- import { translate as __ } from 'foremanReact/common/I18n';
2
- import {
3
- column,
4
- sortableColumn,
5
- headerFormatterWithProps,
6
- } from 'foremanReact/components/common/table';
7
-
8
- import {
9
- enabledCellFormatter,
10
- nameToEditFormatter,
11
- actionCellFormatter,
12
- } from './Components/Formatters';
13
-
14
- const sortControllerFactory = (apiCall, sortBy, sortOrder) => ({
15
- apply: (by, order) => {
16
- apiCall({ sort: { by, order } });
17
- },
18
- property: sortBy,
19
- order: sortOrder,
20
- });
21
-
22
- const createWebhooksTableSchema = (
23
- apiCall,
24
- by,
25
- order,
26
- webhookActions,
27
- onEditClick
28
- ) => {
29
- const sortController = sortControllerFactory(apiCall, by, order);
30
-
31
- return [
32
- sortableColumn('name', __('Name'), 4, sortController, [
33
- nameToEditFormatter('webhooks', onEditClick),
34
- ]),
35
- sortableColumn('targetUrl', __('Target URL'), 4, sortController),
36
- sortableColumn('enabled', __('Enabled'), 2, sortController, [
37
- enabledCellFormatter(),
38
- ]),
39
- column(
40
- 'actions',
41
- __('Actions'),
42
- [headerFormatterWithProps],
43
- [actionCellFormatter(webhookActions)]
44
- ),
45
- ];
46
- };
47
-
48
- export default createWebhooksTableSchema;
@@ -1,64 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
-
3
- import {
4
- propsFactory,
5
- webhooks,
6
- } from '../../../__tests__/WebhooksIndexPage.fixtures';
7
- import WrappedWebhooksTable from '../index';
8
-
9
- const props = {
10
- fetchAndPush: jest.fn(),
11
- onDeleteClick: jest.fn(),
12
- setToDelete: jest.fn(),
13
- setToEdit: jest.fn(),
14
- setToTest: jest.fn(),
15
- reloadWithSearch: jest.fn(),
16
- itemCount: 0,
17
- canCreate: true,
18
- results: [],
19
- pagination: {
20
- page: 1,
21
- perPage: 20,
22
- },
23
- toDelete: {},
24
- toTest: {},
25
- toEdit: 0,
26
- };
27
-
28
- const fixtures = {
29
- 'should render when loading': propsFactory({
30
- ...props,
31
- isLoading: true,
32
- hasData: false,
33
- hasError: false,
34
- }),
35
- 'should render with no data': propsFactory({
36
- ...props,
37
- isLoading: false,
38
- hasData: false,
39
- hasError: false,
40
- }),
41
- 'should render with error': propsFactory({
42
- isLoading: false,
43
- hasData: false,
44
- hasError: true,
45
- message: {
46
- type: 'error',
47
- text: 'this is error',
48
- },
49
- ...props,
50
- }),
51
- 'should render with webhooks': propsFactory({
52
- ...props,
53
- isLoading: false,
54
- hasError: false,
55
- hasData: true,
56
- results: webhooks,
57
- itemCount: webhooks.length,
58
- }),
59
- };
60
-
61
- describe('WebhooksTable', () => {
62
- describe('rendering', () =>
63
- testComponentSnapshotsWithFixtures(WrappedWebhooksTable, fixtures));
64
- });
@@ -1,250 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`WebhooksTable rendering should render when loading 1`] = `
4
- <WebhooksTable
5
- canCreate={true}
6
- fetchAndPush={[MockFunction]}
7
- hasData={false}
8
- hasError={false}
9
- isLoading={true}
10
- itemCount={0}
11
- modalsStates={
12
- Object {
13
- "deleteModal": Object {
14
- "closeModal": [Function],
15
- "isOpen": false,
16
- },
17
- "editModal": Object {
18
- "closeModal": [Function],
19
- "isOpen": false,
20
- },
21
- "testModal": Object {
22
- "closeModal": [Function],
23
- "isOpen": false,
24
- },
25
- }
26
- }
27
- onDeleteClick={[MockFunction]}
28
- onEditClick={[Function]}
29
- onTestClick={[Function]}
30
- page={5}
31
- pagination={
32
- Object {
33
- "page": 1,
34
- "perPage": 20,
35
- }
36
- }
37
- per_page={42}
38
- reloadWithSearch={[MockFunction]}
39
- results={Array []}
40
- search="name=foo"
41
- sort={
42
- Object {
43
- "by": "defaultName",
44
- "order": "ASC",
45
- }
46
- }
47
- toDelete={Object {}}
48
- toEdit={0}
49
- toTest={Object {}}
50
- webhookActions={
51
- Object {
52
- "deleteWebhook": [Function],
53
- "testWebhook": [Function],
54
- }
55
- }
56
- />
57
- `;
58
-
59
- exports[`WebhooksTable rendering should render with error 1`] = `
60
- <WebhooksTable
61
- canCreate={true}
62
- fetchAndPush={[MockFunction]}
63
- hasData={false}
64
- hasError={true}
65
- isLoading={false}
66
- itemCount={0}
67
- message={
68
- Object {
69
- "text": "this is error",
70
- "type": "error",
71
- }
72
- }
73
- modalsStates={
74
- Object {
75
- "deleteModal": Object {
76
- "closeModal": [Function],
77
- "isOpen": false,
78
- },
79
- "editModal": Object {
80
- "closeModal": [Function],
81
- "isOpen": false,
82
- },
83
- "testModal": Object {
84
- "closeModal": [Function],
85
- "isOpen": false,
86
- },
87
- }
88
- }
89
- onDeleteClick={[MockFunction]}
90
- onEditClick={[Function]}
91
- onTestClick={[Function]}
92
- page={5}
93
- pagination={
94
- Object {
95
- "page": 1,
96
- "perPage": 20,
97
- }
98
- }
99
- per_page={42}
100
- reloadWithSearch={[MockFunction]}
101
- results={Array []}
102
- search="name=foo"
103
- sort={
104
- Object {
105
- "by": "defaultName",
106
- "order": "ASC",
107
- }
108
- }
109
- toDelete={Object {}}
110
- toEdit={0}
111
- toTest={Object {}}
112
- webhookActions={
113
- Object {
114
- "deleteWebhook": [Function],
115
- "testWebhook": [Function],
116
- }
117
- }
118
- />
119
- `;
120
-
121
- exports[`WebhooksTable rendering should render with no data 1`] = `
122
- <WebhooksTable
123
- canCreate={true}
124
- fetchAndPush={[MockFunction]}
125
- hasData={false}
126
- hasError={false}
127
- isLoading={false}
128
- itemCount={0}
129
- modalsStates={
130
- Object {
131
- "deleteModal": Object {
132
- "closeModal": [Function],
133
- "isOpen": false,
134
- },
135
- "editModal": Object {
136
- "closeModal": [Function],
137
- "isOpen": false,
138
- },
139
- "testModal": Object {
140
- "closeModal": [Function],
141
- "isOpen": false,
142
- },
143
- }
144
- }
145
- onDeleteClick={[MockFunction]}
146
- onEditClick={[Function]}
147
- onTestClick={[Function]}
148
- page={5}
149
- pagination={
150
- Object {
151
- "page": 1,
152
- "perPage": 20,
153
- }
154
- }
155
- per_page={42}
156
- reloadWithSearch={[MockFunction]}
157
- results={Array []}
158
- search="name=foo"
159
- sort={
160
- Object {
161
- "by": "defaultName",
162
- "order": "ASC",
163
- }
164
- }
165
- toDelete={Object {}}
166
- toEdit={0}
167
- toTest={Object {}}
168
- webhookActions={
169
- Object {
170
- "deleteWebhook": [Function],
171
- "testWebhook": [Function],
172
- }
173
- }
174
- />
175
- `;
176
-
177
- exports[`WebhooksTable rendering should render with webhooks 1`] = `
178
- <WebhooksTable
179
- canCreate={true}
180
- fetchAndPush={[MockFunction]}
181
- hasData={true}
182
- hasError={false}
183
- isLoading={false}
184
- itemCount={2}
185
- modalsStates={
186
- Object {
187
- "deleteModal": Object {
188
- "closeModal": [Function],
189
- "isOpen": false,
190
- },
191
- "editModal": Object {
192
- "closeModal": [Function],
193
- "isOpen": false,
194
- },
195
- "testModal": Object {
196
- "closeModal": [Function],
197
- "isOpen": false,
198
- },
199
- }
200
- }
201
- onDeleteClick={[MockFunction]}
202
- onEditClick={[Function]}
203
- onTestClick={[Function]}
204
- page={5}
205
- pagination={
206
- Object {
207
- "page": 1,
208
- "perPage": 20,
209
- }
210
- }
211
- per_page={42}
212
- reloadWithSearch={[MockFunction]}
213
- results={
214
- Array [
215
- Object {
216
- "canDelete": true,
217
- "canEdit": true,
218
- "enabled": true,
219
- "id": 1,
220
- "name": "my-webhook",
221
- "targetUrl": "https://my-machine.example.com",
222
- },
223
- Object {
224
- "canDelete": false,
225
- "canEdit": false,
226
- "enabled": false,
227
- "id": 2,
228
- "name": "your-webhook",
229
- "targetUrl": "https://your-machine.example.com",
230
- },
231
- ]
232
- }
233
- search="name=foo"
234
- sort={
235
- Object {
236
- "by": "defaultName",
237
- "order": "ASC",
238
- }
239
- }
240
- toDelete={Object {}}
241
- toEdit={0}
242
- toTest={Object {}}
243
- webhookActions={
244
- Object {
245
- "deleteWebhook": [Function],
246
- "testWebhook": [Function],
247
- }
248
- }
249
- />
250
- `;
@@ -1,76 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import WebhooksTable from './WebhooksTable';
5
-
6
- const WrappedWebhooksTable = props => {
7
- const [isTestModalOpen, setIsTestModalOpen] = useState(false);
8
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
9
- const [isEditModalOpen, setIsEditModalOpen] = useState(false);
10
-
11
- const { setToDelete, setToEdit, setToTest, ...rest } = props;
12
-
13
- const onDeleteClick = rowData => {
14
- setToDelete(rowData);
15
- setIsDeleteModalOpen(true);
16
- };
17
-
18
- const onEditClick = rowData => {
19
- setToEdit(rowData);
20
- setIsEditModalOpen(true);
21
- };
22
-
23
- const onTestClick = rowData => {
24
- setToTest(rowData);
25
- setIsTestModalOpen(true);
26
- };
27
-
28
- const webhookActions = {
29
- deleteWebhook: (id, name) => {
30
- onDeleteClick({ id, name });
31
- },
32
- testWebhook: (id, name) => {
33
- onTestClick({ id, name });
34
- },
35
- };
36
-
37
- return (
38
- <WebhooksTable
39
- onEditClick={onEditClick}
40
- onTestClick={onTestClick}
41
- modalsStates={{
42
- testModal: {
43
- isOpen: isTestModalOpen,
44
- closeModal: () => {
45
- setToTest({});
46
- setIsTestModalOpen(false);
47
- },
48
- },
49
- deleteModal: {
50
- isOpen: isDeleteModalOpen,
51
- closeModal: () => {
52
- setToDelete({});
53
- setIsDeleteModalOpen(false);
54
- },
55
- },
56
- editModal: {
57
- isOpen: isEditModalOpen,
58
- closeModal: () => {
59
- setToEdit(0);
60
- setIsEditModalOpen(false);
61
- },
62
- },
63
- }}
64
- webhookActions={webhookActions}
65
- {...rest}
66
- />
67
- );
68
- };
69
-
70
- WrappedWebhooksTable.propTypes = {
71
- setToDelete: PropTypes.func.isRequired,
72
- setToEdit: PropTypes.func.isRequired,
73
- setToTest: PropTypes.func.isRequired,
74
- };
75
-
76
- export default WrappedWebhooksTable;
@@ -1,17 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`WebhooksIndexPage redering render with minimal props 1`] = `
4
- <Provider
5
- store={
6
- Object {
7
- "dispatch": [Function],
8
- "getState": [Function],
9
- "replaceReducer": [Function],
10
- "subscribe": [Function],
11
- Symbol(Symbol.observable): [Function],
12
- }
13
- }
14
- >
15
- <WebhooksIndexPage />
16
- </Provider>
17
- `;
@@ -1,3 +0,0 @@
1
- import WebhooksIndexPage from './WebhooksIndexPage';
2
-
3
- export default WebhooksIndexPage;
@@ -1 +0,0 @@
1
- export const useForemanContext = jest.fn(() => {});
@@ -1,30 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
-
3
- export const withRenderHandler = ({ Component }) => componentProps => (
4
- <Component {...componentProps} />
5
- );
6
-
7
- export const callOnMount = callback => WrappedComponent => componentProps => {
8
- callback(componentProps);
9
-
10
- return <WrappedComponent {...componentProps} />;
11
- };
12
-
13
- export const callOnPopState = callback => WrappedComponent => componentProps => {
14
- const didMount = useRef(false);
15
- const {
16
- history: {
17
- action,
18
- location: { search },
19
- },
20
- } = componentProps;
21
- useEffect(() => {
22
- if (action === 'POP' && didMount.current) {
23
- callback(componentProps);
24
- } else {
25
- didMount.current = true;
26
- }
27
- }, [search, action, componentProps]);
28
-
29
- return <WrappedComponent {...componentProps} />;
30
- };
@@ -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,7 +0,0 @@
1
- export const getURIQuery = jest.fn(() => ({}));
2
-
3
- export const deepPropsToCamelCase = jest.fn(props => props);
4
-
5
- export const foremanUrl = jest.fn(() => '');
6
-
7
- export const noop = Function.prototype;
@@ -1,8 +0,0 @@
1
- export const getURIsearch = () => 'a=b';
2
-
3
- export const getParams = () => ({
4
- page: 1,
5
- perPage: 20,
6
- searchQuery: '',
7
- sort: {},
8
- });
@@ -1,2 +0,0 @@
1
- const ForemanModalActions = () => jest.fn();
2
- export default ForemanModalActions;
@@ -1,10 +0,0 @@
1
- const modalOpen = true;
2
- const setModalOpen = jest.fn();
3
- const setModalClosed = jest.fn();
4
-
5
- export const useForemanModal = jest.fn(() => ({
6
- modalOpen,
7
- setModalOpen,
8
- setModalClosed,
9
- }));
10
- export default useForemanModal;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const ForemanModal = ({ children }) => <div className="modal">{children}</div>;
5
- ForemanModal.Header = ({ children }) => (
6
- <div className="modal-header">{children}</div>
7
- );
8
- ForemanModal.Footer = ({ children }) => (
9
- <div className="modal-footer">{children}</div>
10
- );
11
-
12
- ForemanModal.propTypes = {
13
- children: PropTypes.node,
14
- };
15
-
16
- ForemanModal.defaultProps = {
17
- children: [],
18
- };
19
-
20
- ForemanModal.Header.propTypes = ForemanModal.propTypes;
21
- ForemanModal.Footer.propTypes = ForemanModal.propTypes;
22
-
23
- export default ForemanModal;
@@ -1,2 +0,0 @@
1
- export const showLoading = () => null;
2
- export const hideLoading = () => null;
@@ -1,2 +0,0 @@
1
- const Loading = () => jest.fn();
2
- export default Loading;
@@ -1,3 +0,0 @@
1
- import Loading from './Loading';
2
-
3
- export default Loading;