foreman_templates 7.0.1 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +16 -0
  3. data/lib/foreman_templates/version.rb +1 -1
  4. data/package.json +68 -0
  5. data/webpack/ForemanTemplates.js +29 -0
  6. data/webpack/Routes.js +33 -0
  7. data/webpack/__mocks__/foremanReact/common/helpers.js +27 -0
  8. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +2 -0
  9. data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
  10. data/webpack/__mocks__/foremanReact/components/common/forms/Form.js +2 -0
  11. data/webpack/__mocks__/foremanReact/components/common/forms/TextField.js +2 -0
  12. data/webpack/__mocks__/foremanReact/redux/actions/common/forms.js +1 -0
  13. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +2 -0
  14. data/webpack/__tests__/__snapshots__/helpers.test.js.snap +5 -0
  15. data/webpack/__tests__/helpers.test.js +17 -0
  16. data/webpack/components/NewTemplateSync/NewTemplateSync.js +60 -0
  17. data/webpack/components/NewTemplateSync/NewTemplateSync.scss +19 -0
  18. data/webpack/components/NewTemplateSync/NewTemplateSyncActions.js +39 -0
  19. data/webpack/components/NewTemplateSync/NewTemplateSyncReducer.js +34 -0
  20. data/webpack/components/NewTemplateSync/NewTemplateSyncSelectors.js +7 -0
  21. data/webpack/components/NewTemplateSync/__fixtures__/templateSyncSettings.fixtures.js +71 -0
  22. data/webpack/components/NewTemplateSync/__tests__/NewTemplateSync.test.js +31 -0
  23. data/webpack/components/NewTemplateSync/__tests__/NewTemplateSyncReducer.test.js +55 -0
  24. data/webpack/components/NewTemplateSync/__tests__/NewTemplateSyncSelectors.test.js +28 -0
  25. data/webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSync.test.js.snap +53 -0
  26. data/webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSyncReducer.test.js.snap +74 -0
  27. data/webpack/components/NewTemplateSync/__tests__/__snapshots__/NewTemplateSyncSelectors.test.js.snap +59 -0
  28. data/webpack/components/NewTemplateSync/components/ButtonTooltip.js +23 -0
  29. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncForm.js +145 -0
  30. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormConstants.js +1 -0
  31. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/NewTemplateSyncFormSelectors.js +24 -0
  32. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncForm.test.js +42 -0
  33. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/NewTemplateSyncFormSelectors.test.js +37 -0
  34. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncForm.test.js.snap +176 -0
  35. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/__tests__/__snapshots__/NewTemplateSyncFormSelectors.test.js.snap +42 -0
  36. data/webpack/components/NewTemplateSync/components/NewTemplateSyncForm/index.js +44 -0
  37. data/webpack/components/NewTemplateSync/components/SyncSettingField.js +54 -0
  38. data/webpack/components/NewTemplateSync/components/SyncSettingFields.js +69 -0
  39. data/webpack/components/NewTemplateSync/components/SyncTypeRadios.js +52 -0
  40. data/webpack/components/NewTemplateSync/components/TextButtonField/BlankOption.js +19 -0
  41. data/webpack/components/NewTemplateSync/components/TextButtonField/CheckboxField.js +15 -0
  42. data/webpack/components/NewTemplateSync/components/TextButtonField/FieldType.js +46 -0
  43. data/webpack/components/NewTemplateSync/components/TextButtonField/InputField.js +14 -0
  44. data/webpack/components/NewTemplateSync/components/TextButtonField/RenderField.js +74 -0
  45. data/webpack/components/NewTemplateSync/components/TextButtonField/SelectField.js +24 -0
  46. data/webpack/components/NewTemplateSync/components/TextButtonField/index.js +69 -0
  47. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingField.test.js +34 -0
  48. data/webpack/components/NewTemplateSync/components/__tests__/SyncSettingFields.test.js +33 -0
  49. data/webpack/components/NewTemplateSync/components/__tests__/SyncTypeRadios.test.js +20 -0
  50. data/webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js +65 -0
  51. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingField.test.js.snap +131 -0
  52. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncSettingFields.test.js.snap +94 -0
  53. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/SyncTypeRadios.test.js.snap +46 -0
  54. data/webpack/components/NewTemplateSync/components/__tests__/__snapshots__/TextButtonField.test.js.snap +112 -0
  55. data/webpack/components/NewTemplateSync/index.js +32 -0
  56. data/webpack/components/PageNotFound.js +13 -0
  57. data/webpack/components/PermissionDenied.js +33 -0
  58. data/webpack/components/TemplateSyncResult/TemplateSyncResult.js +61 -0
  59. data/webpack/components/TemplateSyncResult/TemplateSyncResult.scss +39 -0
  60. data/webpack/components/TemplateSyncResult/TemplateSyncResultActions.js +4 -0
  61. data/webpack/components/TemplateSyncResult/TemplateSyncResultHelpers.js +6 -0
  62. data/webpack/components/TemplateSyncResult/TemplateSyncResultReducer.js +33 -0
  63. data/webpack/components/TemplateSyncResult/TemplateSyncResultSelectors.js +1 -0
  64. data/webpack/components/TemplateSyncResult/__fixtures__/templateSyncResult.fixtures.js +86 -0
  65. data/webpack/components/TemplateSyncResult/__tests__/TemplateSyncResult.test.js +37 -0
  66. data/webpack/components/TemplateSyncResult/__tests__/TemplateSyncResultReducer.test.js +48 -0
  67. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResult.test.js.snap +112 -0
  68. data/webpack/components/TemplateSyncResult/__tests__/__snapshots__/TemplateSyncResultReducer.test.js.snap +88 -0
  69. data/webpack/components/TemplateSyncResult/components/EmptySyncResult.js +25 -0
  70. data/webpack/components/TemplateSyncResult/components/FinishedSyncResult.js +77 -0
  71. data/webpack/components/TemplateSyncResult/components/ListViewHeader.js +38 -0
  72. data/webpack/components/TemplateSyncResult/components/SyncResultList.js +41 -0
  73. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/EmptyInfoItem.js +16 -0
  74. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/IconInfoItem.js +21 -0
  75. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/InfoItem.js +34 -0
  76. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/LinkInfoItem.js +37 -0
  77. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/StringInfoItem.js +50 -0
  78. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/helpers.js +128 -0
  79. data/webpack/components/TemplateSyncResult/components/SyncedTemplate/index.js +33 -0
  80. data/webpack/components/TemplateSyncResult/components/__tests__/SyncResultList.test.js +27 -0
  81. data/webpack/components/TemplateSyncResult/components/__tests__/SyncedTemplate.test.js +30 -0
  82. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncResultList.test.js.snap +102 -0
  83. data/webpack/components/TemplateSyncResult/components/__tests__/__snapshots__/SyncedTemplate.test.js.snap +548 -0
  84. data/webpack/components/TemplateSyncResult/index.js +13 -0
  85. data/webpack/consts.js +6 -0
  86. data/webpack/index.js +11 -0
  87. data/webpack/reducer.js +6 -0
  88. data/webpack/testSetup.js +11 -0
  89. data/webpack/withProtectedView.js +16 -0
  90. metadata +89 -2
