foreman_leapp 0.0.6 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -20
  3. data/app/controllers/api/v2/concerns/api_authorizer.rb +27 -0
  4. data/app/controllers/api/v2/preupgrade_reports_controller.rb +21 -2
  5. data/app/controllers/preupgrade_reports_controller.rb +11 -1
  6. data/app/lib/actions/preupgrade_job.rb +2 -1
  7. data/app/lib/helpers/job_helper.rb +3 -4
  8. data/app/models/preupgrade_report.rb +1 -0
  9. data/app/models/preupgrade_report_entry.rb +1 -0
  10. data/app/views/api/v2/preupgrade_report_entries/base.json.rabl +1 -1
  11. data/app/views/api/v2/preupgrade_reports/job_invocation.json.rabl +3 -0
  12. data/app/views/foreman_leapp/job_templates/leapp_check.erb +15 -0
  13. data/app/views/foreman_leapp/job_templates/{preupgrade.erb → leapp_preupgrade.erb} +5 -2
  14. data/app/views/foreman_leapp/job_templates/leapp_remediation.erb +29 -0
  15. data/app/views/foreman_leapp/job_templates/{upgrade.erb → leapp_upgrade.erb} +9 -7
  16. data/config/routes.rb +2 -1
  17. data/db/migrate/20200429080939_report_entries_flags.rb +5 -0
  18. data/db/seeds.d/10_leapp_preupgrade.rb +1 -1
  19. data/lib/foreman_leapp/engine.rb +7 -6
  20. data/lib/foreman_leapp/version.rb +1 -1
  21. data/locale/action_names.rb +6 -0
  22. data/locale/en/foreman_leapp.po +104 -2
  23. data/locale/foreman_leapp.pot +164 -8
  24. data/package.json +3 -2
  25. data/test/functional/api/v2/preupgrade_reports_controller_test.rb +89 -6
  26. data/test/functional/preupgrade_reports_controller_test.rb +27 -4
  27. data/test/unit/actions/preupgrade_job_test.rb +1 -1
  28. data/test/unit/helpers/job_helper_test.rb +3 -10
  29. data/webpack/__mocks__/foremanReact/common/I18n.js +1 -1
  30. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +1 -0
  31. data/webpack/components/PreupgradeReports/PreupgradeReports.js +104 -21
  32. data/webpack/components/PreupgradeReports/PreupgradeReportsActions.js +1 -1
  33. data/webpack/components/PreupgradeReports/PreupgradeReportsHelpers.js +132 -15
  34. data/webpack/components/PreupgradeReports/PreupgradeReportsReducer.js +2 -0
  35. data/webpack/components/PreupgradeReports/PreupgradeReportsSelectors.js +10 -0
  36. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReports.fixtures.js +45 -7
  37. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReports.test.js +17 -1
  38. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReportsHelpers.test.js +43 -3
  39. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReports.test.js.snap +82 -134
  40. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsHelpers.test.js.snap +409 -2
  41. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsReducer.test.js.snap +21 -1
  42. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsSelectors.test.js.snap +17 -1
  43. data/webpack/components/PreupgradeReports/components/EntriesFilter.js +121 -0
  44. data/webpack/components/PreupgradeReports/components/EntriesFilter.scss +3 -0
  45. data/webpack/components/PreupgradeReports/components/EntriesFilter.test.js +30 -0
  46. data/webpack/components/PreupgradeReports/components/{FixAllButton.js → FixSelectedButton.js} +6 -8
  47. data/webpack/components/PreupgradeReports/components/FixSelectedButton.test.js +15 -0
  48. data/webpack/components/PreupgradeReports/components/NoReports.js +35 -0
  49. data/webpack/components/PreupgradeReports/components/NoReports.test.js +15 -0
  50. data/webpack/components/PreupgradeReports/components/UpgradeAllButton.js +29 -0
  51. data/webpack/components/PreupgradeReports/components/{FixAllButton.test.js → UpgradeAllButton.test.js} +3 -4
  52. data/webpack/components/PreupgradeReports/components/__snapshots__/EntriesFilter.test.js.snap +330 -0
  53. data/webpack/components/PreupgradeReports/components/__snapshots__/{FixAllButton.test.js.snap → FixSelectedButton.test.js.snap} +9 -3
  54. data/webpack/components/PreupgradeReports/components/__snapshots__/NoReports.test.js.snap +19 -0
  55. data/webpack/components/PreupgradeReports/components/__snapshots__/UpgradeAllButton.test.js.snap +29 -0
  56. data/webpack/components/PreupgradeReports/index.js +22 -4
  57. data/webpack/components/PreupgradeReportsList/PreupgradeReportList.scss +37 -0
  58. data/webpack/components/PreupgradeReportsList/__tests__/PreupgradeReportsList.test.js +16 -0
  59. data/webpack/components/PreupgradeReportsList/__tests__/__snapshots__/PreupgradeReportsList.test.js.snap +38 -0
  60. data/webpack/components/PreupgradeReportsList/components/InfoItem.js +1 -1
  61. data/webpack/components/PreupgradeReportsList/components/InhibitorInfoItem.js +33 -0
  62. data/webpack/components/PreupgradeReportsList/components/PreupgradeReportEntry.js +19 -9
  63. data/webpack/components/PreupgradeReportsList/components/PreupgradeReportsListHeader.js +56 -0
  64. data/webpack/components/PreupgradeReportsList/components/SortableHeaderItem.js +50 -0
  65. data/webpack/components/PreupgradeReportsList/components/__tests__/InhibitorInfoItem.test.js +27 -0
  66. data/webpack/components/PreupgradeReportsList/components/__tests__/PreupgradeReportEntry.test.js +2 -0
  67. data/webpack/components/PreupgradeReportsList/components/__tests__/PreupgradeReportsListHeader.test.js +14 -0
  68. data/webpack/components/PreupgradeReportsList/components/__tests__/SortableHeaderItem.test.js +29 -0
  69. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/InhibitorInfoItem.test.js.snap +32 -0
  70. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/PreupgradeReportEntry.test.js.snap +23 -17
  71. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/PreupgradeReportsListHeader.test.js.snap +113 -0
  72. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/SortableHeaderItem.test.js.snap +36 -0
  73. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/helpers.test.js.snap +4 -10
  74. data/webpack/components/PreupgradeReportsList/components/__tests__/helpers.test.js +0 -2
  75. data/webpack/components/PreupgradeReportsList/components/foreman_leapp.scss +7 -1
  76. data/webpack/components/PreupgradeReportsList/components/helpers.js +47 -19
  77. data/webpack/components/PreupgradeReportsList/components/images/i_severity-critical.svg +61 -0
  78. data/webpack/components/PreupgradeReportsList/components/images/i_severity-high.svg +61 -0
  79. data/webpack/components/PreupgradeReportsList/components/images/i_severity-low.svg +62 -0
  80. data/webpack/components/PreupgradeReportsList/components/images/i_severity-med.svg +62 -0
  81. data/webpack/components/PreupgradeReportsList/index.js +28 -3
  82. metadata +54 -18
  83. data/app/views/foreman_leapp/job_templates/remediation.erb +0 -17
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PreupgradeReportsHelpers should collect ids for job invocation 1`] = `
3
+ exports[`PreupgradeReportsHelpers should collect ids for job invocation from reports 1`] = `
4
4
  Object {
5
5
  "entryIds": Array [],
6
6
  "hostIds": Array [],
@@ -21,19 +21,135 @@ exports[`PreupgradeReportsHelpers should detect no entry is fixable 1`] = `false
21
21
 
