foreman_rh_cloud 12.2.12 → 13.0.0
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/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +24 -78
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +23 -77
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +23 -77
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -2
- data/app/models/insights_hit.rb +1 -1
- data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
- data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
- data/app/services/foreman_rh_cloud/tags_auth.rb +1 -2
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +4 -4
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +5 -6
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
- data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -7
- data/lib/foreman_rh_cloud/engine.rb +15 -33
- data/lib/foreman_rh_cloud/plugin.rb +9 -9
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +31 -14
- data/locale/foreman_rh_cloud.pot +157 -261
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.po +26 -79
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.po +26 -79
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.po +24 -77
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.po +25 -78
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.po +25 -78
- data/package.json +1 -1
- data/test/jobs/upload_report_job_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -47
- data/test/unit/slice_generator_test.rb +0 -57
- data/webpack/ForemanRhCloudFills.js +2 -6
- data/webpack/ForemanRhCloudHelpers.js +0 -4
- data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
- data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +16 -3
- data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -8
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +2 -48
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
- data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
- metadata +4 -10
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -29
- data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
- data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
- data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
- data/test/jobs/queue_for_upload_job_test.rb +0 -63
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js +0 -194
@@ -9,14 +9,15 @@
|
|
9
9
|
# 0868a4d1af5275b3f70b0a6dac4c99a4, 2023
|
10
10
|
# Amit Upadhye <aupadhye@redhat.com>, 2023
|
11
11
|
# Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2025
|
12
|
-
# Ondřej Gajdušek, 2025
|
13
12
|
#
|
13
|
+
#, fuzzy
|
14
14
|
msgid ""
|
15
15
|
msgstr ""
|
16
|
-
"Project-Id-Version: foreman_rh_cloud
|
16
|
+
"Project-Id-Version: foreman_rh_cloud 11.1.0\n"
|
17
17
|
"Report-Msgid-Bugs-To: \n"
|
18
18
|
"PO-Revision-Date: 2023-01-20 13:26+0000\n"
|
19
|
-
"Last-Translator:
|
19
|
+
"Last-Translator: Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarde"
|
20
|
+
"n.nl>, 2025\n"
|
20
21
|
"Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
|
21
22
|
"_CN/)\n"
|
22
23
|
"MIME-Version: 1.0\n"
|
@@ -43,9 +44,6 @@ msgstr "高级清单设置"
|
|
43
44
|
msgid "All recommendations are now selected."
|
44
45
|
msgstr "现在选择了所有建议。"
|
45
46
|
|
46
|
-
msgid "Analytics data collection"
|
47
|
-
msgstr "数据收集分析"
|
48
|
-
|
49
47
|
msgid "Any Organization"
|
50
48
|
msgstr "任意机构"
|
51
49
|
|
@@ -127,17 +125,11 @@ msgstr "下载最新的报告"
|
|
127
125
|
msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud"
|
128
126
|
msgstr "启用自动删除来自红帽云的主机记录"
|
129
127
|
|
130
|
-
msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud. Ignored when using local Insights."
|
131
|
-
msgstr ""
|
132
|
-
|
133
128
|
msgid "Enable automatic synchronization of Insights recommendations from the Red Hat cloud"
|
134
129
|
msgstr "启用来自红帽云的 Insights 建议自动同步"
|
135
130
|
|
136
|
-
msgid "Enable automatic
|
137
|
-
msgstr ""
|
138
|
-
|
139
|
-
msgid "Enable automatic upload of your host inventory to the Red Hat cloud. Ignored when using local Insights."
|
140
|
-
msgstr ""
|
131
|
+
msgid "Enable automatic upload of your host inventory to the Red Hat cloud"
|
132
|
+
msgstr "启用自动将主机清单上传到红帽云"
|
141
133
|
|
142
134
|
msgid "Enable automatic upload of your hosts inventory to the Red Hat cloud"
|
143
135
|
msgstr "启用自动将主机清单上传到红帽云"
|
@@ -151,14 +143,17 @@ msgstr "启用清单上传"
|
|
151
143
|
msgid "Encountered an error while trying to access the server:"
|
152
144
|
msgstr "在尝试访问服务器时遇到错误:"
|
153
145
|
|
154
|
-
msgid "Exclude installed
|
146
|
+
msgid "Exclude installed Packages"
|
155
147
|
msgstr "排除安装的软件包"
|
156
148
|
|
157
149
|
msgid "Exclude installed packages from being uploaded to the Red Hat cloud"
|
158
150
|
msgstr "将安装的软件包上传到红帽云"
|
159
151
|
|
160
|
-
msgid "Exclude
|
161
|
-
msgstr ""
|
152
|
+
msgid "Exclude packages"
|
153
|
+
msgstr "排除软件包"
|
154
|
+
|
155
|
+
msgid "Exclude packages from being uploaded to the Red Hat cloud"
|
156
|
+
msgstr "排除软件包上传到红帽云"
|
162
157
|
|
163
158
|
msgid "Exit Code: %s"
|
164
159
|
msgstr "退出代码:%s"
|
@@ -193,9 +188,6 @@ msgstr "全屏"
|
|
193
188
|
msgid "Generate and upload report"
|
194
189
|
msgstr "生成并上传报告"
|
195
190
|
|
196
|
-
msgid "Generate report"
|
197
|
-
msgstr "生成报告"
|
198
|
-
|
199
191
|
msgid "Generate the report, but do not upload"
|
200
192
|
msgstr "生成报告,但不上传"
|
201
193
|
|
@@ -223,9 +215,6 @@ msgstr "获取 RH Cloud 中缺少的主机"
|
|
223
215
|
msgid "Host Insights recommendations"
|
224
216
|
msgstr "主机 Insights 建议"
|
225
217
|
|
226
|
-
msgid "Host inventory report job"
|
227
|
-
msgstr ""
|
228
|
-
|
229
218
|
msgid "Host was not uploaded to your RH cloud inventory"
|
230
219
|
msgstr "主机没有上传到您的 RH 云清单"
|
231
220
|
|
@@ -268,9 +257,6 @@ msgstr "每页的项"
|
|
268
257
|
msgid "Knowledgebase article"
|
269
258
|
msgstr "知识库文章"
|
270
259
|
|
271
|
-
msgid "Learn more about {minimalDataCollectionSetting}."
|
272
|
-
msgstr "了解有关 {minimalDataCollectionSetting} 的更多信息。"
|
273
|
-
|
274
260
|
msgid "List of host UUIDs"
|
275
261
|
msgstr "主机 UUID 列表"
|
276
262
|
|
@@ -286,12 +272,6 @@ msgstr "低"
|
|
286
272
|
msgid "Manual"
|
287
273
|
msgstr "手册"
|
288
274
|
|
289
|
-
msgid "Minimal data collection"
|
290
|
-
msgstr "最小数据收集"
|
291
|
-
|
292
|
-
msgid "Missing Insights facets created: %s"
|
293
|
-
msgstr ""
|
294
|
-
|
295
275
|
msgid "Moderate"
|
296
276
|
msgstr "中等"
|
297
277
|
|
@@ -322,33 +302,21 @@ msgstr "没有同步,此机构没有带有订阅的主机。"
|
|
322
302
|
msgid "Notice"
|
323
303
|
msgstr "注意事項"
|
324
304
|
|
305
|
+
msgid "Obfuscate IPs"
|
306
|
+
msgstr "模糊 IP"
|
307
|
+
|
325
308
|
msgid "Obfuscate host ipv4 addresses"
|
326
309
|
msgstr "模糊的主机 ipv4 地址"
|
327
310
|
|
328
|
-
msgid "Obfuscate host ipv4 addresses."
|
329
|
-
msgstr "对主机 ipv4 地址进行模糊化处理"
|
330
|
-
|
331
311
|
msgid "Obfuscate host names"
|
332
312
|
msgstr "模糊主机名"
|
333
313
|
|
334
314
|
msgid "Obfuscate host names sent to the Red Hat cloud"
|
335
315
|
msgstr "发送到红帽云的模糊主机名"
|
336
316
|
|
337
|
-
msgid "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.) Ignored when using local Insights."
|
338
|
-
msgstr ""
|
339
|
-
|
340
317
|
msgid "Obfuscate ipv4 addresses sent to the Red Hat cloud"
|
341
318
|
msgstr "发送到红帽云的模糊 ipv4 地址"
|
342
319
|
|
343
|
-
msgid "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.) Ignored when using local Insights."
|
344
|
-
msgstr ""
|
345
|
-
|
346
|
-
msgid "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. Ignored when using local Insights."
|
347
|
-
msgstr ""
|
348
|
-
|
349
|
-
msgid "Only send the minimum required data to Red Hat cloud, obfuscation settings are disabled"
|
350
|
-
msgstr "仅将最低所需的数据发送到红帽云,禁用模糊设置"
|
351
|
-
|
352
320
|
msgid "Oops! Couldn't find organization that matches your query"
|
353
321
|
msgstr "未找到与您的查询匹配的机构"
|
354
322
|
|
@@ -364,8 +332,11 @@ msgstr "运行 playbook"
|
|
364
332
|
msgid "RH Cloud"
|
365
333
|
msgstr "RH Cloud"
|
366
334
|
|
367
|
-
msgid "RHC daemon id
|
368
|
-
msgstr ""
|
335
|
+
msgid "RHC daemon id"
|
336
|
+
msgstr "RHC 守护进程 ID"
|
337
|
+
|
338
|
+
msgid "RHCloud"
|
339
|
+
msgstr "RHCloud"
|
369
340
|
|
370
341
|
msgid "Read more about it in RH cloud insights"
|
371
342
|
msgstr "在 RH Cloud insights 中了解更多有关它的信息"
|
@@ -424,7 +395,7 @@ msgstr "解决方案"
|
|
424
395
|
msgid "Run RH Cloud playbook"
|
425
396
|
msgstr "运行 RH Cloud playbook"
|
426
397
|
|
427
|
-
msgid "Run playbook
|
398
|
+
msgid "Run playbook genrated by Red Hat remediations app"
|
428
399
|
msgstr "运行由红帽补救应用生成的 playbook"
|
429
400
|
|
430
401
|
msgid "Run remediation playbook generated by Insights"
|
@@ -439,17 +410,14 @@ msgstr "用于删除主机的有范围的搜索字符串"
|
|
439
410
|
msgid "Select recommendations from all pages"
|
440
411
|
msgstr "在所有页面中选择建议"
|
441
412
|
|
442
|
-
msgid "Send additional data to enhance Insights services, as per the settings"
|
443
|
-
msgstr "根据设置,发送额外数据以增强 Insights 服务"
|
444
|
-
|
445
413
|
msgid "Set the current organization context for the request"
|
446
414
|
msgstr "设置请求的当前机构上下文"
|
447
415
|
|
448
416
|
msgid "Settings"
|
449
417
|
msgstr "设置"
|
450
418
|
|
451
|
-
msgid "Should import include parameter tags from Foreman?
|
452
|
-
msgstr ""
|
419
|
+
msgid "Should import include parameter tags from Foreman?"
|
420
|
+
msgstr "应从 Foreman 导入包含参数标签?"
|
453
421
|
|
454
422
|
msgid "Show Advanced Settings"
|
455
423
|
msgstr "显示高级设置"
|
@@ -457,12 +425,6 @@ msgstr "显示高级设置"
|
|
457
425
|
msgid "Show if system is configured to use local iop-advisor-engine."
|
458
426
|
msgstr "显示系统是否被配置为使用本地 iop-advisor-engine。"
|
459
427
|
|
460
|
-
msgid "Single-host report job"
|
461
|
-
msgstr ""
|
462
|
-
|
463
|
-
msgid "Single-host report job for host %s"
|
464
|
-
msgstr ""
|
465
|
-
|
466
428
|
msgid "Start inventory synchronization"
|
467
429
|
msgstr "启动清单同步"
|
468
430
|
|
@@ -493,8 +455,8 @@ msgstr "Red Hat Hybrid Cloud Console 提供了一组云服务,包括 Red Hat I
|
|
493
455
|
msgid "The report file %{filename} doesn't exist"
|
494
456
|
msgstr "报告文件 %{filename} 不存在"
|
495
457
|
|
496
|
-
msgid "The scheduled process is disabled because this Foreman is configured with
|
497
|
-
msgstr "调度的进程被禁用,因为此 Foreman
|
458
|
+
msgid "The scheduled process is disabled because this Foreman is configured with the use_local_advisor_engine option."
|
459
|
+
msgstr "调度的进程被禁用,因为此 Foreman 配置了 use_local_advisor_engine 选项。"
|
498
460
|
|
499
461
|
msgid "The server returned the following error: %s"
|
500
462
|
msgstr "服务器返回以下错误:%s"
|
@@ -505,9 +467,6 @@ msgstr "任务失败,错误为:"
|
|
505
467
|
msgid "There are no recommendations for your hosts"
|
506
468
|
msgstr "没有适用于您的主机的建议"
|
507
469
|
|
508
|
-
msgid "There were no missing Insights facets"
|
509
|
-
msgstr ""
|
510
|
-
|
511
470
|
msgid "This action will also enable automatic reports upload"
|
512
471
|
msgstr "此操作还会启用自动报告上传"
|
513
472
|
|
@@ -517,9 +476,6 @@ msgstr "要为所有 Foreman 机构启用此报告,请将 {uploadButtonName}
|
|
517
476
|
msgid "To manually upload the data for a specific organization, select an organization and click {restartButtonName}."
|
518
477
|
msgstr "要手动上传特定机构的数据,请选择机构并点 {restartButtonName}。"
|
519
478
|
|
520
|
-
msgid "Total CVEs"
|
521
|
-
msgstr "CVE 总数"
|
522
|
-
|
523
479
|
msgid "Total risk"
|
524
480
|
msgstr "总风险"
|
525
481
|
|
@@ -547,12 +503,6 @@ msgstr "查看所有建议"
|
|
547
503
|
msgid "View in Red Hat Insights"
|
548
504
|
msgstr "禁用 Red Hat Insights"
|
549
505
|
|
550
|
-
msgid "Vulnerabilities"
|
551
|
-
msgstr "安全漏洞"
|
552
|
-
|
553
|
-
msgid "Vulnerability"
|
554
|
-
msgstr "安全漏洞"
|
555
|
-
|
556
506
|
msgid "Wait and %s"
|
557
507
|
msgstr "等待和 %s"
|
558
508
|
|
@@ -619,9 +569,6 @@ msgstr "rule id"
|
|
619
569
|
msgid "rule title"
|
620
570
|
msgstr "rule 标题"
|
621
571
|
|
622
|
-
msgid "setting minimal data collection"
|
623
|
-
msgstr "设置最小数据收集"
|
624
|
-
|
625
572
|
msgid "solution url"
|
626
573
|
msgstr "solution url"
|
627
574
|
|
data/package.json
CHANGED
@@ -18,8 +18,7 @@ class UploadReportJobTest < ActiveSupport::TestCase
|
|
18
18
|
|
19
19
|
label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
|
20
20
|
progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
|
21
|
-
assert_match(/
|
22
|
-
assert_match(/Report location:/, progress_output.full_output)
|
21
|
+
assert_match(/Upload canceled/, progress_output.full_output)
|
23
22
|
assert_match(/exit 1/, progress_output.status)
|
24
23
|
end
|
25
24
|
|
@@ -313,51 +313,4 @@ class FactHelpersTest < ActiveSupport::TestCase
|
|
313
313
|
assert_equal '10.230.230.3', ip3
|
314
314
|
end
|
315
315
|
end
|
316
|
-
|
317
|
-
describe 'IoP smart proxy checks' do
|
318
|
-
test 'obfuscate_hostname? returns false when global setting is enabled but IoP is present' do
|
319
|
-
Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(true)
|
320
|
-
ForemanRhCloud.expects(:with_iop_smart_proxy?).returns(true)
|
321
|
-
host = mock('host')
|
322
|
-
# When IoP is present, it falls back to checking host-specific facts
|
323
|
-
@instance.expects(:fact_value).with(host, 'insights_client::obfuscate_hostname_enabled').returns(nil)
|
324
|
-
|
325
|
-
result = @instance.obfuscate_hostname?(host)
|
326
|
-
|
327
|
-
refute result
|
328
|
-
end
|
329
|
-
|
330
|
-
test 'obfuscate_hostname? returns true when global setting is enabled and IoP is not present' do
|
331
|
-
Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(true)
|
332
|
-
ForemanRhCloud.expects(:with_iop_smart_proxy?).returns(false)
|
333
|
-
host = mock('host')
|
334
|
-
|
335
|
-
result = @instance.obfuscate_hostname?(host)
|
336
|
-
|
337
|
-
assert result
|
338
|
-
end
|
339
|
-
|
340
|
-
test 'obfuscate_ips? returns false when global setting is enabled but IoP is present' do
|
341
|
-
Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(true)
|
342
|
-
ForemanRhCloud.expects(:with_iop_smart_proxy?).returns(true)
|
343
|
-
host = mock('host')
|
344
|
-
# When IoP is present, it falls back to checking host-specific facts
|
345
|
-
@instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns(nil)
|
346
|
-
@instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns(nil)
|
347
|
-
|
348
|
-
result = @instance.obfuscate_ips?(host)
|
349
|
-
|
350
|
-
refute result
|
351
|
-
end
|
352
|
-
|
353
|
-
test 'obfuscate_ips? returns true when global setting is enabled and IoP is not present' do
|
354
|
-
Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(true)
|
355
|
-
ForemanRhCloud.expects(:with_iop_smart_proxy?).returns(false)
|
356
|
-
host = mock('host')
|
357
|
-
|
358
|
-
result = @instance.obfuscate_ips?(host)
|
359
|
-
|
360
|
-
assert result
|
361
|
-
end
|
362
|
-
end
|
363
316
|
end
|
@@ -107,36 +107,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
107
107
|
assert_equal 'test_nic1', actual_nic['name']
|
108
108
|
end
|
109
109
|
|
110
|
-
test 'does not generate a report with minimal data collection when iop is present' do
|
111
|
-
Setting[:insights_minimal_data_collection] = true
|
112
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
113
|
-
|
114
|
-
batch = Host.where(id: @host.id).in_batches.first
|
115
|
-
generator = create_generator(batch)
|
116
|
-
|
117
|
-
json_str = generator.render
|
118
|
-
actual = JSON.parse(json_str.join("\n"))
|
119
|
-
|
120
|
-
assert_equal '00000000-0000-0000-0000-000000000000', actual['report_slice_id']
|
121
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
122
|
-
assert_nil actual_host['ip_addresses']
|
123
|
-
assert_nil actual_host['mac_addresses']
|
124
|
-
assert_equal @host.fqdn, actual_host['fqdn']
|
125
|
-
assert_equal '1234', actual_host['account']
|
126
|
-
assert_equal 1, generator.hosts_count
|
127
|
-
assert_not_nil(actual_system_profile = actual_host['system_profile'])
|
128
|
-
assert_nil actual_system_profile['number_of_cpus']
|
129
|
-
assert_nil actual_system_profile['number_of_sockets']
|
130
|
-
assert_nil actual_system_profile['cores_per_socket']
|
131
|
-
assert_nil actual_system_profile['system_memory_bytes']
|
132
|
-
assert_nil actual_system_profile['os_release']
|
133
|
-
assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
|
134
|
-
assert_not_nil(actual_nic = actual_network_interfaces.first)
|
135
|
-
refute actual_nic.key?('mtu')
|
136
|
-
refute actual_nic.key?('mac_address')
|
137
|
-
assert_equal 'test_nic1', actual_nic['name']
|
138
|
-
end
|
139
|
-
|
140
110
|
test 'generates a report with minimal data collection' do
|
141
111
|
Setting[:insights_minimal_data_collection] = true
|
142
112
|
create_fact_values(@host,
|
@@ -960,33 +930,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
960
930
|
assert_equal 'alibaba', actual_profile['cloud_provider']
|
961
931
|
end
|
962
932
|
|
963
|
-
test 'do not exclude packages when iop is present' do
|
964
|
-
Setting[:exclude_installed_packages] = true
|
965
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
966
|
-
installed_package = ::Katello::InstalledPackage.create(name: 'test-package', nvrea: 'test-package-1.0.x86_64', nvra: 'test-package-1.0.x86_64')
|
967
|
-
|
968
|
-
another_host = FactoryBot.create(
|
969
|
-
:host,
|
970
|
-
:with_subscription,
|
971
|
-
:with_content,
|
972
|
-
content_view: @host.content_views.first,
|
973
|
-
lifecycle_environment: @host.lifecycle_environments.first,
|
974
|
-
organization: @host.organization,
|
975
|
-
installed_packages: [installed_package]
|
976
|
-
)
|
977
|
-
|
978
|
-
batch = Host.where(id: another_host.id).in_batches.first
|
979
|
-
generator = create_generator(batch)
|
980
|
-
|
981
|
-
json_str = generator.render
|
982
|
-
actual = JSON.parse(json_str.join("\n"))
|
983
|
-
|
984
|
-
assert_equal '00000000-0000-0000-0000-000000000000', actual['report_slice_id']
|
985
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
986
|
-
assert_not_nil(actual_profile = actual_host['system_profile'])
|
987
|
-
assert_not_nil(actual_profile['installed_packages'])
|
988
|
-
end
|
989
|
-
|
990
933
|
test 'include packages installed in the report' do
|
991
934
|
Setting[:exclude_installed_packages] = false
|
992
935
|
installed_package = ::Katello::InstalledPackage.create(name: 'test-package', nvrea: 'test-package-1.0.x86_64', nvra: 'test-package-1.0.x86_64')
|
@@ -4,11 +4,7 @@ import { translate as __ } from 'foremanReact/common/I18n';
|
|
4
4
|
import InventoryAutoUploadSwitcher from './ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload';
|
5
5
|
import NewHostDetailsTab from './InsightsHostDetailsTab/NewHostDetailsTab';
|
6
6
|
import { InsightsTotalRiskChartWrapper } from './InsightsHostDetailsTab/InsightsTotalRiskChartWrapper';
|
7
|
-
import {
|
8
|
-
isNotRhelHost,
|
9
|
-
vulnerabilityDisabled,
|
10
|
-
hasNoInsightsFacet,
|
11
|
-
} from './ForemanRhCloudHelpers';
|
7
|
+
import { isNotRhelHost, vulnerabilityDisabled } from './ForemanRhCloudHelpers';
|
12
8
|
import CVEsHostDetailsTabWrapper from './CVEsHostDetailsTab/CVEsHostDetailsTab';
|
13
9
|
|
14
10
|
const fills = [
|
@@ -24,7 +20,7 @@ const fills = [
|
|
24
20
|
component: props => <NewHostDetailsTab {...props} />,
|
25
21
|
weight: 400,
|
26
22
|
metadata: {
|
27
|
-
hideTab:
|
23
|
+
hideTab: isNotRhelHost,
|
28
24
|
title: __('Recommendations'),
|
29
25
|
},
|
30
26
|
},
|
@@ -14,7 +14,3 @@ export const isNotRhelHost = ({ hostDetails }) =>
|
|
14
14
|
|
15
15
|
export const vulnerabilityDisabled = ({ hostDetails }) =>
|
16
16
|
isNotRhelHost({ hostDetails }) || !hostDetails?.vulnerability?.enabled;
|
17
|
-
|
18
|
-
export const hasNoInsightsFacet = ({ response, hostDetails }) =>
|
19
|
-
// eslint-disable-next-line camelcase
|
20
|
-
!(response?.insights_attributes || hostDetails?.insights_attributes);
|
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import { useDispatch } from 'react-redux';
|
4
4
|
import { push } from 'connected-react-router';
|
5
5
|
import { useHistory } from 'react-router-dom';
|
6
|
-
import { Bullseye,
|
6
|
+
import { Bullseye, Title } from '@patternfly/react-core';
|
7
|
+
import { DropdownItem } from '@patternfly/react-core/deprecated';
|
7
8
|
import {
|
8
9
|
ChartDonut,
|
9
10
|
ChartLegend,
|
@@ -18,67 +19,36 @@ import SkeletonLoader from 'foremanReact/components/common/SkeletonLoader';
|
|
18
19
|
import { insightsCloudUrl } from '../InsightsCloudSync/InsightsCloudSyncHelpers';
|
19
20
|
import { getInitialRisks, theme } from './InsightsTabConstants';
|
20
21
|
|
21
|
-
const InsightsTotalRiskCard = ({ hostDetails }) => {
|
22
|
-
const { id, insights_attributes: insightsFacet } = hostDetails;
|
23
|
-
const uuid = insightsFacet?.uuid;
|
24
|
-
// eslint-disable-next-line camelcase
|
25
|
-
const isIop = insightsFacet?.use_iop_mode;
|
22
|
+
const InsightsTotalRiskCard = ({ hostDetails: { id } }) => {
|
26
23
|
const [totalRisks, setTotalRisks] = useState(getInitialRisks());
|
27
24
|
const hashHistory = useHistory();
|
28
25
|
const dispatch = useDispatch();
|
29
26
|
const API_KEY = `HOST_${id}_RECOMMENDATIONS`;
|
30
27
|
const API_OPTIONS = useMemo(() => ({ key: API_KEY }), [API_KEY]);
|
28
|
+
const url = id && insightsCloudUrl(`hits/${id}`); // This will keep the API call from being triggered if there's no host id.
|
29
|
+
const {
|
30
|
+
status = STATUS.PENDING,
|
31
|
+
response: { hits = [] },
|
32
|
+
} = useAPI('get', url, API_OPTIONS);
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
: id && insightsCloudUrl(`hits/${id}`);
|
36
|
-
const { status = STATUS.PENDING, response } = useAPI('get', url, API_OPTIONS);
|
37
|
-
|
38
|
-
const checkRisks = useMemo(() => {
|
39
|
-
if (!response || status !== STATUS.RESOLVED) {
|
40
|
-
return getInitialRisks();
|
41
|
-
}
|
42
|
-
|
43
|
-
const risks = getInitialRisks();
|
44
|
-
if (isIop) {
|
45
|
-
const {
|
46
|
-
low_hits: lowHits = 0,
|
47
|
-
moderate_hits: moderateHits = 0,
|
48
|
-
important_hits: importantHits = 0,
|
49
|
-
critical_hits: criticalHits = 0,
|
50
|
-
hits = 0,
|
51
|
-
} = response;
|
52
|
-
|
53
|
-
risks[1].value += lowHits;
|
54
|
-
risks[2].value += moderateHits;
|
55
|
-
risks[3].value += importantHits;
|
56
|
-
risks[4].value += criticalHits;
|
57
|
-
risks.total = hits;
|
58
|
-
} else {
|
59
|
-
const { hits = [] } = response;
|
34
|
+
useEffect(() => {
|
35
|
+
if (status === STATUS.RESOLVED) {
|
36
|
+
const risks = getInitialRisks();
|
60
37
|
hits.forEach(({ total_risk: risk }) => {
|
61
38
|
risks[risk].value += 1;
|
62
39
|
});
|
63
40
|
risks.total = hits.length;
|
41
|
+
setTotalRisks(risks);
|
64
42
|
}
|
65
|
-
|
66
|
-
}, [response, status, isIop]);
|
67
|
-
|
68
|
-
useEffect(() => {
|
69
|
-
setTotalRisks(checkRisks);
|
70
|
-
}, [checkRisks]);
|
71
|
-
|
72
|
-
if (!insightsFacet) return null;
|
43
|
+
}, [hits, status]);
|
73
44
|
|
74
45
|
const onChartClick = (evt, { index }) => {
|
75
46
|
hashHistory.push(`/Insights`);
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
);
|
47
|
+
dispatch(
|
48
|
+
push({
|
49
|
+
search: `search=total_risk+%3D+${index + 1}`,
|
50
|
+
})
|
51
|
+
);
|
82
52
|
};
|
83
53
|
|
84
54
|
const onChartHover = (evt, { index }) => [
|
@@ -92,16 +62,11 @@ const InsightsTotalRiskCard = ({ hostDetails }) => {
|
|
92
62
|
const { 1: low, 2: moderate, 3: important, 4: critical, total } = totalRisks;
|
93
63
|
|
94
64
|
// eslint-disable-next-line react/prop-types
|
95
|
-
const LegendLabel = ({ index, ...rest }) =>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<a key={index} onClick={() => onChartClick(null, { index })}>
|
101
|
-
<ChartLabel {...rest} />
|
102
|
-
</a>
|
103
|
-
);
|
104
|
-
};
|
65
|
+
const LegendLabel = ({ index, ...rest }) => (
|
66
|
+
<a key={index} onClick={() => onChartClick(null, { index })}>
|
67
|
+
<ChartLabel {...rest} />
|
68
|
+
</a>
|
69
|
+
);
|
105
70
|
|
106
71
|
const legend = (
|
107
72
|
<ChartLegend
|
@@ -162,7 +127,6 @@ const InsightsTotalRiskCard = ({ hostDetails }) => {
|
|
162
127
|
return (
|
163
128
|
<CardTemplate
|
164
129
|
header={__('Total risks')}
|
165
|
-
overrideDropdownProps={{ id: 'total-risks-dropdown-container' }}
|
166
130
|
dropdownItems={[
|
167
131
|
<DropdownItem
|
168
132
|
key="insights-tab"
|
@@ -131,15 +131,28 @@ const IopInsightsTabWrapped = props => (
|
|
131
131
|
);
|
132
132
|
|
133
133
|
const InsightsTab = props => {
|
134
|
-
const
|
134
|
+
const { response } = props;
|
135
|
+
const isLocalAdvisorEngine =
|
136
|
+
// eslint-disable-next-line camelcase
|
137
|
+
response?.insights_attributes?.use_iop_mode;
|
135
138
|
|
136
|
-
return
|
139
|
+
return isLocalAdvisorEngine ? (
|
137
140
|
<IopInsightsTabWrapped {...props} />
|
138
141
|
) : (
|
139
142
|
<NewHostDetailsTab {...props} />
|
140
143
|
);
|
141
144
|
};
|
142
145
|
|
143
|
-
InsightsTab.
|
146
|
+
InsightsTab.propTypes = {
|
147
|
+
response: PropTypes.shape({
|
148
|
+
insights_attributes: {
|
149
|
+
use_iop_mode: PropTypes.bool,
|
150
|
+
},
|
151
|
+
}),
|
152
|
+
};
|
153
|
+
|
154
|
+
InsightsTab.defaultProps = {
|
155
|
+
response: {},
|
156
|
+
};
|
144
157
|
|
145
158
|
export default InsightsTab;
|
@@ -3,31 +3,25 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import { UnknownIcon } from '@patternfly/react-icons';
|
4
4
|
import { Link } from 'react-router-dom';
|
5
5
|
import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
|
6
|
+
|
6
7
|
import { insightsCloudUrl } from '../InsightsCloudSync/InsightsCloudSyncHelpers';
|
7
|
-
import { useAdvisorEngineConfig } from '../common/Hooks/ConfigHooks';
|
8
8
|
|
9
9
|
const vulnerabilityApiPath = path =>
|
10
10
|
insightsCloudUrl(`api/vulnerability/v1/${path}`);
|
11
11
|
|
12
12
|
export const CVECountCell = ({ hostDetails }) => {
|
13
|
-
const isIopEnabled = useAdvisorEngineConfig();
|
14
|
-
|
15
13
|
// eslint-disable-next-line camelcase
|
16
14
|
const uuid = hostDetails?.subscription_facet_attributes?.uuid;
|
17
15
|
|
18
16
|
const key = `HOST_CVE_COUNT_${uuid}`;
|
19
17
|
const response = useAPI(
|
20
|
-
|
18
|
+
uuid ? 'get' : null,
|
21
19
|
vulnerabilityApiPath(`systems?uuid=${uuid}`),
|
22
20
|
{
|
23
21
|
key,
|
24
22
|
}
|
25
23
|
);
|
26
24
|
|
27
|
-
if (!isIopEnabled) {
|
28
|
-
return <UnknownIcon />;
|
29
|
-
}
|
30
|
-
|
31
25
|
if (uuid === undefined) {
|
32
26
|
return <UnknownIcon />;
|
33
27
|
}
|