foreman_leapp 0.0.5 → 0.0.6

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/foreman_leapp/job_templates/upgrade.erb +12 -4
  3. data/app/views/job_invocations/_leapp_preupgrade_report.html.erb +2 -1
  4. data/lib/foreman_leapp/version.rb +1 -1
  5. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +4 -0
  6. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +2 -0
  7. data/webpack/components/PreupgradeReports/PreupgradeReports.js +32 -4
  8. data/webpack/components/PreupgradeReports/PreupgradeReportsHelpers.js +35 -0
  9. data/webpack/components/PreupgradeReports/PreupgradeReportsSelectors.js +1 -0
  10. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReports.fixtures.js +34 -2
  11. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReports.test.js +9 -0
  12. data/webpack/components/PreupgradeReports/__tests__/PreupgradeReportsHelpers.test.js +38 -0
  13. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReports.test.js.snap +131 -24
  14. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsHelpers.test.js.snap +82 -0
  15. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsReducer.test.js.snap +19 -0
  16. data/webpack/components/PreupgradeReports/__tests__/__snapshots__/PreupgradeReportsSelectors.test.js.snap +19 -0
  17. data/webpack/components/PreupgradeReports/components/FixAllButton.js +37 -0
  18. data/webpack/components/PreupgradeReports/components/FixAllButton.test.js +18 -0
  19. data/webpack/components/PreupgradeReports/components/__snapshots__/FixAllButton.test.js.snap +34 -0
  20. data/webpack/components/PreupgradeReports/index.js +7 -2
  21. data/webpack/components/PreupgradeReportsList/__tests__/PreupgradeReportsList.test.js +12 -2
  22. data/webpack/components/PreupgradeReportsList/__tests__/__snapshots__/PreupgradeReportsList.test.js.snap +81 -0
  23. data/webpack/components/PreupgradeReportsList/components/PreupgradeReportEntry.js +39 -5
  24. data/webpack/components/PreupgradeReportsList/components/__tests__/PreupgradeReportEntry.fixtures.js +38 -0
  25. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/PreupgradeReportEntry.test.js.snap +97 -22
  26. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/helpers.test.js.snap +196 -28
  27. data/webpack/components/PreupgradeReportsList/components/__tests__/helpers.test.js +21 -8
  28. data/webpack/components/PreupgradeReportsList/components/foreman_leapp.scss +9 -0
  29. data/webpack/components/PreupgradeReportsList/components/helpers.js +149 -21
  30. data/webpack/components/PreupgradeReportsList/index.js +21 -8
  31. data/webpack/csrf.js +4 -0
  32. metadata +27 -5
  33. data/webpack/components/PreupgradeReportsList/components/StringInfoItem.js +0 -49
  34. data/webpack/components/PreupgradeReportsList/components/__tests__/StringInfoItem.test.js +0 -13
  35. data/webpack/components/PreupgradeReportsList/components/__tests__/__snapshots__/StringInfoItem.test.js.snap +0 -12
@@ -0,0 +1,38 @@
1
+ export const reportEntry = {
2
+ hostname: 'leapp-20200407164551',
3
+ severity: 'high',
4
+ title: 'Difference in Python versions and support in RHEL 8',
5
+ timeStamp: '2020-04-08T16:49:34.453295Z',
6
+ tags: ['python'],
7
+ summary: 'This checks difference in python versions',
8
+ detail: {
9
+ related_resources: [
10
+ {
11
+ scheme: 'package',
12
+ title: 'python',
13
+ },
14
+ {
15
+ scheme: 'package',
16
+ title: 'python2',
17
+ },
18
+ {
19
+ scheme: 'package',
20
+ title: 'python3',
21
+ },
22
+ ],
23
+ external: [
24
+ {
25
+ url:
26
+ 'https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/#using-python3',
27
+ title: 'Difference in Python versions and support in RHEL 8',
28
+ },
29
+ ],
30
+ remediations: [
31
+ {
32
+ type: 'hint',
33
+ context:
34
+ 'Please run "alternatives --set python /usr/bin/python3" after upgrade',
35
+ },
36
+ ],
37
+ },
38
+ };
@@ -5,23 +5,33 @@ exports[`PreupgradeReportEntry should render 1`] = `
5
5
  actions={null}
6
6
  additionalInfo={
7
7
  Array [
8
- <StringInfoItem
9
- attr="title"
10
- elipsed={false}
11
- entry={
12
- Object {
13
- "id": 5,
14
- "preupgradeReportId": 7,
15
- "severity": "low",
16
- "title": "no title",
8
+ <ListViewInfoItem
9
+ className=""
10
+ stacked={false}
11
+ >
12
+ <Icon
13
+ name="cluster"
14
+ type="pf"
15
+ />
16
+
17
+ </ListViewInfoItem>,
18
+ <ListViewInfoItem
19
+ className=""
20
+ stacked={false}
21
+ >
22
+ <Icon
23
+ name="resources-full"
24
+ style={
25
+ Object {
26
+ "color": "#39a5dc",
27
+ }
17
28
  }
18
- }
19
- mapAttr={[Function]}
20
- translate={false}
21
- />,
22
- <StringInfoItem
23
- attr="severity"
24
- elipsed={false}
29
+ type="pf"
30
+ />
31
+ low
32
+ </ListViewInfoItem>,
33
+ <EmptyInfoItem
34
+ attr="remediation"
25
35
  entry={
26
36
  Object {
27
37
  "id": 5,
@@ -30,16 +40,17 @@ exports[`PreupgradeReportEntry should render 1`] = `
30
40
  "title": "no title",
