foreman_rh_cloud 3.0.14 → 3.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +11 -0
- data/app/controllers/insights_cloud/hits_controller.rb +24 -0
- data/app/controllers/insights_cloud/settings_controller.rb +8 -0
- data/app/models/insights_hit.rb +5 -1
- data/app/models/setting/rh_cloud.rb +8 -6
- data/app/overrides/layouts/base/styles.html.erb.deface +2 -0
- data/app/services/foreman_rh_cloud/cloud_connector.rb +59 -0
- data/app/views/layouts/foreman_rh_cloud/application.html.erb +0 -4
- data/config/Gemfile.lock.gh_test +830 -0
- data/config/database.yml.example +17 -0
- data/config/package-lock.json.gh_test +35653 -0
- data/config/routes.rb +12 -3
- data/lib/foreman_inventory_upload.rb +1 -1
- data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
- data/lib/foreman_rh_cloud/engine.rb +15 -5
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +23 -0
- data/package.json +18 -17
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +3 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +33 -15
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +43 -43
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +6 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +5 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +19 -34
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +28 -5
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +6 -3
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/{inventorySettings.scss → InventorySettings.scss} +2 -5
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +6 -8
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +10 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +19 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +53 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/{components/DocsButton/__tests__/DocsButton.test.js → __tests__/PageTitle.test.js} +3 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +12 -38
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +43 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +51 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorConstants.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +22 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +48 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -4
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +1 -2
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +1 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +8 -14
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +7 -10
- data/webpack/ForemanRhCloudPages.js +19 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +4 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +16 -0
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +2 -2
- data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +121 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +129 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +55 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +31 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js +28 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +74 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +65 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js +58 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +168 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap +88 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +104 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js +53 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/index.js +45 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -0
- data/webpack/InsightsCloudSync/Components/NoTokenEmptyState.js +79 -0
- data/webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js +10 -0
- data/webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js +19 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +13 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +214 -0
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +45 -44
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -2
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +1 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +15 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +7 -0
- data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +2 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +45 -62
- data/webpack/InsightsCloudSync/index.js +11 -3
- data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +1 -1
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +2 -2
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
- data/webpack/__mocks__/foremanReact/constants.js +19 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +24 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +11 -0
- data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +2 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
- data/webpack/common/Switcher/HelpLabel.js +30 -0
- data/webpack/common/Switcher/SwitcherPF4.js +36 -0
- data/webpack/common/Switcher/SwitcherPF4.scss +10 -0
- data/webpack/common/Switcher/__tests__/HelpLabel.test.js +13 -0
- data/webpack/common/Switcher/__tests__/SwitcherPF4.test.js +14 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +20 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +22 -0
- data/webpack/global_index.js +2 -0
- metadata +96 -34
- data/app/controllers/foreman_rh_cloud/react_controller.rb +0 -11
- data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +0 -1
- data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +0 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/excludePackagesSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +0 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +0 -21
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +0 -19
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +0 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +0 -22
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +0 -3
- data/webpack/__mocks__/foremanReact/API.js +0 -7
@@ -0,0 +1,168 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`InsightsTable rendering render with Props 1`] = `
|
4
|
+
<Fragment>
|
5
|
+
<SelectAllAlert
|
6
|
+
clearAllSelection={[Function]}
|
7
|
+
isAllSelected={false}
|
8
|
+
itemCount={2}
|
9
|
+
selectAll={[Function]}
|
10
|
+
selectedIds={Object {}}
|
11
|
+
showSelectAllAlert={false}
|
12
|
+
/>
|
13
|
+
<Table
|
14
|
+
actions={
|
15
|
+
Array [
|
16
|
+
Object {
|
17
|
+
"onClick": [Function],
|
18
|
+
"title": "Remediate",
|
19
|
+
},
|
20
|
+
]
|
21
|
+
}
|
22
|
+
aria-label="Recommendations Table"
|
23
|
+
borders={true}
|
24
|
+
canSelectAll={true}
|
25
|
+
canSortFavorites={true}
|
26
|
+
cells={
|
27
|
+
Array [
|
28
|
+
Object {
|
29
|
+
"sortKey": "hostname",
|
30
|
+
"title": "Hostname",
|
31
|
+
"transforms": Array [
|
32
|
+
[Function],
|
33
|
+
[Function],
|
34
|
+
],
|
35
|
+
},
|
36
|
+
Object {
|
37
|
+
"sortKey": "title",
|
38
|
+
"title": "Recommendation",
|
39
|
+
"transforms": Array [
|
40
|
+
[Function],
|
41
|
+
[Function],
|
42
|
+
],
|
43
|
+
},
|
44
|
+
Object {
|
45
|
+
"cellTransforms": Array [
|
46
|
+
[Function],
|
47
|
+
],
|
48
|
+
"sortKey": "total_risk",
|
49
|
+
"title": "Total Risk",
|
50
|
+
"transforms": Array [
|
51
|
+
[Function],
|
52
|
+
[Function],
|
53
|
+
],
|
54
|
+
},
|
55
|
+
]
|
56
|
+
}
|
57
|
+
className=""
|
58
|
+
contentId="expanded-content"
|
59
|
+
dropdownDirection="down"
|
60
|
+
dropdownPosition="right"
|
61
|
+
expandId="expandable-toggle"
|
62
|
+
gridBreakPoint="grid-md"
|
63
|
+
isStickyHeader={false}
|
64
|
+
onSelect={[Function]}
|
65
|
+
onSort={[Function]}
|
66
|
+
ouiaSafe={true}
|
67
|
+
role="grid"
|
68
|
+
rowLabeledBy="simple-node"
|
69
|
+
rows={
|
70
|
+
Array [
|
71
|
+
Array [
|
72
|
+
"foo.example.com",
|
73
|
+
"Decreased security: Yum GPG verification disabled",
|
74
|
+
1,
|
75
|
+
],
|
76
|
+
Array [
|
77
|
+
"foo.example.com",
|
78
|
+
"Installation of packages across major releases is not supported",
|
79
|
+
2,
|
80
|
+
],
|
81
|
+
]
|
82
|
+
}
|
83
|
+
selectVariant="checkbox"
|
84
|
+
sortBy={
|
85
|
+
Object {
|
86
|
+
"direction": "desc",
|
87
|
+
"index": 3,
|
88
|
+
}
|
89
|
+
}
|
90
|
+
variant={null}
|
91
|
+
>
|
92
|
+
<TableHeader />
|
93
|
+
<Component />
|
94
|
+
</Table>
|
95
|
+
<TableEmptyState
|
96
|
+
error={null}
|
97
|
+
status="RESOLVED"
|
98
|
+
/>
|
99
|
+
<Pagination
|
100
|
+
className=""
|
101
|
+
defaultToFullPage={false}
|
102
|
+
firstPage={1}
|
103
|
+
isCompact={false}
|
104
|
+
isDisabled={false}
|
105
|
+
isSticky={false}
|
106
|
+
itemCount={2}
|
107
|
+
itemsEnd={null}
|
108
|
+
itemsStart={null}
|
109
|
+
offset={0}
|
110
|
+
onFirstClick={[Function]}
|
111
|
+
onLastClick={[Function]}
|
112
|
+
onNextClick={[Function]}
|
113
|
+
onPageInput={[Function]}
|
114
|
+
onPerPageSelect={[Function]}
|
115
|
+
onPreviousClick={[Function]}
|
116
|
+
onSetPage={[Function]}
|
117
|
+
ouiaSafe={true}
|
118
|
+
page={1}
|
119
|
+
perPage={5}
|
120
|
+
perPageOptions={
|
121
|
+
Array [
|
122
|
+
Object {
|
123
|
+
"title": "5",
|
124
|
+
"value": 5,
|
125
|
+
},
|
126
|
+
Object {
|
127
|
+
"title": "10",
|
128
|
+
"value": 10,
|
129
|
+
},
|
130
|
+
Object {
|
131
|
+
"title": "15",
|
132
|
+
"value": 15,
|
133
|
+
},
|
134
|
+
Object {
|
135
|
+
"title": "20",
|
136
|
+
"value": 20,
|
137
|
+
},
|
138
|
+
Object {
|
139
|
+
"title": "25",
|
140
|
+
"value": 25,
|
141
|
+
},
|
142
|
+
Object {
|
143
|
+
"title": "50",
|
144
|
+
"value": 50,
|
145
|
+
},
|
146
|
+
]
|
147
|
+
}
|
148
|
+
titles={
|
149
|
+
Object {
|
150
|
+
"currPage": "Current page",
|
151
|
+
"items": "",
|
152
|
+
"itemsPerPage": "Items per page",
|
153
|
+
"optionsToggle": "Items per page",
|
154
|
+
"page": "",
|
155
|
+
"paginationTitle": "Pagination",
|
156
|
+
"perPageSuffix": "per page",
|
157
|
+
"toFirstPage": "Go to first page",
|
158
|
+
"toLastPage": "Go to last page",
|
159
|
+
"toNextPage": "Go to next page",
|
160
|
+
"toPreviousPage": "Go to previous page",
|
161
|
+
}
|
162
|
+
}
|
163
|
+
toggleTemplate={[Function]}
|
164
|
+
variant="bottom"
|
165
|
+
widgetId="recommendation-pagination"
|
166
|
+
/>
|
167
|
+
</Fragment>
|
168
|
+
`;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`InsightsTable selectors should return API error 1`] = `"Request failed with status code 503"`;
|
4
|
+
|
5
|
+
exports[`InsightsTable selectors should return API has token 1`] = `true`;
|
6
|
+
|
7
|
+
exports[`InsightsTable selectors should return API hits 1`] = `
|
8
|
+
Array [
|
9
|
+
Object {
|
10
|
+
"host_id": 1,
|
11
|
+
"hostname": "foo.example.com",
|
12
|
+
"id": 16,
|
13
|
+
"last_seen": "2020-11-01T15:55:14.280+02:00",
|
14
|
+
"likelihood": 1,
|
15
|
+
"publish_date": "2017-11-02T14:00:00.000+02:00",
|
16
|
+
"results_url": "https://cloud.redhat.com/insights/advisor/recommendations/hardening_yum%7CHARDENING_YUM_GPG_3RD_6/716306d2-b4f8-446f-82c8-a45af30110bd/",
|
17
|
+
"solution_url": "",
|
18
|
+
"title": "Decreased security: Yum GPG verification disabled",
|
19
|
+
"total_risk": 1,
|
20
|
+
},
|
21
|
+
Object {
|
22
|
+
"host_id": 1,
|
23
|
+
"hostname": "foo.example.com",
|
24
|
+
"id": 17,
|
25
|
+
"last_seen": "2020-11-01T15:55:14.280+02:00",
|
26
|
+
"likelihood": 3,
|
27
|
+
"publish_date": "2019-07-12T02:08:00.000+03:00",
|
28
|
+
"results_url": "https://cloud.redhat.com/insights/advisor/recommendations/packages_across_major_release%7CPACKAGES_ACROSS_MAJOR_RELEASE/716306d2-b4f8-446f-82c8-a45af30110bd/",
|
29
|
+
"solution_url": "https://access.redhat.com/node/54483",
|
30
|
+
"title": "Installation of packages across major releases is not supported",
|
31
|
+
"total_risk": 2,
|
32
|
+
},
|
33
|
+
]
|
34
|
+
`;
|
35
|
+
|
36
|
+
exports[`InsightsTable selectors should return API item count 1`] = `2`;
|
37
|
+
|
38
|
+
exports[`InsightsTable selectors should return API status 1`] = `"RESOLVED"`;
|
39
|
+
|
40
|
+
exports[`InsightsTable selectors should return insights isAllSelected 1`] = `false`;
|
41
|
+
|
42
|
+
exports[`InsightsTable selectors should return insights selectedIds 1`] = `
|
43
|
+
Object {
|
44
|
+
"51": true,
|
45
|
+
}
|
46
|
+
`;
|
47
|
+
|
48
|
+
exports[`InsightsTable selectors should return insights showSelectAllAlert 1`] = `true`;
|
49
|
+
|
50
|
+
exports[`InsightsTable selectors should return insights table 1`] = `
|
51
|
+
Object {
|
52
|
+
"isAllSelected": false,
|
53
|
+
"selectedIds": Object {
|
54
|
+
"51": true,
|
55
|
+
},
|
56
|
+
"showSelectAllAlert": true,
|
57
|
+
}
|
58
|
+
`;
|
59
|
+
|
60
|
+
exports[`InsightsTable selectors should return queryParams 1`] = `
|
61
|
+
Object {
|
62
|
+
"page": 1,
|
63
|
+
"perPage": 7,
|
64
|
+
"query": "total_risk < 3",
|
65
|
+
"sortBy": "total_risk",
|
66
|
+
"sortOrder": "asc",
|
67
|
+
}
|
68
|
+
`;
|
69
|
+
|
70
|
+
exports[`InsightsTable selectors should return router page 1`] = `1`;
|
71
|
+
|
72
|
+
exports[`InsightsTable selectors should return router perPage 1`] = `7`;
|
73
|
+
|
74
|
+
exports[`InsightsTable selectors should return router query 1`] = `
|
75
|
+
Object {
|
76
|
+
"page": "1",
|
77
|
+
"per_page": "7",
|
78
|
+
"search": "total_risk+%3C+3",
|
79
|
+
"sort_by": "total_risk",
|
80
|
+
"sort_order": "asc",
|
81
|
+
}
|
82
|
+
`;
|
83
|
+
|
84
|
+
exports[`InsightsTable selectors should return router search 1`] = `"total_risk < 3"`;
|
85
|
+
|
86
|
+
exports[`InsightsTable selectors should return router sort by 1`] = `"total_risk"`;
|
87
|
+
|
88
|
+
exports[`InsightsTable selectors should return router sort order 1`] = `"asc"`;
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import Immutable from 'seamless-immutable';
|
2
|
+
import { noop } from 'patternfly-react';
|
3
|
+
|
4
|
+
const hits = Immutable([
|
5
|
+
{
|
6
|
+
id: 16,
|
7
|
+
host_id: 1,
|
8
|
+
last_seen: '2020-11-01T15:55:14.280+02:00',
|
9
|
+
title: 'Decreased security: Yum GPG verification disabled',
|
10
|
+
solution_url: '',
|
11
|
+
total_risk: 1,
|
12
|
+
likelihood: 1,
|
13
|
+
publish_date: '2017-11-02T14:00:00.000+02:00',
|
14
|
+
results_url:
|
15
|
+
'https://cloud.redhat.com/insights/advisor/recommendations/hardening_yum%7CHARDENING_YUM_GPG_3RD_6/716306d2-b4f8-446f-82c8-a45af30110bd/',
|
16
|
+
hostname: 'foo.example.com',
|
17
|
+
},
|
18
|
+
{
|
19
|
+
id: 17,
|
20
|
+
host_id: 1,
|
21
|
+
last_seen: '2020-11-01T15:55:14.280+02:00',
|
22
|
+
title: 'Installation of packages across major releases is not supported',
|
23
|
+
solution_url: 'https://access.redhat.com/node/54483',
|
24
|
+
total_risk: 2,
|
25
|
+
likelihood: 3,
|
26
|
+
publish_date: '2019-07-12T02:08:00.000+03:00',
|
27
|
+
results_url:
|
28
|
+
'https://cloud.redhat.com/insights/advisor/recommendations/packages_across_major_release%7CPACKAGES_ACROSS_MAJOR_RELEASE/716306d2-b4f8-446f-82c8-a45af30110bd/',
|
29
|
+
hostname: 'foo.example.com',
|
30
|
+
},
|
31
|
+
]);
|
32
|
+
|
33
|
+
export const tableProps = {
|
34
|
+
page: 1,
|
35
|
+
perPage: 5,
|
36
|
+
status: 'RESOLVED',
|
37
|
+
sortBy: 'total_risk',
|
38
|
+
sortOrder: 'desc',
|
39
|
+
hits,
|
40
|
+
query: '',
|
41
|
+
itemCount: 2,
|
42
|
+
fetchInsights: noop,
|
43
|
+
onTableSetPage: noop,
|
44
|
+
onTablePerPageSelect: noop,
|
45
|
+
onTableSort: noop,
|
46
|
+
onTableSelect: noop,
|
47
|
+
selectedIds: {},
|
48
|
+
showSelectAllAlert: false,
|
49
|
+
selectAll: noop,
|
50
|
+
clearAllSelection: noop,
|
51
|
+
error: null,
|
52
|
+
};
|
53
|
+
|
54
|
+
export const routerState = {
|
55
|
+
router: {
|
56
|
+
location: {
|
57
|
+
pathname: '/foreman_rh_cloud/insights_cloud',
|
58
|
+
search:
|
59
|
+
'?page=1&per_page=7&search=total_risk+%3C+3&sort_by=total_risk&sort_order=asc',
|
60
|
+
hash: '',
|
61
|
+
key: '40p9q7',
|
62
|
+
query: {
|
63
|
+
page: '1',
|
64
|
+
per_page: '7',
|
65
|
+
search: 'total_risk+%3C+3',
|
66
|
+
sort_by: 'total_risk',
|
67
|
+
sort_order: 'asc',
|
68
|
+
},
|
69
|
+
},
|
70
|
+
action: 'PUSH',
|
71
|
+
},
|
72
|
+
};
|
73
|
+
|
74
|
+
export const APIState = {
|
75
|
+
API: {
|
76
|
+
INSIGHTS_HITS: {
|
77
|
+
payload: {
|
78
|
+
url: '/insights_cloud/hits',
|
79
|
+
},
|
80
|
+
response: {
|
81
|
+
hasToken: true,
|
82
|
+
hits,
|
83
|
+
itemCount: 2,
|
84
|
+
},
|
85
|
+
status: 'RESOLVED',
|
86
|
+
},
|
87
|
+
},
|
88
|
+
};
|
89
|
+
|
90
|
+
export const APIErrorState = {
|
91
|
+
API: {
|
92
|
+
INSIGHTS_HITS: {
|
93
|
+
payload: {
|
94
|
+
url: '/insights_cloud/hits',
|
95
|
+
},
|
96
|
+
response: {
|
97
|
+
message: 'Request failed with status code 503',
|
98
|
+
name: 'Error',
|
99
|
+
stack: 'Error: Request failed with status code 503',
|
100
|
+
},
|
101
|
+
status: 'ERROR',
|
102
|
+
},
|
103
|
+
},
|
104
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {
|
4
|
+
EmptyState,
|
5
|
+
EmptyStateIcon,
|
6
|
+
Spinner,
|
7
|
+
EmptyStateVariant,
|
8
|
+
Title,
|
9
|
+
} from '@patternfly/react-core';
|
10
|
+
import { ExclamationCircleIcon } from '@patternfly/react-icons';
|
11
|
+
|
12
|
+
import { STATUS } from 'foremanReact/constants';
|
13
|
+
import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
14
|
+
|
15
|
+
const TableEmptyState = ({ status, error }) => {
|
16
|
+
switch (status) {
|
17
|
+
case STATUS.PENDING:
|
18
|
+
return (
|
19
|
+
<EmptyState variant={EmptyStateVariant.small}>
|
20
|
+
<EmptyStateIcon variant="container" component={Spinner} />
|
21
|
+
<Title headingLevel="h2" size="lg">
|
22
|
+
{__('Loading')}
|
23
|
+
</Title>
|
24
|
+
</EmptyState>
|
25
|
+
);
|
26
|
+
case STATUS.ERROR:
|
27
|
+
return (
|
28
|
+
<EmptyState variant={EmptyStateVariant.small}>
|
29
|
+
<EmptyStateIcon
|
30
|
+
variant="container"
|
31
|
+
component={ExclamationCircleIcon}
|
32
|
+
/>
|
33
|
+
<Title headingLevel="h2" size="lg">
|
34
|
+
{sprintf(__('The server returned the following error: %s'), error)}
|
35
|
+
</Title>
|
36
|
+
</EmptyState>
|
37
|
+
);
|
38
|
+
default:
|
39
|
+
return null;
|
40
|
+
}
|
41
|
+
};
|
42
|
+
|
43
|
+
TableEmptyState.propTypes = {
|
44
|
+
status: PropTypes.string,
|
45
|
+
error: PropTypes.string,
|
46
|
+
};
|
47
|
+
|
48
|
+
TableEmptyState.defaultProps = {
|
49
|
+
status: '',
|
50
|
+
error: '',
|
51
|
+
};
|
52
|
+
|
53
|
+
export default TableEmptyState;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
2
|
+
import { connect } from 'react-redux';
|
3
|
+
|
4
|
+
import * as actions from './InsightsTableActions';
|
5
|
+
import InsightsTable from './InsightsTable';
|
6
|
+
import InsightsTableReducer from './InsightsTableReducer';
|
7
|
+
import {
|
8
|
+
selectPage,
|
9
|
+
selectPerPage,
|
10
|
+
selectSearch,
|
11
|
+
selectStatus,
|
12
|
+
selectSortBy,
|
13
|
+
selectSortOrder,
|
14
|
+
selectHits,
|
15
|
+
selectItemCount,
|
16
|
+
selectSelectedIds,
|
17
|
+
selectShowSelectAllAlert,
|
18
|
+
selectError,
|
19
|
+
selectIsAllSelected,
|
20
|
+
} from './InsightsTableSelectors';
|
21
|
+
|
22
|
+
// map state to props
|
23
|
+
const mapStateToProps = state => ({
|
24
|
+
query: selectSearch(state),
|
25
|
+
page: selectPage(state),
|
26
|
+
perPage: selectPerPage(state),
|
27
|
+
status: selectStatus(state),
|
28
|
+
sortBy: selectSortBy(state),
|
29
|
+
sortOrder: selectSortOrder(state),
|
30
|
+
hits: selectHits(state),
|
31
|
+
itemCount: selectItemCount(state),
|
32
|
+
selectedIds: selectSelectedIds(state),
|
33
|
+
showSelectAllAlert: selectShowSelectAllAlert(state),
|
34
|
+
error: selectError(state),
|
35
|
+
isAllSelected: selectIsAllSelected(state),
|
36
|
+
});
|
37
|
+
|
38
|
+
// map action dispatchers to props
|
39
|
+
const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
|
40
|
+
|
41
|
+
// export reducers
|
42
|
+
export const reducers = { table: InsightsTableReducer };
|
43
|
+
|
44
|
+
// export connected component
|
45
|
+
export default connect(mapStateToProps, mapDispatchToProps)(InsightsTable);
|