foreman_rh_cloud 12.2.0 → 12.2.1
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.
- checksums.yaml +4 -4
- data/app/controllers/insights_cloud/ui_requests_controller.rb +11 -0
- data/app/services/foreman_rh_cloud/url_remediations_retriever.rb +1 -1
- data/config/routes.rb +2 -0
- data/lib/foreman_rh_cloud/engine.rb +2 -129
- data/lib/foreman_rh_cloud/plugin.rb +138 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/test/controllers/insights_cloud/ui_requests_controller_test.rb +23 -0
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +1 -0
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.scss +3 -0
- data/webpack/ForemanColumnExtensions/index.js +20 -15
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +23 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js +2 -0
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -6
- data/webpack/IopRecommendationDetails/IopRecommendationDetails.js +1 -11
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5297c9be7a8e61f55e175c20b5f322b19c015d9a29bdd9c1bf42248ad1ffedf
|
4
|
+
data.tar.gz: 59cab12bcca78ee78eba81af4c0089f1dcaac84b35244936b707692c4881f7ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a544fe9144aad08668231c90d3c221a316501dc3d7f3766c444d2617c22949a5d4bde889960f6ff5cd9a6005f07885cb99ca059ab8b64ca7a5f058fc8df192
|
7
|
+
data.tar.gz: 123d446d857e98c371c362b26af1be131e59d41c7ade186a11d061fcb5078b39358a998be23eceb1e4dafcc66e9e6a8dd10c70652ad60b13f01d54675fbd4576
|
@@ -75,6 +75,17 @@ module InsightsCloud
|
|
75
75
|
res.headers[new_header] = header_content
|
76
76
|
end
|
77
77
|
|
78
|
+
def translate_insights_host
|
79
|
+
facet = InsightsFacet.find_by(uuid: params[:uuid])
|
80
|
+
if facet.present?
|
81
|
+
Rails.logger.debug "Found InsightsFacet #{params[:uuid]}"
|
82
|
+
redirect_to host_details_page_path(facet.host_id)
|
83
|
+
else
|
84
|
+
Rails.logger.error "Could not find InsightsFacet for #{params[:uuid]}"
|
85
|
+
redirect_to '/page-not-found'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
78
89
|
private
|
79
90
|
|
80
91
|
def ensure_org
|
data/config/routes.rb
CHANGED
@@ -61,6 +61,8 @@ Rails.application.routes.draw do
|
|
61
61
|
match '/api/lightspeed/*path', to: 'machine_telemetries#forward_request', via: :all
|
62
62
|
end
|
63
63
|
|
64
|
+
get '/insights_hosts/:uuid', to: 'insights_cloud/ui_requests#translate_insights_host'
|
65
|
+
|
64
66
|
# API routes
|
65
67
|
|
66
68
|
namespace :api, :defaults => { :format => 'json' } do
|
@@ -33,134 +33,7 @@ module ForemanRhCloud
|
|
33
33
|
|
34
34
|
initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |app|
|
35
35
|
app.reloader.to_prepare do
|
36
|
-
|
37
|
-
requires_foreman '>= 3.13'
|
38
|
-
register_gettext
|
39
|
-
|
40
|
-
apipie_documented_controllers ["#{ForemanRhCloud::Engine.root}/app/controllers/api/v2/**/*.rb"]
|
41
|
-
|
42
|
-
settings do
|
43
|
-
category(:rh_cloud, N_('Insights')) do
|
44
|
-
setting('allow_auto_inventory_upload', type: :boolean, description: N_('Enable automatic upload of your host inventory to the Red Hat cloud'), default: true, full_name: N_('Automatic inventory upload'))
|
45
|
-
setting('allow_auto_insights_sync', type: :boolean, description: N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), default: true, full_name: N_('Synchronize recommendations Automatically'))
|
46
|
-
setting('allow_auto_insights_mismatch_delete', type: :boolean, description: N_('Enable automatic deletion of mismatched host records from the Red Hat cloud'), default: false, full_name: N_('Automatic mismatch deletion'))
|
47
|
-
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host names are not included in the report.)'), default: false, full_name: N_('Obfuscate host names'))
|
48
|
-
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host IPv4 addresses are not included in the report.)'), default: false, full_name: N_('Obfuscate host ipv4 addresses.'))
|
49
|
-
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and installed packages are always excluded.)'), default: false, full_name: N_("Exclude installed packages"))
|
50
|
-
setting('include_parameter_tags', type: :boolean, description: N_('Should import include parameter tags from Foreman?'), default: false, full_name: N_('Include parameters in insights-client reports'))
|
51
|
-
setting('rhc_instance_id', type: :string, description: N_('RHC daemon id'), default: nil, full_name: N_('ID of the RHC(Yggdrasil) daemon'))
|
52
|
-
setting('insights_minimal_data_collection', type: :boolean, default: false, full_name: N_('Minimal data collection'), description: N_('Only include the minimum required data in inventory reports for uploading to Red Hat cloud. When this is true, installed packages are excluded from the report regardless of the exclude_installed_packages setting, and host names and IPv4 addresses are excluded from the report regardless of obfuscation settings.'))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Add permissions
|
57
|
-
security_block :foreman_rh_cloud do
|
58
|
-
permission(
|
59
|
-
:generate_foreman_rh_cloud,
|
60
|
-
'foreman_inventory_upload/reports': [:generate],
|
61
|
-
'foreman_inventory_upload/tasks': [:create],
|
62
|
-
'api/v2/rh_cloud/inventory': [:get_hosts, :remove_hosts, :sync_inventory_status, :download_file, :generate_report, :enable_cloud_connector],
|
63
|
-
'foreman_inventory_upload/uploads': [:enable_cloud_connector],
|
64
|
-
'foreman_inventory_upload/uploads_settings': [:set_advanced_setting],
|
65
|
-
'foreman_inventory_upload/missing_hosts': [:remove_hosts],
|
66
|
-
'insights_cloud/settings': [:update],
|
67
|
-
'insights_cloud/tasks': [:create]
|
68
|
-
)
|
69
|
-
permission(
|
70
|
-
:view_foreman_rh_cloud,
|
71
|
-
'foreman_inventory_upload/accounts': [:index],
|
72
|
-
'foreman_inventory_upload/reports': [:last],
|
73
|
-
'foreman_inventory_upload/uploads': [:auto_upload, :show_auto_upload, :download_file, :last],
|
74
|
-
'foreman_inventory_upload/tasks': [:show],
|
75
|
-
'foreman_inventory_upload/cloud_status': [:index],
|
76
|
-
'foreman_inventory_upload/uploads_settings': [:index],
|
77
|
-
'foreman_inventory_upload/missing_hosts': [:index],
|
78
|
-
'api/v2/rh_cloud/advisor_engine_config': [:show],
|
79
|
-
'react': [:index]
|
80
|
-
)
|
81
|
-
permission(
|
82
|
-
:view_insights_hits,
|
83
|
-
{
|
84
|
-
'/foreman_rh_cloud/insights_cloud': [:index], # for bookmarks and later for showing the page
|
85
|
-
'insights_cloud/hits': [:index, :show, :auto_complete_search, :resolutions],
|
86
|
-
'insights_cloud/settings': [:index, :show],
|
87
|
-
'insights_cloud/ui_requests': [:forward_request],
|
88
|
-
'react': [:index],
|
89
|
-
},
|
90
|
-
:resource_type => ::InsightsHit.name
|
91
|
-
)
|
92
|
-
permission(
|
93
|
-
:dispatch_cloud_requests,
|
94
|
-
'api/v2/rh_cloud/cloud_request': [:update]
|
95
|
-
)
|
96
|
-
permission(
|
97
|
-
:control_organization_insights,
|
98
|
-
'insights_cloud/settings': [:set_org_parameter]
|
99
|
-
)
|
100
|
-
end
|
101
|
-
|
102
|
-
plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud, :view_insights_hits, :dispatch_cloud_requests, :control_organization_insights]
|
103
|
-
|
104
|
-
role 'ForemanRhCloud', plugin_permissions, 'Role granting permissions to view the hosts inventory,
|
105
|
-
generate a report, upload it to the cloud and download it locally'
|
106
|
-
|
107
|
-
add_permissions_to_default_roles Role::ORG_ADMIN => plugin_permissions,
|
108
|
-
Role::MANAGER => plugin_permissions,
|
109
|
-
Role::SYSTEM_ADMIN => plugin_permissions
|
110
|
-
|
111
|
-
# Adding a top-level menu item
|
112
|
-
sub_menu :top_menu, :insights_menu, caption: N_('Insights'), icon: 'fa fa-cloud', after: :hosts_menu do
|
113
|
-
menu :top_menu,
|
114
|
-
:inventory_upload,
|
115
|
-
caption: N_('Inventory Upload'),
|
116
|
-
url: '/foreman_rh_cloud/inventory_upload',
|
117
|
-
url_hash: { controller: :react, action: :index },
|
118
|
-
parent: :insights_menu
|
119
|
-
menu :top_menu, :insights_hits, caption: N_('Recommendations'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :insights_menu
|
120
|
-
menu :top_menu,
|
121
|
-
:insights_vulnerability,
|
122
|
-
caption: N_('Vulnerability'),
|
123
|
-
url: '/foreman_rh_cloud/insights_vulnerability',
|
124
|
-
url_hash: { controller: :react, action: :index },
|
125
|
-
parent: :insights_menu,
|
126
|
-
if: -> { ForemanRhCloud.with_local_advisor_engine? }
|
127
|
-
end
|
128
|
-
|
129
|
-
register_facet InsightsFacet, :insights do
|
130
|
-
configure_host do
|
131
|
-
api_view :list => 'api/v2/hosts/insights/insights', :single => 'api/v2/hosts/insights/single'
|
132
|
-
set_dependent_action :destroy
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
register_global_js_file 'global'
|
137
|
-
|
138
|
-
register_custom_status InventorySync::InventoryStatus
|
139
|
-
register_custom_status InsightsClientReportStatus
|
140
|
-
|
141
|
-
describe_host do
|
142
|
-
overview_buttons_provider :insights_host_overview_buttons
|
143
|
-
end
|
144
|
-
|
145
|
-
extend_page 'hosts/show' do |context|
|
146
|
-
context.add_pagelet :main_tabs,
|
147
|
-
partial: 'hosts/insights_tab',
|
148
|
-
name: _('Insights'),
|
149
|
-
id: 'insights',
|
150
|
-
onlyif: proc { |host| host.insights }
|
151
|
-
end
|
152
|
-
|
153
|
-
extend_page 'hosts/_list' do |context|
|
154
|
-
context.with_profile :cloud, _('RH Cloud'), default: true do
|
155
|
-
add_pagelet :hosts_table_column_header, key: :insights_recommendations_count, label: _('Recommendations'), sortable: true, width: '12%', class: 'hidden-xs ellipsis', priority: 100,
|
156
|
-
export_data: CsvExporter::ExportDefinition.new(:insights_recommendations_count, callback: ->(host) { host&.insights_hits&.count })
|
157
|
-
add_pagelet :hosts_table_column_content, key: :insights_recommendations_count, callback: ->(host) { hits_counts_cell(host) }, class: 'hidden-xs ellipsis text-center', priority: 100
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
extend_template_helpers ForemanRhCloud::TemplateRendererHelper
|
162
|
-
allowed_template_helpers :remediations_playbook, :download_rh_playbook
|
163
|
-
end
|
36
|
+
ForemanRhCloud::Plugin.register
|
164
37
|
|
165
38
|
::Katello::UINotifications::Subscriptions::ManifestImportSuccess.include ForemanInventoryUpload::Notifications::ManifestImportSuccessNotificationOverride if defined?(Katello)
|
166
39
|
|
@@ -264,6 +137,6 @@ module ForemanRhCloud
|
|
264
137
|
end
|
265
138
|
|
266
139
|
def self.on_prem_smart_proxy_features
|
267
|
-
['
|
140
|
+
['iop']
|
268
141
|
end
|
269
142
|
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module ForemanRhCloud
|
2
|
+
module Plugin
|
3
|
+
def self.register
|
4
|
+
# This module is auto-loaded, but plugin settings cannot be redefined
|
5
|
+
# Ensure that we don't try to re-register the plugin on code reload
|
6
|
+
return if Foreman::Plugin.find(:foreman_rh_cloud)
|
7
|
+
|
8
|
+
Foreman::Plugin.register :foreman_rh_cloud do
|
9
|
+
requires_foreman '>= 3.13'
|
10
|
+
register_gettext
|
11
|
+
|
12
|
+
apipie_documented_controllers ["#{ForemanRhCloud::Engine.root}/app/controllers/api/v2/**/*.rb"]
|
13
|
+
|
14
|
+
settings do
|
15
|
+
category(:rh_cloud, N_('Insights')) do
|
16
|
+
setting('allow_auto_inventory_upload', type: :boolean, description: N_('Enable automatic upload of your host inventory to the Red Hat cloud'), default: true, full_name: N_('Automatic inventory upload'))
|
17
|
+
setting('allow_auto_insights_sync', type: :boolean, description: N_('Enable automatic synchronization of Insights recommendations from the Red Hat cloud'), default: true, full_name: N_('Synchronize recommendations Automatically'))
|
18
|
+
setting('allow_auto_insights_mismatch_delete', type: :boolean, description: N_('Enable automatic deletion of mismatched host records from the Red Hat cloud'), default: false, full_name: N_('Automatic mismatch deletion'))
|
19
|
+
setting('obfuscate_inventory_hostnames', type: :boolean, description: N_('Obfuscate host names sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host names are not included in the report.)'), default: false, full_name: N_('Obfuscate host names'))
|
20
|
+
setting('obfuscate_inventory_ips', type: :boolean, description: N_('Obfuscate ipv4 addresses sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host IPv4 addresses are not included in the report.)'), default: false, full_name: N_('Obfuscate host ipv4 addresses.'))
|
21
|
+
setting('exclude_installed_packages', type: :boolean, description: N_('Exclude installed packages from being uploaded to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and installed packages are always excluded.)'), default: false, full_name: N_("Exclude installed packages"))
|
22
|
+
setting('include_parameter_tags', type: :boolean, description: N_('Should import include parameter tags from Foreman?'), default: false, full_name: N_('Include parameters in insights-client reports'))
|
23
|
+
setting('rhc_instance_id', type: :string, description: N_('RHC daemon id'), default: nil, full_name: N_('ID of the RHC(Yggdrasil) daemon'))
|
24
|
+
setting('insights_minimal_data_collection', type: :boolean, default: false, full_name: N_('Minimal data collection'), description: N_('Only include the minimum required data in inventory reports for uploading to Red Hat cloud. When this is true, installed packages are excluded from the report regardless of the exclude_installed_packages setting, and host names and IPv4 addresses are excluded from the report regardless of obfuscation settings.'))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Add permissions
|
29
|
+
security_block :foreman_rh_cloud do
|
30
|
+
permission(
|
31
|
+
:generate_foreman_rh_cloud,
|
32
|
+
'foreman_inventory_upload/reports': [:generate],
|
33
|
+
'foreman_inventory_upload/tasks': [:create],
|
34
|
+
'api/v2/rh_cloud/inventory': [:get_hosts, :remove_hosts, :sync_inventory_status, :download_file, :generate_report, :enable_cloud_connector],
|
35
|
+
'foreman_inventory_upload/uploads': [:enable_cloud_connector],
|
36
|
+
'foreman_inventory_upload/uploads_settings': [:set_advanced_setting],
|
37
|
+
'foreman_inventory_upload/missing_hosts': [:remove_hosts],
|
38
|
+
'insights_cloud/settings': [:update],
|
39
|
+
'insights_cloud/tasks': [:create]
|
40
|
+
)
|
41
|
+
permission(
|
42
|
+
:view_foreman_rh_cloud,
|
43
|
+
'foreman_inventory_upload/accounts': [:index],
|
44
|
+
'foreman_inventory_upload/reports': [:last],
|
45
|
+
'foreman_inventory_upload/uploads': [:auto_upload, :show_auto_upload, :download_file, :last],
|
46
|
+
'foreman_inventory_upload/tasks': [:show],
|
47
|
+
'foreman_inventory_upload/cloud_status': [:index],
|
48
|
+
'foreman_inventory_upload/uploads_settings': [:index],
|
49
|
+
'foreman_inventory_upload/missing_hosts': [:index],
|
50
|
+
'api/v2/rh_cloud/advisor_engine_config': [:show],
|
51
|
+
'react': [:index]
|
52
|
+
)
|
53
|
+
permission(
|
54
|
+
:view_insights_hits,
|
55
|
+
{
|
56
|
+
'/foreman_rh_cloud/insights_cloud': [:index], # for bookmarks and later for showing the page
|
57
|
+
'insights_cloud/hits': [:index, :show, :auto_complete_search, :resolutions],
|
58
|
+
'insights_cloud/settings': [:index, :show],
|
59
|
+
'insights_cloud/ui_requests': [:forward_request, :translate_insights_host],
|
60
|
+
'react': [:index],
|
61
|
+
},
|
62
|
+
:resource_type => ::InsightsHit.name
|
63
|
+
)
|
64
|
+
permission(
|
65
|
+
:dispatch_cloud_requests,
|
66
|
+
'api/v2/rh_cloud/cloud_request': [:update]
|
67
|
+
)
|
68
|
+
permission(
|
69
|
+
:control_organization_insights,
|
70
|
+
'insights_cloud/settings': [:set_org_parameter]
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud, :view_insights_hits, :dispatch_cloud_requests, :control_organization_insights]
|
75
|
+
|
76
|
+
role 'ForemanRhCloud', plugin_permissions, 'Role granting permissions to view the hosts inventory,
|
77
|
+
generate a report, upload it to the cloud and download it locally'
|
78
|
+
|
79
|
+
add_permissions_to_default_roles Role::ORG_ADMIN => plugin_permissions,
|
80
|
+
Role::MANAGER => plugin_permissions,
|
81
|
+
Role::SYSTEM_ADMIN => plugin_permissions
|
82
|
+
|
83
|
+
# Adding a top-level menu item
|
84
|
+
sub_menu :top_menu, :insights_menu, caption: N_('Insights'), icon: 'fa fa-cloud', after: :hosts_menu do
|
85
|
+
menu :top_menu,
|
86
|
+
:inventory_upload,
|
87
|
+
caption: N_('Inventory Upload'),
|
88
|
+
url: '/foreman_rh_cloud/inventory_upload',
|
89
|
+
url_hash: { controller: :react, action: :index },
|
90
|
+
parent: :insights_menu
|
91
|
+
menu :top_menu, :insights_hits, caption: N_('Recommendations'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :insights_menu
|
92
|
+
menu :top_menu,
|
93
|
+
:insights_vulnerability,
|
94
|
+
caption: N_('Vulnerability'),
|
95
|
+
url: '/foreman_rh_cloud/insights_vulnerability',
|
96
|
+
url_hash: { controller: :react, action: :index },
|
97
|
+
parent: :insights_menu,
|
98
|
+
if: -> { ForemanRhCloud.with_local_advisor_engine? }
|
99
|
+
end
|
100
|
+
|
101
|
+
register_facet InsightsFacet, :insights do
|
102
|
+
configure_host do
|
103
|
+
api_view :list => 'api/v2/hosts/insights/insights', :single => 'api/v2/hosts/insights/single'
|
104
|
+
set_dependent_action :destroy
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
register_global_js_file 'global'
|
109
|
+
|
110
|
+
register_custom_status InventorySync::InventoryStatus
|
111
|
+
register_custom_status InsightsClientReportStatus
|
112
|
+
|
113
|
+
describe_host do
|
114
|
+
overview_buttons_provider :insights_host_overview_buttons
|
115
|
+
end
|
116
|
+
|
117
|
+
extend_page 'hosts/show' do |context|
|
118
|
+
context.add_pagelet :main_tabs,
|
119
|
+
partial: 'hosts/insights_tab',
|
120
|
+
name: _('Insights'),
|
121
|
+
id: 'insights',
|
122
|
+
onlyif: proc { |host| host.insights }
|
123
|
+
end
|
124
|
+
|
125
|
+
extend_page 'hosts/_list' do |context|
|
126
|
+
context.with_profile :cloud, _('RH Cloud'), default: true do
|
127
|
+
add_pagelet :hosts_table_column_header, key: :insights_recommendations_count, label: _('Recommendations'), sortable: true, width: '12%', class: 'hidden-xs ellipsis', priority: 100,
|
128
|
+
export_data: CsvExporter::ExportDefinition.new(:insights_recommendations_count, callback: ->(host) { host&.insights_hits&.count })
|
129
|
+
add_pagelet :hosts_table_column_content, key: :insights_recommendations_count, callback: ->(host) { hits_counts_cell(host) }, class: 'hidden-xs ellipsis text-center', priority: 100
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
extend_template_helpers ForemanRhCloud::TemplateRendererHelper
|
134
|
+
allowed_template_helpers :remediations_playbook, :download_rh_playbook
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
data/package.json
CHANGED
@@ -9,6 +9,29 @@ module InsightsCloud
|
|
9
9
|
FactoryBot.create(:common_parameter, name: InsightsCloud.enable_client_param, key_type: 'boolean', value: true)
|
10
10
|
end
|
11
11
|
|
12
|
+
context '#translate_insights_host' do
|
13
|
+
setup do
|
14
|
+
@org = FactoryBot.create(:organization)
|
15
|
+
@loc = FactoryBot.create(:location)
|
16
|
+
@host = FactoryBot.create(:host, :with_subscription, :organization => @org)
|
17
|
+
@facet = InsightsFacet.create(host: @host, uuid: @host.subscription_facet.uuid)
|
18
|
+
end
|
19
|
+
|
20
|
+
test "should redirect to host details page by id" do
|
21
|
+
get :translate_insights_host, params: { "uuid" => @host.subscription_facet.uuid }, session: set_session
|
22
|
+
assert_equal 302, @response.status
|
23
|
+
assert @response.redirect?
|
24
|
+
assert_equal "http://test.host/new/hosts/#{@host.id}", @response.redirect_url
|
25
|
+
end
|
26
|
+
|
27
|
+
test "should redirect to not-found page" do
|
28
|
+
get :translate_insights_host, params: { "uuid" => "foo" }, session: set_session
|
29
|
+
assert_equal 302, @response.status
|
30
|
+
assert @response.redirect?
|
31
|
+
assert_equal "http://test.host/page-not-found", @response.redirect_url
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
12
35
|
context '#forward_request' do
|
13
36
|
include MockCerts
|
14
37
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { ScalprumComponent, ScalprumProvider } from '@scalprum/react-core';
|
4
4
|
import { providerOptions } from '../common/ScalprumModule/ScalprumContext';
|
5
|
+
import './CVEsHostDetailsTab.scss';
|
5
6
|
|
6
7
|
const CVEsHostDetailsTab = ({ systemId }) => {
|
7
8
|
const scope = 'vulnerability';
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
|
4
|
+
import { Link } from 'react-router-dom';
|
3
5
|
import { translate as __ } from 'foremanReact/common/I18n';
|
4
6
|
import { propsToCamelCase } from 'foremanReact/common/helpers';
|
5
7
|
import { CVECountCell } from '../InsightsVulnerabilityHostIndexExtensions/CVECountCell';
|
6
|
-
import { providerOptions } from '../common/ScalprumModule/ScalprumContext';
|
7
8
|
|
8
9
|
const HostedRecommendationsCell = hostDetails => {
|
9
10
|
const insightsAttributes = propsToCamelCase(
|
@@ -18,22 +19,26 @@ const HostedRecommendationsCell = hostDetails => {
|
|
18
19
|
return <a href={hitsUrl}>{hitsCount}</a>;
|
19
20
|
};
|
20
21
|
|
21
|
-
const IopRecommendationsCell = hostDetails => {
|
22
|
-
|
23
|
-
const
|
22
|
+
const IopRecommendationsCell = ({ hostDetails }) => {
|
23
|
+
// eslint-disable-next-line camelcase
|
24
|
+
const uuid = hostDetails?.insights_attributes?.uuid;
|
25
|
+
const { response } = useAPI(
|
26
|
+
uuid ? 'get' : null,
|
27
|
+
`/insights_cloud/api/insights/v1/system/${uuid}`,
|
28
|
+
{ key: `HOST_RECS_COUNT_${uuid}` }
|
29
|
+
);
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
const hits = response?.hits;
|
32
|
+
return hits === undefined ? (
|
33
|
+
'—'
|
34
|
+
) : (
|
35
|
+
<Link to={`hosts/${hostDetails.name}#/Insights`}>{hits}</Link>
|
29
36
|
);
|
30
37
|
};
|
31
38
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
</ScalprumProvider>
|
36
|
-
);
|
39
|
+
IopRecommendationsCell.propTypes = {
|
40
|
+
hostDetails: PropTypes.object.isRequired,
|
41
|
+
};
|
37
42
|
|
38
43
|
const RecommendationsCell = hostDetails => {
|
39
44
|
const insightsAttributes = propsToCamelCase(
|
@@ -42,7 +47,7 @@ const RecommendationsCell = hostDetails => {
|
|
42
47
|
);
|
43
48
|
|
44
49
|
return insightsAttributes.useLocalAdvisorEngine ? (
|
45
|
-
<
|
50
|
+
<IopRecommendationsCell hostDetails={hostDetails} />
|
46
51
|
) : (
|
47
52
|
<HostedRecommendationsCell hostDetails={hostDetails} />
|
48
53
|
);
|
@@ -3,6 +3,7 @@ import { Text } from '@patternfly/react-core';
|
|
3
3
|
import { useSelector } from 'react-redux';
|
4
4
|
|
5
5
|
import { translate as __ } from 'foremanReact/common/I18n';
|
6
|
+
import { getDocsURL } from 'foremanReact/common/helpers';
|
6
7
|
import { FormattedMessage } from 'react-intl';
|
7
8
|
import { selectSubscriptionConnectionEnabled } from '../../../InventorySettings/InventorySettingsSelectors';
|
8
9
|
|
@@ -53,6 +54,28 @@ export const PageDescription = () => {
|
|
53
54
|
/>
|
54
55
|
</Text>
|
55
56
|
)}
|
57
|
+
<Text ouiaId="text-minimal-data-collection">
|
58
|
+
<FormattedMessage
|
59
|
+
id="minimal-data-collection-message"
|
60
|
+
defaultMessage={__(
|
61
|
+
'Learn more about {minimalDataCollectionSetting}.'
|
62
|
+
)}
|
63
|
+
values={{
|
64
|
+
minimalDataCollectionSetting: (
|
65
|
+
<a
|
66
|
+
href={getDocsURL(
|
67
|
+
'Managing_Hosts',
|
68
|
+
'setting-minimal-data-collection'
|
69
|
+
)}
|
70
|
+
target="_blank"
|
71
|
+
rel="noopener noreferrer"
|
72
|
+
>
|
73
|
+
{__('setting minimal data collection')}
|
74
|
+
</a>
|
75
|
+
),
|
76
|
+
}}
|
77
|
+
/>
|
78
|
+
</Text>
|
56
79
|
<Text ouiaId="text-more-info-subscription">
|
57
80
|
{__('For more information about the Subscriptions service, see:')}
|
58
81
|
|
@@ -110,8 +110,7 @@ NewHostDetailsTab.defaultProps = {
|
|
110
110
|
|
111
111
|
// Local Insights advisor
|
112
112
|
const scope = 'advisor';
|
113
|
-
|
114
|
-
const module = './HostDetailsLightspeedTabWrapped';
|
113
|
+
const module = './SystemDetailsWrapped';
|
115
114
|
|
116
115
|
const IopInsightsTab = props => (
|
117
116
|
<ScalprumComponent
|
@@ -129,7 +128,7 @@ const IopInsightsTabWrapped = props => (
|
|
129
128
|
</ScalprumProvider>
|
130
129
|
);
|
131
130
|
|
132
|
-
const
|
131
|
+
const InsightsTab = props => {
|
133
132
|
const { response } = props;
|
134
133
|
const isLocalAdvisorEngine =
|
135
134
|
// eslint-disable-next-line camelcase
|
@@ -142,7 +141,7 @@ const LightspeedTab = props => {
|
|
142
141
|
);
|
143
142
|
};
|
144
143
|
|
145
|
-
|
144
|
+
InsightsTab.propTypes = {
|
146
145
|
response: PropTypes.shape({
|
147
146
|
insights_attributes: {
|
148
147
|
use_local_advisor_engine: PropTypes.bool,
|
@@ -150,8 +149,8 @@ LightspeedTab.propTypes = {
|
|
150
149
|
}),
|
151
150
|
};
|
152
151
|
|
153
|
-
|
152
|
+
InsightsTab.defaultProps = {
|
154
153
|
response: {},
|
155
154
|
};
|
156
155
|
|
157
|
-
export default
|
156
|
+
export default InsightsTab;
|
@@ -8,15 +8,12 @@ import { providerOptions } from '../common/ScalprumModule/ScalprumContext';
|
|
8
8
|
const scope = 'advisor';
|
9
9
|
const module = './RecommendationDetailsWrapped';
|
10
10
|
|
11
|
-
const invScope = 'inventory';
|
12
|
-
const invModule = './HybridInventoryTabs';
|
13
|
-
|
14
11
|
const IopRecommendationDetails = props => {
|
15
12
|
const urlParams = useRouteMatch('/foreman_rh_cloud/recommendations/:rule_id');
|
16
13
|
// eslint-disable-next-line camelcase
|
17
14
|
const ruleId = urlParams?.params?.rule_id;
|
18
15
|
return (
|
19
|
-
<div className="
|
16
|
+
<div className="iop-recommendation-details-scalprum">
|
20
17
|
<ScalprumComponent
|
21
18
|
scope={scope}
|
22
19
|
module={module}
|
@@ -24,13 +21,6 @@ const IopRecommendationDetails = props => {
|
|
24
21
|
ruleId={ruleId}
|
25
22
|
{...props}
|
26
23
|
/>
|
27
|
-
<ScalprumComponent
|
28
|
-
scope={invScope}
|
29
|
-
module={invModule}
|
30
|
-
IopRemediationModal={RemediationModal}
|
31
|
-
ruleId={ruleId}
|
32
|
-
{...props}
|
33
|
-
/>
|
34
24
|
</div>
|
35
25
|
);
|
36
26
|
};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.2.
|
4
|
+
version: 12.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- lib/foreman_rh_cloud.rb
|
203
203
|
- lib/foreman_rh_cloud/async/exponential_backoff.rb
|
204
204
|
- lib/foreman_rh_cloud/engine.rb
|
205
|
+
- lib/foreman_rh_cloud/plugin.rb
|
205
206
|
- lib/foreman_rh_cloud/version.rb
|
206
207
|
- lib/insights_cloud.rb
|
207
208
|
- lib/insights_cloud/async/cloud_connector_announce_task.rb
|
@@ -290,6 +291,7 @@ files:
|
|
290
291
|
- test/unit/slice_generator_test.rb
|
291
292
|
- test/unit/tags_generator_test.rb
|
292
293
|
- webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js
|
294
|
+
- webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.scss
|
293
295
|
- webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js
|
294
296
|
- webpack/CVEsHostDetailsTab/index.js
|
295
297
|
- webpack/CveDetailsPage/CveDetailsPage.js
|