31
41
  }
32
42
  }
33
- mapAttr={[Function]}
34
- translate={false}
35
43
  />,
36
44
  ]
37
45
  }
38
- checkboxInput={null}
39
- className="listViewItem--listItemVariants"
46
+ checkboxInput={
47
+ <input
48
+ type="checkbox"
49
+ />
50
+ }
40
51
  compoundExpand={false}
41
52
  compoundExpanded={false}
42
- description={null}
53
+ description="no title"
43
54
  heading={null}
44
55
  hideCloseIcon={false}
45
56
  initExpanded={false}
@@ -49,5 +60,69 @@ exports[`PreupgradeReportEntry should render 1`] = `
49
60
  onExpand={[Function]}
50
61
  onExpandClose={[Function]}
51
62
  stacked={true}
52
- />
63
+ >
64
+ <Grid
65
+ bsClass="container"
66
+ componentClass="div"
67
+ fluid={true}
68
+ >
69
+ <Row
70
+ bsClass="row"
71
+ componentClass="div"
72
+ >
73
+ <Col
74
+ bsClass="col"
75
+ componentClass="div"
76
+ md={1}
77
+ >
78
+ <strong>
79
+ Title
80
+ </strong>
81
+ </Col>
82
+ <Col
83
+ bsClass="col"
84
+ componentClass="div"
85
+ md={8}
86
+ >
87
+ no title
88
+ </Col>
89
+ </Row>
90
+ <Row
91
+ bsClass="row"
92
+ className="top-padded"
93
+ componentClass="div"
94
+ >
95
+ <Col
96
+ bsClass="col"
97
+ componentClass="div"
98
+ md={1}
99
+ >
100
+ <strong>
101
+ Risk Factor
102
+ </strong>
103
+ </Col>
104
+ <Col
105
+ bsClass="col"
106
+ componentClass="div"
107
+ md={8}
108
+ >
109
+ <Icon
110
+ name="resources-full"
111
+ style={
112
+ Object {
113
+ "color": "#39a5dc",
114
+ }
115
+ }
116
+ type="pf"
117
+ />
118
+
119
+ low
120
+ </Col>
121
+ </Row>
122
+ <div />
123
+ <div />
124
+ <div />
125
+ <div />
126
+ </Grid>
127
+ </ListViewItem>
53
128
  `;
@@ -1,34 +1,202 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PreupgradeReportList/helpers should return additional info 1`] = `
3
+ exports[`PreupgradeReportList/helpers should detect if has remediations 1`] = `
4
+ <ListViewInfoItem
5
+ className=""
6
+ stacked={false}
7
+ >
8
+ <Icon
9
+ name="warning-triangle-o"
10
+ type="pf"
11
+ />
12
+ Has Remediation
13
+ </ListViewInfoItem>
14
+ `;
15
+
16
+ exports[`PreupgradeReportList/helpers should return externals 1`] = `
4
17
  Array [
5
- <StringInfoItem
6
- attr="title"
7
- elipsed={false}
8
- entry={
9
- Object {
10
- "id": 5,
11
- "preupgradeReportId": 6,
12
- "severity": "low",
13
- "title": "This is title",
14
- }
15
- }
16
- mapAttr={[Function]}
17
- translate={false}
18
- />,
19
- <StringInfoItem
20
- attr="severity"
21
- elipsed={false}
22
- entry={
23
- Object {
24
- "id": 5,
25
- "preupgradeReportId": 6,
26
- "severity": "low",
27
- "title": "This is title",
18
+ <Row
19
+ bsClass="row"
20
+ className="top-padded"
21
+ componentClass="div"
22
+ >
23
+ <Col
24
+ bsClass="col"
25
+ componentClass="div"
26
+ md={1}
27
+ >
28
+ <strong>
29
+ Links
30
+ </strong>
31
+ </Col>
32
+ <Col
33
+ bsClass="col"
34
+ componentClass="div"
35
+ md={8}
36
+ >
37
+ <a
38
+ href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/#using-python3"
39
+ >
40
+ Difference in Python versions and support in RHEL 8
41
+ </a>
42
+ </Col>
43
+ </Row>,
44
+ ]
45
+ `;
46
+
47
+ exports[`PreupgradeReportList/helpers should return hex for severity 1`] = `"#39a5dc"`;
48
+
49
+ exports[`PreupgradeReportList/helpers should return remediations 1`] = `
50
+ Array [
51
+ <Row
52
+ bsClass="row"
53
+ className="top-padded"
54
+ componentClass="div"
55
+ >
56
+ <Col
57
+ bsClass="col"
58
+ componentClass="div"
59
+ md={1}
60
+ >
61
+ <strong>
62
+ Hint
63
+ </strong>
64
+ </Col>
65
+ <Col
66
+ bsClass="col"
67
+ componentClass="div"
68
+ md={8}
69
+ >
70
+ Please run "alternatives --set python /usr/bin/python3" after upgrade
71
+ </Col>
72
+ </Row>,
73
+ ]
74
+ `;
75
+
76
+ exports[`PreupgradeReportList/helpers should return severity 1`] = `
77
+ <Row
78
+ bsClass="row"
79
+ className="top-padded"
80
+ componentClass="div"
81
+ >
82
+ <Col
83
+ bsClass="col"
84
+ componentClass="div"
85
+ md={1}
86
+ >
87
+ <strong>
88
+ Risk Factor
89
+ </strong>
90
+ </Col>
91
+ <Col
92
+ bsClass="col"
93
+ componentClass="div"
94
+ md={8}
95
+ >
96
+ <Icon
97
+ name="resources-full"
98
+ style={
99
+ Object {
100
+ "color": "#cc0000",
101
+ }
28
102
  }
29
- }
30
- mapAttr={[Function]}
31
- translate={false}
32
- />,
103
+ type="pf"
104
+ />
105
+
106
+ high
107
+ </Col>
108
+ </Row>
109
+ `;
110
+
111
+ exports[`PreupgradeReportList/helpers should return summary 1`] = `
112
+ <Row
113
+ bsClass="row"
114
+ className="top-padded"
115
+ componentClass="div"
116
+ >
117
+ <Col
118
+ bsClass="col"
119
+ componentClass="div"
120
+ md={1}
121
+ >
122
+ <strong>
123
+ Summary
124
+ </strong>
125
+ </Col>
126
+ <Col
127
+ bsClass="col"
128
+ className="pre-wrap"
129
+ componentClass="div"
130
+ md={8}
131
+ >
132
+ This checks difference in python versions
133
+ </Col>
134
+ </Row>
135
+ `;
136
+
137
+ exports[`PreupgradeReportList/helpers should return tag info 1`] = `
138
+ Array [
139
+ <Badge
140
+ bsClass="badge"
141
+ pullRight={false}
142
+ variant="pill primary"
143
+ >
144
+ python
145
+ </Badge>,
33
146
  ]
34
147
  `;