@@ -0,0 +1,548 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`SyncedTemplate should render skipped template 1`] = `
4
+ <ListViewItem
5
+ actions={null}
6
+ additionalInfo={
7
+ Array [
8
+ <LinkInfoItem
9
+ attr="name"
10
+ editPath="/ptables/:id/edit"
11
+ template={
12
+ Object {
13
+ "additionalErrors": null,
14
+ "additionalInfo": "Skipping, this template was filtered out.",
15
+ "className": "Ptable",
16
+ "errors": Object {},
17
+ "humanizedClassName": "Ptable",
18
+ "locked": false,
19
+ "name": "CoreOS default",
20
+ "snippet": false,
21
+ "templateFile": "coreos_default.erb",
22
+ }
23
+ }
24
+ />,
25
+ <EmptyInfoItem
26
+ attr="locked"
27
+ template={
28
+ Object {
29
+ "additionalErrors": null,
30
+ "additionalInfo": "Skipping, this template was filtered out.",
31
+ "className": "Ptable",
32
+ "errors": Object {},
33
+ "humanizedClassName": "Ptable",
34
+ "locked": false,
35
+ "name": "CoreOS default",
36
+ "snippet": false,
37
+ "templateFile": "coreos_default.erb",
38
+ }
39
+ }
40
+ />,
41
+ <EmptyInfoItem
42
+ attr="snippet"
43
+ template={
44
+ Object {
45
+ "additionalErrors": null,
46
+ "additionalInfo": "Skipping, this template was filtered out.",
47
+ "className": "Ptable",
48
+ "errors": Object {},
49
+ "humanizedClassName": "Ptable",
50
+ "locked": false,
51
+ "name": "CoreOS default",
52
+ "snippet": false,
53
+ "templateFile": "coreos_default.erb",
54
+ }
55
+ }
56
+ />,
57
+ <StringInfoItem
58
+ attr="humanizedClassName"
59
+ elipsed={false}
60
+ mapAttr={[Function]}
61
+ template={
62
+ Object {
63
+ "additionalErrors": null,
64
+ "additionalInfo": "Skipping, this template was filtered out.",
65
+ "className": "Ptable",
66
+ "errors": Object {},
67
+ "humanizedClassName": "Ptable",
68
+ "locked": false,
69
+ "name": "CoreOS default",
70
+ "snippet": false,
71
+ "templateFile": "coreos_default.erb",
72
+ }
73
+ }
74
+ translate={true}
75
+ />,
76
+ <EmptyInfoItem
77
+ attr="kind"
78
+ template={
79
+ Object {
80
+ "additionalErrors": null,
81
+ "additionalInfo": "Skipping, this template was filtered out.",
82
+ "className": "Ptable",
83
+ "errors": Object {},
84
+ "humanizedClassName": "Ptable",
85
+ "locked": false,
86
+ "name": "CoreOS default",
87
+ "snippet": false,
88
+ "templateFile": "coreos_default.erb",
89
+ }
90
+ }
91
+ />,
92
+ <StringInfoItem
93
+ attr="templateFile"
94
+ elipsed={true}
95
+ mapAttr={[Function]}
96
+ template={
97
+ Object {
98
+ "additionalErrors": null,
99
+ "additionalInfo": "Skipping, this template was filtered out.",
100
+ "className": "Ptable",
101
+ "errors": Object {},
102
+ "humanizedClassName": "Ptable",
103
+ "locked": false,
104
+ "name": "CoreOS default",
105
+ "snippet": false,
106
+ "templateFile": "coreos_default.erb",
107
+ }
108
+ }
109
+ translate={false}
110
+ />,
111
+ ]
112
+ }
113
+ checkboxInput={null}
114
+ className="listViewItem--listItemVariants"
115
+ compoundExpand={false}
116
+ compoundExpanded={false}
117
+ description={null}
118
+ heading={null}
119
+ hideCloseIcon={true}
120
+ initExpanded={false}
121
+ leftContent={
122
+ <Icon
123
+ name="warning-triangle-o"
124
+ size="sm"
125
+ type="pf"
126
+ />
127
+ }
128
+ onCloseCompoundExpand={[Function]}
129
+ onExpand={[Function]}
130
+ onExpandClose={[Function]}
131
+ stacked={true}
132
+ >
133
+ <ul>
134
+ <li
135
+ key="coreos_default.erb-info"
136
+ >
137
+ Skipping, this template was filtered out.
138
+ </li>
139
+ </ul>
140
+ </ListViewItem>
141
+ `;
142
+
143
+ exports[`SyncedTemplate should render template with invalid metadata 1`] = `
144
+ <ListViewItem
145
+ actions={null}
146
+ additionalInfo={
147
+ Array [
148
+ <EmptyInfoItem
149
+ attr="name"
150
+ template={
151
+ Object {
152
+ "additionalErrors": "No \\"name\\" found in metadata",
153
+ "errors": null,
154
+ "name": null,
155
+ "templateFile": "random_template.erb",
156
+ }
157
+ }
158
+ />,
159
+ <EmptyInfoItem
160
+ attr="locked"
161
+ template={
162
+ Object {
163
+ "additionalErrors": "No \\"name\\" found in metadata",
164
+ "errors": null,
165
+ "name": null,
166
+ "templateFile": "random_template.erb",
167
+ }
168
+ }
169
+ />,
170
+ <EmptyInfoItem
171
+ attr="snippet"
172
+ template={
173
+ Object {
174
+ "additionalErrors": "No \\"name\\" found in metadata",
175
+ "errors": null,
176
+ "name": null,
177
+ "templateFile": "random_template.erb",
178
+ }
179
+ }
180
+ />,
181
+ <EmptyInfoItem
182
+ attr="humanizedClassName"
183
+ template={
184
+ Object {
185
+ "additionalErrors": "No \\"name\\" found in metadata",
186
+ "errors": null,
187
+ "name": null,
188
+ "templateFile": "random_template.erb",
189
+ }
190
+ }
191
+ />,
192
+ <EmptyInfoItem
193
+ attr="kind"
194
+ template={
195
+ Object {
196
+ "additionalErrors": "No \\"name\\" found in metadata",
197
+ "errors": null,
198
+ "name": null,
199
+ "templateFile": "random_template.erb",
200
+ }
201
+ }
202
+ />,
203
+ <StringInfoItem
204
+ attr="templateFile"
205
+ elipsed={true}
206
+ mapAttr={[Function]}
207
+ template={
208
+ Object {
209
+ "additionalErrors": "No \\"name\\" found in metadata",
210
+ "errors": null,
211
+ "name": null,
212
+ "templateFile": "random_template.erb",
213
+ }
214
+ }
215
+ translate={false}
216
+ />,
217
+ ]
218
+ }
219
+ checkboxInput={null}
220
+ className="listViewItem--listItemVariants"
221
+ compoundExpand={false}
222
+ compoundExpanded={false}
223
+ description={null}
224
+ heading={null}
225
+ hideCloseIcon={true}
226
+ initExpanded={false}
227
+ leftContent={
228
+ <Icon
229
+ name="error-circle-o"
230
+ size="sm"
231
+ type="pf"
232
+ />
233
+ }
234
+ onCloseCompoundExpand={[Function]}
235
+ onExpand={[Function]}
236
+ onExpandClose={[Function]}
237
+ stacked={true}
238
+ >
239
+ <ul>
240
+ <li
241
+ key="random_template.erb-additional"
242
+ >
243
+ No "name" found in metadata
244
+ </li>
245
+ </ul>
246
+ </ListViewItem>
247
+ `;
248
+
249
+ exports[`SyncedTemplate should render template with validation errors 1`] = `
250
+ <ListViewItem
251
+ actions={null}
252
+ additionalInfo={
253
+ Array [
254
+ <LinkInfoItem
255
+ attr="name"
256
+ editPath="/templates/:id/edit"
257
+ template={
258
+ Object {
259
+ "additionalErrors": null,
260
+ "className": "ProvisioningTemplate",
261
+ "errors": Object {
262
+ "base": Array [
263
+ "This template is locked",
264
+ ],
265
+ },
266
+ "humanizedClassName": "Provisioning Template",
267
+ "kind": "Provision",
268
+ "locked": true,
269
+ "name": "EPEL",
270
+ "snippet": true,
271
+ "templateFile": "epel.erb",
272
+ }
273
+ }
274
+ />,
275
+ <IconInfoItem
276
+ attr="locked"
277
+ iconName="lock"
278
+ template={
279
+ Object {
280
+ "additionalErrors": null,
281
+ "className": "ProvisioningTemplate",
282
+ "errors": Object {
283
+ "base": Array [
284
+ "This template is locked",
285
+ ],
286
+ },
287
+ "humanizedClassName": "Provisioning Template",
288
+ "kind": "Provision",
289
+ "locked": true,
290
+ "name": "EPEL",
291
+ "snippet": true,
292
+ "templateFile": "epel.erb",
293
+ }
294
+ }
295
+ tooltipText="Locked"
296
+ />,
297
+ <IconInfoItem
298
+ attr="snippet"
299
+ iconName="check"
300
+ template={
301
+ Object {
302
+ "additionalErrors": null,
303
+ "className": "ProvisioningTemplate",
304
+ "errors": Object {
305
+ "base": Array [
306
+ "This template is locked",
307
+ ],
308
+ },
309
+ "humanizedClassName": "Provisioning Template",
310
+ "kind": "Provision",
311
+ "locked": true,
312
+ "name": "EPEL",
313
+ "snippet": true,
314
+ "templateFile": "epel.erb",
315
+ }
316
+ }
317
+ tooltipText="Snippet"
318
+ />,
319
+ <StringInfoItem
320
+ attr="humanizedClassName"
321
+ elipsed={false}
322
+ mapAttr={[Function]}
323
+ template={
324
+ Object {
325
+ "additionalErrors": null,
326
+ "className": "ProvisioningTemplate",
327
+ "errors": Object {
328
+ "base": Array [
329
+ "This template is locked",
330
+ ],
331
+ },
332
+ "humanizedClassName": "Provisioning Template",
333
+ "kind": "Provision",
334
+ "locked": true,
335
+ "name": "EPEL",
336
+ "snippet": true,
337
+ "templateFile": "epel.erb",
338
+ }
339
+ }
340
+ translate={true}
341
+ />,
342
+ <StringInfoItem
343
+ attr="kind"
344
+ elipsed={false}
345
+ mapAttr={[Function]}
346
+ template={
347
+ Object {
348
+ "additionalErrors": null,
349
+ "className": "ProvisioningTemplate",
350
+ "errors": Object {
351
+ "base": Array [
352
+ "This template is locked",
353
+ ],
354
+ },
355
+ "humanizedClassName": "Provisioning Template",
356
+ "kind": "Provision",
357
+ "locked": true,
358
+ "name": "EPEL",
359
+ "snippet": true,
360
+ "templateFile": "epel.erb",
361
+ }
362
+ }
363
+ translate={false}
364
+ />,
365
+ <StringInfoItem
366
+ attr="templateFile"
367
+ elipsed={true}
368
+ mapAttr={[Function]}
369
+ template={
370
+ Object {
371
+ "additionalErrors": null,
372
+ "className": "ProvisioningTemplate",
373
+ "errors": Object {
374
+ "base": Array [
375
+ "This template is locked",
376
+ ],
377
+ },
378
+ "humanizedClassName": "Provisioning Template",
379
+ "kind": "Provision",
380
+ "locked": true,
381
+ "name": "EPEL",
382
+ "snippet": true,
383
+ "templateFile": "epel.erb",
384
+ }
385
+ }
386
+ translate={false}
387
+ />,
388
+ ]
389
+ }
390
+ checkboxInput={null}
391
+ className="listViewItem--listItemVariants"
392
+ compoundExpand={false}
393
+ compoundExpanded={false}
394
+ description={null}
395
+ heading={null}
396
+ hideCloseIcon={true}
397
+ initExpanded={false}
398
+ leftContent={
399
+ <Icon
400
+ name="error-circle-o"
401
+ size="sm"
402
+ type="pf"
403
+ />
404
+ }
405
+ onCloseCompoundExpand={[Function]}
406
+ onExpand={[Function]}
407
+ onExpandClose={[Function]}
408
+ stacked={true}
409
+ >
410
+ <ul>
411
+ <li
412
+ key="epel.erb-base"
413
+ >
414
+ This template is locked
415
+ </li>
416
+ </ul>
417
+ </ListViewItem>
418
+ `;
419
+
420
+ exports[`SyncedTemplate should render template without errros 1`] = `
421
+ <ListViewItem
422
+ actions={null}
423
+ additionalInfo={
424
+ Array [
425
+ <LinkInfoItem
426
+ attr="name"
427
+ editPath="/ptables/:id/edit"
428
+ template={
429
+ Object {
430
+ "additionalErrors": null,
431
+ "className": "Ptable",
432
+ "errors": Object {},
433
+ "humanizedClassName": "Ptable",
434
+ "locked": false,
435
+ "name": "CoreOS default",
436
+ "snippet": false,
437
+ "templateFile": "coreos_default.erb",
438
+ }
439
+ }
440
+ />,
441
+ <EmptyInfoItem
442
+ attr="locked"
443
+ template={
444
+ Object {
445
+ "additionalErrors": null,
446
+ "className": "Ptable",
447
+ "errors": Object {},
448
+ "humanizedClassName": "Ptable",
449
+ "locked": false,
450
+ "name": "CoreOS default",
451
+ "snippet": false,
452
+ "templateFile": "coreos_default.erb",
453
+ }
454
+ }
455
+ />,
456
+ <EmptyInfoItem
457
+ attr="snippet"
458
+ template={
459
+ Object {
460
+ "additionalErrors": null,
461
+ "className": "Ptable",
462
+ "errors": Object {},
463
+ "humanizedClassName": "Ptable",
464
+ "locked": false,
465
+ "name": "CoreOS default",
466
+ "snippet": false,
467
+ "templateFile": "coreos_default.erb",
468
+ }
469
+ }
470
+ />,
471
+ <StringInfoItem
472
+ attr="humanizedClassName"
473
+ elipsed={false}
474
+ mapAttr={[Function]}
475
+ template={
476
+ Object {
477
+ "additionalErrors": null,
478
+ "className": "Ptable",
479
+ "errors": Object {},
480
+ "humanizedClassName": "Ptable",
481
+ "locked": false,
482
+ "name": "CoreOS default",
483
+ "snippet": false,
484
+ "templateFile": "coreos_default.erb",
485
+ }
486
+ }
487
+ translate={true}
488
+ />,
489
+ <EmptyInfoItem
490
+ attr="kind"
491
+ template={
492
+ Object {
493
+ "additionalErrors": null,
494
+ "className": "Ptable",
495
+ "errors": Object {},
496
+ "humanizedClassName": "Ptable",
497
+ "locked": false,
498
+ "name": "CoreOS default",
499
+ "snippet": false,
500
+ "templateFile": "coreos_default.erb",
501
+ }
502
+ }
503
+ />,
504
+ <StringInfoItem
505
+ attr="templateFile"
506
+ elipsed={true}
507
+ mapAttr={[Function]}
508
+ template={
509
+ Object {
510
+ "additionalErrors": null,
511
+ "className": "Ptable",
512
+ "errors": Object {},
513
+ "humanizedClassName": "Ptable",
514
+ "locked": false,
515
+ "name": "CoreOS default",
516
+ "snippet": false,
517
+ "templateFile": "coreos_default.erb",
518
+ }
519
+ }
520
+ translate={false}
521
+ />,
522
+ ]
523
+ }
524
+ checkboxInput={null}
525
+ className="listViewItem--listItemVariants"
526
+ compoundExpand={false}
527
+ compoundExpanded={false}
528
+ description={null}
529
+ heading={null}
530
+ hideCloseIcon={true}
531
+ initExpanded={false}
532
+ leftContent={
533
+ <Icon
534
+ name="ok"
535
+ size="sm"
536
+ type="pf"
537
+ />
538
+ }
539
+ onCloseCompoundExpand={[Function]}
540
+ onExpand={[Function]}
541
+ onExpandClose={[Function]}
542
+ stacked={true}
543
+ >
544
+ <span>
545
+ There were no errors.
546
+ </span>
547
+ </ListViewItem>
548
+ `;
@@ -0,0 +1,13 @@
1
+ import { connect } from 'react-redux';
2
+
3
+ import TemplateSyncResult from './TemplateSyncResult';
4
+ import * as TemplateSyncResultActions from './TemplateSyncResultActions';
5
+
6
+ import { selectSyncResult } from './TemplateSyncResultSelectors';
7
+
8
+ const mapStateToProps = state => ({ syncResult: selectSyncResult(state) });
9
+
10
+ export default connect(
11
+ mapStateToProps,
12
+ TemplateSyncResultActions
13
+ )(TemplateSyncResult);
data/webpack/consts.js ADDED
@@ -0,0 +1,6 @@
1
+ export const SYNC_SETTINGS_REQUEST = 'SYNC_SETTINGS_REQUEST';
2
+ export const SYNC_SETTINGS_SUCCESS = 'SYNC_SETTINGS_SUCCESS';
3
+ export const SYNC_SETTINGS_FAILURE = 'SYNC_SETTINGS_FAILURE';
4
+
5
+ export const TEMPLATESYNC_FORM_SUBMITTED = 'TEMPLATESYNC_FORM_SUBMITTED';
6
+ export const SYNC_RESULT_PAGINATION_CHANGE = 'SYNC_RESULT_PAGINATION_CHANGE';
data/webpack/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import componentRegistry from 'foremanReact/components/componentRegistry';
2
+ import injectReducer from 'foremanReact/redux/reducers/registerReducer';
3
+ import ForemanTemplates from './ForemanTemplates';
4
+ import templateSyncReducer from './reducer';
5
+
6
+ componentRegistry.register({
7
+ name: 'ForemanTemplates',
8
+ type: ForemanTemplates,
9
+ });
10
+
11
+ injectReducer('foremanTemplates', templateSyncReducer);
@@ -0,0 +1,6 @@
1
+ import { combineReducers } from 'redux';
2
+
3
+ import syncSettings from './components/NewTemplateSync/NewTemplateSyncReducer';
4
+ import syncResult from './components/TemplateSyncResult/TemplateSyncResultReducer';
5
+
6
+ export default combineReducers({ syncSettings, syncResult });
@@ -0,0 +1,11 @@
1
+ import 'babel-polyfill';
2
+
3
+ import { configure } from 'enzyme';
4
+ import Adapter from 'enzyme-adapter-react-16';
5
+
6
+ configure({ adapter: new Adapter() });
7
+
8
+ // Mocking translation function
9
+ global.__ = str => str;
10
+ global.n__ = str => str;
11
+ global.Jed = { sprintf: str => str };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ // TODO: extract to core
4
+ const withProtectedView = (
5
+ ProtectedComponent,
6
+ ProtectionComponent,
7
+ protectionFn,
8
+ extraProtectionProps = {}
9
+ ) => props =>
10
+ protectionFn(props) ? (
11
+ <ProtectedComponent {...props} />
12
+ ) : (
13
+ <ProtectionComponent {...props} {...extraProtectionProps} />
14
+ );
15
+
16
+ export default withProtectedView;