22
22
  exports[`PreupgradeReportsHelpers should detect non-empty object 1`] = `false`;
23
23
 
24
+ exports[`PreupgradeReportsHelpers should filter entries by host 1`] = `
25
+ Array [
26
+ Object {
27
+ "flags": Array [
28
+ "inhibitor",
29
+ ],
30
+ "hostname": "foo.example.com",
31
+ "id": 44,
32
+ "severity": "high",
33
+ "title": "Octocat is not happy",
34
+ },
35
+ Object {
36
+ "flags": Array [],
37
+ "hostname": "foo.example.com",
38
+ "id": 45,
39
+ "severity": "low",
40
+ "title": "Not enough credits",
41
+ },
42
+ Object {
43
+ "flags": Array [],
44
+ "hostname": "foo.example.com",
45
+ "id": 46,
46
+ "severity": "medium",
47
+ "title": "SELinux is turned off",
48
+ },
49
+ Object {
50
+ "flags": Array [],
51
+ "hostname": "foo.example.com",
52
+ "id": 47,
53
+ "severity": "medium",
54
+ "title": "Root password is too short",
55
+ },
56
+ Object {
57
+ "flags": Array [],
58
+ "hostname": "foo.example.com",
59
+ "id": 49,
60
+ "severity": "high",
61
+ "title": "No chocolate chip cookies in cookie jar",
62
+ },
63
+ ]
64
+ `;
65
+
66
+ exports[`PreupgradeReportsHelpers should filter entries by inhibitor 1`] = `
67
+ Array [
68
+ Object {
69
+ "flags": Array [
70
+ "inhibitor",
71
+ ],
72
+ "hostname": "foo.example.com",
73
+ "id": 44,
74
+ "severity": "high",
75
+ "title": "Octocat is not happy",
76
+ },
77
+ ]
78
+ `;
79
+
80
+ exports[`PreupgradeReportsHelpers should filter entries by remediations 1`] = `
81
+ Array [
82
+ Object {
83
+ "detail": Object {
84
+ "remediations": Array [
85
+ Object {
86
+ "type": "command",
87
+ },
88
+ ],
89
+ },
90
+ "severity": "high",
91
+ "title": "Octocat is not happy",
92
+ },
93
+ ]
94
+ `;
95
+
96
+ exports[`PreupgradeReportsHelpers should filter entries by severity 1`] = `
97
+ Array [
98
+ Object {
99
+ "flags": Array [],
100
+ "hostname": "host.example.com",
101
+ "id": 43,
102
+ "severity": "medium",
103
+ "title": "I am broken too",
104
+ },
105
+ Object {
106
+ "flags": Array [],
107
+ "hostname": "foo.example.com",
108
+ "id": 46,
109
+ "severity": "medium",
110
+ "title": "SELinux is turned off",
111
+ },
112
+ Object {
113
+ "flags": Array [],
114
+ "hostname": "foo.example.com",
115
+ "id": 47,
116
+ "severity": "medium",
117
+ "title": "Root password is too short",
118
+ },
119
+ ]
120
+ `;
121
+
122
+ exports[`PreupgradeReportsHelpers should filter entries by title 1`] = `
123
+ Array [
124
+ Object {
125
+ "flags": Array [],
126
+ "hostname": "host.example.com",
127
+ "id": 43,
128
+ "severity": "medium",
129
+ "title": "I am broken too",
130
+ },
131
+ ]
132
+ `;
133
+
24
134
  exports[`PreupgradeReportsHelpers should return entries page 1`] = `
25
135
  Array [
26
136
  Object {
137
+ "flags": Array [],
138
+ "hostname": "foo.example.com",
27
139
  "id": 45,
28
140
  "severity": "low",
29
141
  "title": "Not enough credits",
30
142
  },
31
143
  Object {
144
+ "flags": Array [],
145
+ "hostname": "foo.example.com",
32
146
  "id": 46,
33
147
  "severity": "medium",
34
148
  "title": "SELinux is turned off",
35
149
  },
36
150
  Object {
151
+ "flags": Array [],
152
+ "hostname": "foo.example.com",
37
153
  "id": 47,
38
154
  "severity": "medium",
39
155
  "title": "Root password is too short",
@@ -41,42 +157,333 @@ Array [
41
157
  ]
42
158
  `;