148
+
149
+ exports[`PreupgradeReportList/helpers should return tags 1`] = `
150
+ <Row
151
+ bsClass="row"
152
+ className="top-padded"
153
+ componentClass="div"
154
+ >
155
+ <Col
156
+ bsClass="col"
157
+ componentClass="div"
158
+ md={1}
159
+ >
160
+ <strong>
161
+ Tags
162
+ </strong>
163
+ </Col>
164
+ <Col
165
+ bsClass="col"
166
+ componentClass="div"
167
+ md={8}
168
+ >
169
+ <Badge
170
+ bsClass="badge"
171
+ pullRight={false}
172
+ variant="pill primary"
173
+ >
174
+ python
175
+ </Badge>
176
+ </Col>
177
+ </Row>
178
+ `;
179
+
180
+ exports[`PreupgradeReportList/helpers should return title 1`] = `
181
+ <Row
182
+ bsClass="row"
183
+ componentClass="div"
184
+ >
185
+ <Col
186
+ bsClass="col"
187
+ componentClass="div"
188
+ md={1}
189
+ >
190
+ <strong>
191
+ Title
192
+ </strong>
193
+ </Col>
194
+ <Col
195
+ bsClass="col"
196
+ componentClass="div"
197
+ md={8}
198
+ >
199
+ Difference in Python versions and support in RHEL 8
200
+ </Col>
201
+ </Row>
202
+ `;
@@ -1,16 +1,29 @@
1
1
  import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
2
2
 
3
- import { additionalInfo } from '../helpers';
3
+ import {
4
+ presentSeverity,
5
+ tagInfo,
6
+ hasRemediations,
7
+ getTitle,
8
+ getSeverity,
9
+ getSummary,
10
+ getTags,
11
+ getExternals,
12
+ getRemediations,
13
+ } from '../helpers';
4
14
 
5
- const reportEntry = {
6
- title: 'This is title',
7
- severity: 'low',
8
- id: 5,
9
- preupgradeReportId: 6,
10
- };
15
+ import { reportEntry } from './PreupgradeReportEntry.fixtures';
11
16
 
12
17
  const fixtures = {
13
- 'should return additional info': () => additionalInfo(reportEntry),
18
+ 'should return hex for severity': () => presentSeverity('low'),
19
+ 'should return tag info': () => tagInfo(reportEntry.tags),
20
+ 'should detect if has remediations': () => hasRemediations(reportEntry),
21
+ 'should return title': () => getTitle(reportEntry),
22
+ 'should return severity': () => getSeverity(reportEntry),
23
+ 'should return summary': () => getSummary(reportEntry),
24
+ 'should return tags': () => getTags(reportEntry),
25
+ 'should return externals': () => getExternals(reportEntry),
26
+ 'should return remediations': () => getRemediations(reportEntry),
14
27
  };
15
28
 
16
29
  describe('PreupgradeReportList/helpers', () =>