43
159
 
160
+ exports[`PreupgradeReportsHelpers should return fixable entries 1`] = `
161
+ Array [
162
+ Object {
163
+ "detail": Object {
164
+ "remediations": Array [
165
+ Object {
166
+ "type": "command",
167
+ },
168
+ ],
169
+ },
170
+ "severity": "high",
171
+ "title": "Octocat is not happy",
172
+ },
173
+ ]
174
+ `;
175
+
44
176
  exports[`PreupgradeReportsHelpers should return flattened entrues 1`] = `
45
177
  Array [
46
178
  Object {
179
+ "flags": Array [],
180
+ "hostname": "host.example.com",
47
181
  "id": 42,
48
- "severity": "Too severe to talk about",
182
+ "severity": "info",
49
183
  "title": "Fix me!",
50
184
  },
51
185
  Object {
186
+ "flags": Array [],
187
+ "hostname": "host.example.com",
52
188
  "id": 43,
53
189
  "severity": "medium",
54
190
  "title": "I am broken too",
55
191
  },
56
192
  Object {
193
+ "flags": Array [
194
+ "inhibitor",
195
+ ],
196
+ "hostname": "foo.example.com",
57
197
  "id": 44,
58
198
  "severity": "high",
59
199
  "title": "Octocat is not happy",
60
200
  },
61
201
  Object {
202
+ "flags": Array [],
203
+ "hostname": "foo.example.com",
62
204
  "id": 45,
63
205
  "severity": "low",
64
206
  "title": "Not enough credits",
65
207
  },
66
208
  Object {
209
+ "flags": Array [],
210
+ "hostname": "foo.example.com",
67
211
  "id": 46,
68
212
  "severity": "medium",
69
213
  "title": "SELinux is turned off",
70
214
  },
71
215
  Object {
216
+ "flags": Array [],
217
+ "hostname": "foo.example.com",
72
218
  "id": 47,
73
219
  "severity": "medium",
74
220
  "title": "Root password is too short",
75
221
  },
76
222
  Object {
223
+ "flags": Array [],
224
+ "hostname": "foo.example.com",
77
225
  "id": 49,
78
226
  "severity": "high",
79
227
  "title": "No chocolate chip cookies in cookie jar",
80
228
  },
81
229
  ]
82
230
  `;
231
+
232
+ exports[`PreupgradeReportsHelpers should sort entries by hostname 1`] = `
233
+ Array [
234
+ Object {
235
+ "flags": Array [
236
+ "inhibitor",
237
+ ],
238
+ "hostname": "foo.example.com",
239
+ "id": 44,
240
+ "severity": "high",
241
+ "title": "Octocat is not happy",
242
+ },
243
+ Object {
244
+ "flags": Array [],
245
+ "hostname": "foo.example.com",
246
+ "id": 45,
247
+ "severity": "low",
248
+ "title": "Not enough credits",
249
+ },
250
+ Object {
251
+ "flags": Array [],
252
+ "hostname": "foo.example.com",
253
+ "id": 46,
254
+ "severity": "medium",
255
+ "title": "SELinux is turned off",
256
+ },
257
+ Object {
258
+ "flags": Array [],
259
+ "hostname": "foo.example.com",
260
+ "id": 47,
261
+ "severity": "medium",
262
+ "title": "Root password is too short",
263
+ },
264
+ Object {
265
+ "flags": Array [],
266
+ "hostname": "foo.example.com",
267
+ "id": 49,
268
+ "severity": "high",
269
+ "title": "No chocolate chip cookies in cookie jar",
270
+ },
271
+ Object {
272
+ "flags": Array [],
273
+ "hostname": "host.example.com",
274
+ "id": 42,
275
+ "severity": "info",
276
+ "title": "Fix me!",
277
+ },
278
+ Object {
279
+ "flags": Array [],
280
+ "hostname": "host.example.com",
281
+ "id": 43,
282
+ "severity": "medium",
283
+ "title": "I am broken too",
284
+ },
285
+ ]
286
+ `;
287
+
288
+ exports[`PreupgradeReportsHelpers should sort entries by remediations 1`] = `
289
+ Array [
290
+ Object {
291
+ "detail": Object {
292
+ "remediations": Array [
293
+ Object {
294
+ "type": "hint",
295
+ },
296
+ ],
297
+ },
298
+ "severity": "info",
299
+ "title": "Fix me!",
300
+ },
301
+ Object {
302
+ "detail": Object {
303
+ "remediations": Array [
304
+ Object {
305
+ "type": "command",
306
+ },
307
+ ],
308
+ },
309
+ "severity": "high",
310
+ "title": "Octocat is not happy",
311
+ },
312
+ Object {
313
+ "severity": "medium",
314
+ "title": "I am broken too",
315
+ },
316
+ Object {
317
+ "severity": "low",
318
+ "title": "Not enough credits",
319
+ },
320
+ ]
321
+ `;
322
+
323
+ exports[`PreupgradeReportsHelpers should sort entries by severity 1`] = `
324
+ Array [
325
+ Object {
326
+ "flags": Array [],
327
+ "hostname": "host.example.com",
328
+ "id": 42,
329
+ "severity": "info",
330
+ "title": "Fix me!",
331
+ },
332
+ Object {
333
+ "flags": Array [],
334
+ "hostname": "foo.example.com",
335
+ "id": 45,
336
+ "severity": "low",
337
+ "title": "Not enough credits",
338
+ },
339
+ Object {
340
+ "flags": Array [],
341
+ "hostname": "host.example.com",
342
+ "id": 43,
343
+ "severity": "medium",
344
+ "title": "I am broken too",
345
+ },
346
+ Object {
347
+ "flags": Array [],
348
+ "hostname": "foo.example.com",
349
+ "id": 46,
350
+ "severity": "medium",
351
+ "title": "SELinux is turned off",
352
+ },
353
+ Object {
354
+ "flags": Array [],
355
+ "hostname": "foo.example.com",
356
+ "id": 47,
357
+ "severity": "medium",
358
+ "title": "Root password is too short",
359
+ },
360
+ Object {
361
+ "flags": Array [
362
+ "inhibitor",
363
+ ],
364
+ "hostname": "foo.example.com",
365
+ "id": 44,
366
+ "severity": "high",
367
+ "title": "Octocat is not happy",
368
+ },
369
+ Object {
370
+ "flags": Array [],
371
+ "hostname": "foo.example.com",
372
+ "id": 49,
373
+ "severity": "high",
374
+ "title": "No chocolate chip cookies in cookie jar",
375
+ },
376
+ ]
377
+ `;
378
+
379
+ exports[`PreupgradeReportsHelpers should sort entries by title in ascending order 1`] = `
380
+ Array [
381
+ Object {
382
+ "flags": Array [],
383
+ "hostname": "host.example.com",
384
+ "id": 42,
385
+ "severity": "info",
386
+ "title": "Fix me!",
387
+ },
388
+ Object {
389
+ "flags": Array [],
390
+ "hostname": "host.example.com",
391
+ "id": 43,
392
+ "severity": "medium",
393
+ "title": "I am broken too",
394
+ },
395
+ Object {
396
+ "flags": Array [],
397
+ "hostname": "foo.example.com",
398
+ "id": 49,
399
+ "severity": "high",
400
+ "title": "No chocolate chip cookies in cookie jar",
401
+ },
402
+ Object {
403
+ "flags": Array [],
404
+ "hostname": "foo.example.com",
405
+ "id": 45,
406
+ "severity": "low",
407
+ "title": "Not enough credits",
408
+ },
409
+ Object {
410
+ "flags": Array [
411
+ "inhibitor",
412
+ ],
413
+ "hostname": "foo.example.com",
414
+ "id": 44,
415
+ "severity": "high",
416
+ "title": "Octocat is not happy",
417
+ },
418
+ Object {
419
+ "flags": Array [],
420
+ "hostname": "foo.example.com",
421
+ "id": 47,
422
+ "severity": "medium",
423
+ "title": "Root password is too short",
424
+ },
425
+ Object {
426
+ "flags": Array [],
427
+ "hostname": "foo.example.com",
428
+ "id": 46,
429
+ "severity": "medium",
430
+ "title": "SELinux is turned off",
431
+ },
432
+ ]
433
+ `;
434
+
435
+ exports[`PreupgradeReportsHelpers should sort entries by title in descending order 1`] = `
436
+ Array [
437
+ Object {
438
+ "flags": Array [],
439
+ "hostname": "foo.example.com",
440
+ "id": 46,
441
+ "severity": "medium",
442
+ "title": "SELinux is turned off",
443
+ },
444
+ Object {
445
+ "flags": Array [],
446
+ "hostname": "foo.example.com",
447
+ "id": 47,
448
+ "severity": "medium",
449
+ "title": "Root password is too short",
450
+ },
451
+ Object {
452
+ "flags": Array [
453
+ "inhibitor",
454
+ ],
455
+ "hostname": "foo.example.com",
456
+ "id": 44,
457
+ "severity": "high",
458
+ "title": "Octocat is not happy",
459
+ },
460
+ Object {
461
+ "flags": Array [],
462
+ "hostname": "foo.example.com",
463
+ "id": 45,
464
+ "severity": "low",
465
+ "title": "Not enough credits",
466
+ },
467
+ Object {
468
+ "flags": Array [],
469
+ "hostname": "foo.example.com",
470
+ "id": 49,
471
+ "severity": "high",
472
+ "title": "No chocolate chip cookies in cookie jar",
473
+ },
474
+ Object {
475
+ "flags": Array [],
476
+ "hostname": "host.example.com",
477
+ "id": 43,
478
+ "severity": "medium",
479
+ "title": "I am broken too",
480
+ },
481
+ Object {
482
+ "flags": Array [],
483
+ "hostname": "host.example.com",
484
+ "id": 42,
485
+ "severity": "info",
486
+ "title": "Fix me!",
487
+ },
488
+ ]
489
+ `;