foreman_rh_cloud 13.2.9 → 14.0.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/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +2 -9
- data/app/models/concerns/rh_cloud_host.rb +3 -35
- data/app/models/insights_client_report_status.rb +1 -9
- data/app/models/inventory_sync/inventory_status.rb +4 -16
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +0 -8
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
- data/lib/foreman_rh_cloud/engine.rb +0 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
- data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
- data/locale/fr/foreman_rh_cloud.po +65 -66
- data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
- data/locale/ja/foreman_rh_cloud.po +70 -72
- data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
- data/locale/ka/foreman_rh_cloud.po +10 -11
- data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
- data/locale/ko/foreman_rh_cloud.po +63 -64
- data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
- data/locale/zh_CN/foreman_rh_cloud.po +64 -65
- data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +1 -41
- data/test/jobs/insights_client_status_aging_test.rb +0 -40
- data/test/jobs/inventory_full_sync_test.rb +4 -219
- data/test/jobs/inventory_hosts_sync_test.rb +5 -7
- data/test/jobs/inventory_self_host_sync_test.rb +1 -1
- data/test/models/insights_client_report_status_test.rb +0 -109
- data/test/unit/archived_report_generator_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -16
- data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
- data/test/unit/rh_cloud_host_test.rb +0 -214
- data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +2 -21
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +1 -6
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +6 -45
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +0 -7
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +14 -44
- metadata +16 -10
- data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
- data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
- data/test/models/inventory_sync/inventory_status_test.rb +0 -85
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
- data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -154
|
@@ -188,218 +188,4 @@ class RhCloudHostTest < ActiveSupport::TestCase
|
|
|
188
188
|
assert_equal local_uuid, @host.insights_uuid
|
|
189
189
|
end
|
|
190
190
|
end
|
|
191
|
-
|
|
192
|
-
context 'scoped search on insights_uuid' do
|
|
193
|
-
setup do
|
|
194
|
-
@org = FactoryBot.create(:organization)
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
teardown do
|
|
198
|
-
ForemanRhCloud.unstub(:with_iop_smart_proxy?)
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
test 'searches insights_facet.uuid in non-IoP mode with = operator' do
|
|
202
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
|
|
203
|
-
host1 = FactoryBot.create(:host, :managed, organization: @org)
|
|
204
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'insights-uuid-123')
|
|
205
|
-
host2 = FactoryBot.create(:host, :managed, organization: @org)
|
|
206
|
-
host2.insights = FactoryBot.create(:insights_facet, host_id: host2.id, uuid: 'insights-uuid-456')
|
|
207
|
-
|
|
208
|
-
results = Host::Managed.search_for('insights_uuid = insights-uuid-123')
|
|
209
|
-
|
|
210
|
-
assert_includes results, host1
|
|
211
|
-
assert_not_includes results, host2
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
test 'searches subscription_facet.uuid in IoP mode with = operator' do
|
|
215
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
|
216
|
-
host1 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
217
|
-
host2 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
218
|
-
|
|
219
|
-
# Even if insights_facet has different UUID, should use subscription_facet UUID
|
|
220
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'stale-123')
|
|
221
|
-
|
|
222
|
-
results = Host::Managed.search_for("insights_uuid = #{host1.subscription_facet.uuid}")
|
|
223
|
-
|
|
224
|
-
assert_includes results, host1
|
|
225
|
-
assert_not_includes results, host2
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
test 'searches with ^ operator (IN) in non-IoP mode' do
|
|
229
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
|
|
230
|
-
host1 = FactoryBot.create(:host, :managed, organization: @org)
|
|
231
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'uuid-1')
|
|
232
|
-
host2 = FactoryBot.create(:host, :managed, organization: @org)
|
|
233
|
-
host2.insights = FactoryBot.create(:insights_facet, host_id: host2.id, uuid: 'uuid-2')
|
|
234
|
-
host3 = FactoryBot.create(:host, :managed, organization: @org)
|
|
235
|
-
host3.insights = FactoryBot.create(:insights_facet, host_id: host3.id, uuid: 'uuid-3')
|
|
236
|
-
|
|
237
|
-
results = Host::Managed.search_for('insights_uuid ^ (uuid-1,uuid-2)')
|
|
238
|
-
|
|
239
|
-
assert_includes results, host1
|
|
240
|
-
assert_includes results, host2
|
|
241
|
-
assert_not_includes results, host3
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
test 'searches with ^ operator (IN) in IoP mode - THE BUG FIX' do
|
|
245
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
|
246
|
-
host1 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
247
|
-
host2 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
248
|
-
host3 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
249
|
-
|
|
250
|
-
# Create insights facets with stale UUIDs to verify we're using subscription_facet
|
|
251
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'stale-1')
|
|
252
|
-
host2.insights = FactoryBot.create(:insights_facet, host_id: host2.id, uuid: 'stale-2')
|
|
253
|
-
host3.insights = FactoryBot.create(:insights_facet, host_id: host3.id, uuid: 'stale-3')
|
|
254
|
-
|
|
255
|
-
uuid1 = host1.subscription_facet.uuid
|
|
256
|
-
uuid2 = host2.subscription_facet.uuid
|
|
257
|
-
|
|
258
|
-
# This is the search query that remediation modal creates
|
|
259
|
-
results = Host::Managed.search_for("insights_uuid ^ (#{uuid1},#{uuid2})")
|
|
260
|
-
|
|
261
|
-
# Should find hosts by subscription_facet UUID, not insights_facet UUID
|
|
262
|
-
assert_includes results, host1
|
|
263
|
-
assert_includes results, host2
|
|
264
|
-
assert_not_includes results, host3
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
test 'searches with !^ operator (NOT IN) in non-IoP mode' do
|
|
268
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
|
|
269
|
-
host1 = FactoryBot.create(:host, :managed, organization: @org)
|
|
270
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'uuid-1')
|
|
271
|
-
host2 = FactoryBot.create(:host, :managed, organization: @org)
|
|
272
|
-
host2.insights = FactoryBot.create(:insights_facet, host_id: host2.id, uuid: 'uuid-2')
|
|
273
|
-
host3 = FactoryBot.create(:host, :managed, organization: @org)
|
|
274
|
-
host3.insights = FactoryBot.create(:insights_facet, host_id: host3.id, uuid: 'uuid-3')
|
|
275
|
-
|
|
276
|
-
results = Host::Managed.search_for('insights_uuid !^ (uuid-1,uuid-2)')
|
|
277
|
-
|
|
278
|
-
assert_not_includes results, host1
|
|
279
|
-
assert_not_includes results, host2
|
|
280
|
-
assert_includes results, host3
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
test 'searches with !^ operator (NOT IN) in IoP mode' do
|
|
284
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
|
285
|
-
host1 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
286
|
-
host2 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
287
|
-
host3 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
288
|
-
|
|
289
|
-
uuid1 = host1.subscription_facet.uuid
|
|
290
|
-
uuid2 = host2.subscription_facet.uuid
|
|
291
|
-
|
|
292
|
-
results = Host::Managed.search_for("insights_uuid !^ (#{uuid1},#{uuid2})")
|
|
293
|
-
|
|
294
|
-
assert_not_includes results, host1
|
|
295
|
-
assert_not_includes results, host2
|
|
296
|
-
assert_includes results, host3
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
test 'handles hosts without facets in non-IoP mode' do
|
|
300
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
|
|
301
|
-
host_without_facet = FactoryBot.create(:host, :managed, organization: @org)
|
|
302
|
-
host_with_facet = FactoryBot.create(:host, :managed, organization: @org)
|
|
303
|
-
host_with_facet.insights = FactoryBot.create(:insights_facet, host_id: host_with_facet.id, uuid: 'uuid-1')
|
|
304
|
-
|
|
305
|
-
results = Host::Managed.search_for('insights_uuid = uuid-1')
|
|
306
|
-
|
|
307
|
-
assert_includes results, host_with_facet
|
|
308
|
-
assert_not_includes results, host_without_facet
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
test 'handles hosts without subscription_facet in IoP mode' do
|
|
312
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
|
313
|
-
host_without_sub = FactoryBot.create(:host, :managed, organization: @org)
|
|
314
|
-
host_with_sub = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
315
|
-
|
|
316
|
-
uuid = host_with_sub.subscription_facet.uuid
|
|
317
|
-
|
|
318
|
-
results = Host::Managed.search_for("insights_uuid = #{uuid}")
|
|
319
|
-
|
|
320
|
-
assert_includes results, host_with_sub
|
|
321
|
-
assert_not_includes results, host_without_sub
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
test 'mode changes are reflected in searches' do
|
|
325
|
-
host1 = FactoryBot.create(:host, :managed, :with_subscription, organization: @org)
|
|
326
|
-
host1.insights = FactoryBot.create(:insights_facet, host_id: host1.id, uuid: 'insights-uuid-abc')
|
|
327
|
-
insights_uuid = 'insights-uuid-abc'
|
|
328
|
-
subscription_uuid = host1.subscription_facet.uuid
|
|
329
|
-
|
|
330
|
-
# Non-IoP mode: should find by insights_facet UUID
|
|
331
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(false)
|
|
332
|
-
results = Host::Managed.search_for("insights_uuid = #{insights_uuid}")
|
|
333
|
-
assert_includes results, host1
|
|
334
|
-
|
|
335
|
-
# IoP mode: should find by subscription_facet UUID
|
|
336
|
-
ForemanRhCloud.stubs(:with_iop_smart_proxy?).returns(true)
|
|
337
|
-
results = Host::Managed.search_for("insights_uuid = #{subscription_uuid}")
|
|
338
|
-
assert_includes results, host1
|
|
339
|
-
|
|
340
|
-
# Should NOT find by old insights_facet UUID in IoP mode
|
|
341
|
-
results = Host::Managed.search_for("insights_uuid = #{insights_uuid}")
|
|
342
|
-
assert_not_includes results, host1
|
|
343
|
-
end
|
|
344
|
-
end
|
|
345
|
-
|
|
346
|
-
test 'scoped search for user_omitted inventory status works' do
|
|
347
|
-
host1 = FactoryBot.create(:host, :managed)
|
|
348
|
-
host2 = FactoryBot.create(:host, :managed)
|
|
349
|
-
host3 = FactoryBot.create(:host, :managed)
|
|
350
|
-
|
|
351
|
-
# Create different inventory statuses
|
|
352
|
-
InventorySync::InventoryStatus.create!(
|
|
353
|
-
host_id: host1.id,
|
|
354
|
-
status: InventorySync::InventoryStatus::SYNC,
|
|
355
|
-
reported_at: Time.zone.now
|
|
356
|
-
)
|
|
357
|
-
|
|
358
|
-
InventorySync::InventoryStatus.create!(
|
|
359
|
-
host_id: host2.id,
|
|
360
|
-
status: InventorySync::InventoryStatus::DISCONNECT,
|
|
361
|
-
reported_at: Time.zone.now
|
|
362
|
-
)
|
|
363
|
-
|
|
364
|
-
InventorySync::InventoryStatus.create!(
|
|
365
|
-
host_id: host3.id,
|
|
366
|
-
status: InventorySync::InventoryStatus::USER_OMITTED,
|
|
367
|
-
reported_at: Time.zone.now
|
|
368
|
-
)
|
|
369
|
-
|
|
370
|
-
# Search for user_omitted status
|
|
371
|
-
results = Host.search_for('insights_inventory_sync_status = user_omitted')
|
|
372
|
-
result_ids = results.pluck(:id)
|
|
373
|
-
|
|
374
|
-
assert_includes result_ids, host3.id, 'Host with USER_OMITTED status should be in search results'
|
|
375
|
-
assert_not_includes result_ids, host1.id, 'Host with SYNC status should not be in search results'
|
|
376
|
-
assert_not_includes result_ids, host2.id, 'Host with DISCONNECT status should not be in search results'
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
test 'scoped search for user_omitted insights client report status works' do
|
|
380
|
-
host1 = FactoryBot.create(:host, :managed)
|
|
381
|
-
host2 = FactoryBot.create(:host, :managed)
|
|
382
|
-
host3 = FactoryBot.create(:host, :managed)
|
|
383
|
-
|
|
384
|
-
# Create different insights client report statuses
|
|
385
|
-
status1 = host1.get_status(InsightsClientReportStatus)
|
|
386
|
-
status1.status = InsightsClientReportStatus::REPORTING
|
|
387
|
-
status1.save!
|
|
388
|
-
|
|
389
|
-
status2 = host2.get_status(InsightsClientReportStatus)
|
|
390
|
-
status2.status = InsightsClientReportStatus::NO_REPORT
|
|
391
|
-
status2.save!
|
|
392
|
-
|
|
393
|
-
status3 = host3.get_status(InsightsClientReportStatus)
|
|
394
|
-
status3.status = InsightsClientReportStatus::USER_OMITTED
|
|
395
|
-
status3.save!
|
|
396
|
-
|
|
397
|
-
# Search for user_omitted status
|
|
398
|
-
results = Host.search_for('insights_client_report_status = user_omitted')
|
|
399
|
-
result_ids = results.pluck(:id)
|
|
400
|
-
|
|
401
|
-
assert_includes result_ids, host3.id, 'Host with USER_OMITTED status should be in search results'
|
|
402
|
-
assert_not_includes result_ids, host1.id, 'Host with REPORTING status should not be in search results'
|
|
403
|
-
assert_not_includes result_ids, host2.id, 'Host with NO_REPORT status should not be in search results'
|
|
404
|
-
end
|
|
405
191
|
end
|
|
@@ -19,7 +19,7 @@ class BranchInfoTest < ActiveSupport::TestCase
|
|
|
19
19
|
organization: env.organization
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
@host.
|
|
22
|
+
@host.organization.pools << FactoryBot.create(:katello_pool, account_number: '5678', cp_id: 1)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
test 'should generate branch info for host' do
|
|
@@ -29,7 +29,7 @@ class CloudRequestForwarderTest < ActiveSupport::TestCase
|
|
|
29
29
|
organization: env.organization
|
|
30
30
|
)
|
|
31
31
|
|
|
32
|
-
@host.
|
|
32
|
+
@host.organization.pools << FactoryBot.create(:katello_pool, account_number: '5678', cp_id: 1)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
test 'should prepare correct cloud url' do
|
|
@@ -641,6 +641,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
641
641
|
assert_tag('1', actual_host, 'int_param', 'satellite_parameter')
|
|
642
642
|
|
|
643
643
|
assert_equal false, satellite_facts['is_hostname_obfuscated']
|
|
644
|
+
assert_equal true, satellite_facts['is_simple_content_access']
|
|
644
645
|
|
|
645
646
|
version = satellite_facts['satellite_version']
|
|
646
647
|
if defined?(ForemanThemeSatellite)
|
|
@@ -702,22 +703,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
702
703
|
assert_equal 'test_sla', fact_values['system_purpose_sla']
|
|
703
704
|
end
|
|
704
705
|
|
|
705
|
-
test 'generates a report for a golden ticket' do
|
|
706
|
-
batch = Host.where(id: @host.id).in_batches.first
|
|
707
|
-
generator = create_generator(batch) do |generator|
|
|
708
|
-
generator.stubs(:golden_ticket?).returns(true)
|
|
709
|
-
end
|
|
710
|
-
|
|
711
|
-
json_str = generator.render
|
|
712
|
-
actual = JSON.parse(json_str.join("\n"))
|
|
713
|
-
|
|
714
|
-
assert_equal '00000000-0000-0000-0000-000000000000', actual['report_slice_id']
|
|
715
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
|
716
|
-
assert_equal @host.fqdn, actual_host['fqdn']
|
|
717
|
-
assert_equal '1234', actual_host['account']
|
|
718
|
-
assert_equal 1, generator.hosts_count
|
|
719
|
-
end
|
|
720
|
-
|
|
721
706
|
test 'skips hosts without subscription' do
|
|
722
707
|
a_host = FactoryBot.create(
|
|
723
708
|
:host,
|
|
@@ -1131,11 +1116,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
|
1131
1116
|
|
|
1132
1117
|
def create_generator(batch, name = '00000000-0000-0000-0000-000000000000')
|
|
1133
1118
|
generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], name)
|
|
1134
|
-
if block_given?
|
|
1135
|
-
yield(generator)
|
|
1136
|
-
else
|
|
1137
|
-
generator.stubs(:golden_ticket?).returns(false)
|
|
1138
|
-
end
|
|
1119
|
+
yield(generator) if block_given?
|
|
1139
1120
|
generator
|
|
1140
1121
|
end
|
|
1141
1122
|
|
|
@@ -10,12 +10,7 @@ const CVEsHostDetailsTab = ({ systemId }) => {
|
|
|
10
10
|
const module = './SystemDetailTable';
|
|
11
11
|
return (
|
|
12
12
|
<div className="rh-cloud-insights-vulnerability-host-details-component vulnerability">
|
|
13
|
-
<ScalprumComponent
|
|
14
|
-
key={systemId}
|
|
15
|
-
scope={scope}
|
|
16
|
-
module={module}
|
|
17
|
-
systemId={systemId}
|
|
18
|
-
/>
|
|
13
|
+
<ScalprumComponent scope={scope} module={module} systemId={systemId} />
|
|
19
14
|
</div>
|
|
20
15
|
);
|
|
21
16
|
};
|
|
@@ -11,25 +11,14 @@ jest.mock('foremanReact/Root/Context/ForemanContext', () => ({
|
|
|
11
11
|
useForemanPermissions: () => new Set(['view_vulnerability']),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
jest.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div data-testid="mock-scalprum-component">{JSON.stringify(props)}</div>
|
|
22
|
-
);
|
|
23
|
-
}),
|
|
24
|
-
ScalprumProvider: jest.fn(({ children }) => <div>{children}</div>),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
14
|
+
jest.mock('@scalprum/react-core', () => ({
|
|
15
|
+
ScalprumComponent: jest.fn(props => (
|
|
16
|
+
<div data-testid="mock-scalprum-component">{JSON.stringify(props)}</div>
|
|
17
|
+
)),
|
|
18
|
+
ScalprumProvider: jest.fn(({ children }) => <div>{children}</div>),
|
|
19
|
+
}));
|
|
27
20
|
|
|
28
21
|
describe('CVEsHostDetailsTabWrapper', () => {
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
jest.clearAllMocks();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
22
|
it('renders without crashing', () => {
|
|
34
23
|
const { container } = render(
|
|
35
24
|
<CVEsHostDetailsTabWrapper
|
|
@@ -42,32 +31,4 @@ describe('CVEsHostDetailsTabWrapper', () => {
|
|
|
42
31
|
)
|
|
43
32
|
).toBeTruthy();
|
|
44
33
|
});
|
|
45
|
-
|
|
46
|
-
it('remounts ScalprumComponent when systemId changes', () => {
|
|
47
|
-
const { ScalprumComponent } = require('@scalprum/react-core');
|
|
48
|
-
|
|
49
|
-
const { rerender } = render(
|
|
50
|
-
<CVEsHostDetailsTabWrapper
|
|
51
|
-
response={{ subscription_facet_attributes: { uuid: 'uuid-host-A' } }}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
expect(mockUnmountTracker).not.toHaveBeenCalled();
|
|
56
|
-
expect(ScalprumComponent).toHaveBeenLastCalledWith(
|
|
57
|
-
expect.objectContaining({ systemId: 'uuid-host-A' }),
|
|
58
|
-
expect.anything()
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
rerender(
|
|
62
|
-
<CVEsHostDetailsTabWrapper
|
|
63
|
-
response={{ subscription_facet_attributes: { uuid: 'uuid-host-B' } }}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
expect(mockUnmountTracker).toHaveBeenCalledTimes(1);
|
|
68
|
-
expect(ScalprumComponent).toHaveBeenLastCalledWith(
|
|
69
|
-
expect.objectContaining({ systemId: 'uuid-host-B' }),
|
|
70
|
-
expect.anything()
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
34
|
});
|
|
@@ -7,8 +7,6 @@ import { getDocsURL } from 'foremanReact/common/helpers';
|
|
|
7
7
|
import { FormattedMessage } from 'react-intl';
|
|
8
8
|
import { selectSubscriptionConnectionEnabled } from '../../../InventorySettings/InventorySettingsSelectors';
|
|
9
9
|
|
|
10
|
-
import { getSubscriptionServiceDocsUrl } from '../../../../ForemanInventoryHelpers';
|
|
11
|
-
|
|
12
10
|
export const PageDescription = () => {
|
|
13
11
|
const subscriptionConnectionEnabled = useSelector(
|
|
14
12
|
selectSubscriptionConnectionEnabled
|
|
@@ -82,7 +80,7 @@ export const PageDescription = () => {
|
|
|
82
80
|
{__('For more information about the Subscriptions service, see:')}
|
|
83
81
|
|
|
84
82
|
<a
|
|
85
|
-
href=
|
|
83
|
+
href="https://docs.redhat.com/en/documentation/subscription_central/1-latest/html/getting_started_with_the_subscriptions_service/index"
|
|
86
84
|
target="_blank"
|
|
87
85
|
rel="noopener noreferrer"
|
|
88
86
|
>
|
data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js
CHANGED
|
@@ -39,20 +39,14 @@ export const setupInventorySyncTaskPolling = (id, dispatch) =>
|
|
|
39
39
|
key: INVENTORY_SYNC_TASK_UPDATE,
|
|
40
40
|
onTaskSuccess: ({
|
|
41
41
|
output: {
|
|
42
|
-
host_statuses: { sync, disconnect
|
|
42
|
+
host_statuses: { sync, disconnect },
|
|
43
43
|
},
|
|
44
44
|
}) =>
|
|
45
45
|
dispatch(
|
|
46
46
|
addToast({
|
|
47
47
|
sticky: true,
|
|
48
48
|
type: 'success',
|
|
49
|
-
message:
|
|
50
|
-
<Toast
|
|
51
|
-
syncHosts={sync}
|
|
52
|
-
disconnectHosts={disconnect}
|
|
53
|
-
userOmittedHosts={userOmitted}
|
|
54
|
-
/>
|
|
55
|
-
),
|
|
49
|
+
message: <Toast syncHosts={sync} disconnectHosts={disconnect} />,
|
|
56
50
|
})
|
|
57
51
|
),
|
|
58
52
|
dispatch,
|
data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js
CHANGED
|
@@ -1,55 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import { translate as __ } from 'foremanReact/common/I18n';
|
|
4
|
+
import { foremanUrl } from '../../../../../../ForemanRhCloudHelpers';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const DISCONNECT = 'disconnect';
|
|
9
|
-
const SYNC = 'sync';
|
|
10
|
-
const USER_OMITTED = 'user_omitted';
|
|
11
|
-
const HostsWithStatusLink = ({ statusName, children }) => (
|
|
12
|
-
<Link to={statusSearchParams(statusName)}>{children}</Link>
|
|
13
|
-
);
|
|
14
|
-
HostsWithStatusLink.propTypes = {
|
|
15
|
-
statusName: PropTypes.string.isRequired,
|
|
16
|
-
children: PropTypes.node.isRequired,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Toast = ({ syncHosts, disconnectHosts, userOmittedHosts }) => {
|
|
20
|
-
const totalHosts = syncHosts + disconnectHosts + userOmittedHosts;
|
|
6
|
+
const Toast = ({ syncHosts, disconnectHosts }) => {
|
|
7
|
+
const totalHosts = syncHosts + disconnectHosts;
|
|
21
8
|
return (
|
|
22
9
|
<span>
|
|
23
10
|
<p>
|
|
24
|
-
{__('
|
|
25
|
-
<
|
|
26
|
-
{totalHosts}
|
|
27
|
-
</Link>
|
|
11
|
+
{__('Hosts with subscription in organization: ')}
|
|
12
|
+
<strong>{totalHosts}</strong>
|
|
28
13
|
</p>
|
|
29
14
|
<p>
|
|
30
|
-
{__('
|
|
31
|
-
<
|
|
15
|
+
{__('Successfully synced hosts: ')}
|
|
16
|
+
<strong>{syncHosts}</strong>
|
|
32
17
|
</p>
|
|
33
18
|
<p>
|
|
34
|
-
{__('
|
|
35
|
-
<
|
|
36
|
-
{disconnectHosts}
|
|
37
|
-
</HostsWithStatusLink>
|
|
19
|
+
{__('Disconnected hosts: ')}
|
|
20
|
+
<strong>{disconnectHosts}</strong>
|
|
38
21
|
</p>
|
|
39
|
-
{!!userOmittedHosts && (
|
|
40
|
-
<p>
|
|
41
|
-
{__(
|
|
42
|
-
'Excluded from upload to console.redhat.com Inventory service because host_registration_insights_inventory parameter value is false: '
|
|
43
|
-
)}
|
|
44
|
-
<HostsWithStatusLink statusName={USER_OMITTED}>
|
|
45
|
-
{userOmittedHosts}
|
|
46
|
-
</HostsWithStatusLink>
|
|
47
|
-
</p>
|
|
48
|
-
)}
|
|
49
22
|
<p>
|
|
50
|
-
{__(
|
|
51
|
-
|
|
52
|
-
|
|
23
|
+
{__('For more info, please visit the')}{' '}
|
|
24
|
+
<a
|
|
25
|
+
href={foremanUrl('/hosts')}
|
|
26
|
+
target="_blank"
|
|
27
|
+
rel="noopener noreferrer"
|
|
28
|
+
>
|
|
29
|
+
{__('hosts page')}
|
|
30
|
+
</a>
|
|
53
31
|
</p>
|
|
54
32
|
</span>
|
|
55
33
|
);
|
|
@@ -58,10 +36,6 @@ const Toast = ({ syncHosts, disconnectHosts, userOmittedHosts }) => {
|
|
|
58
36
|
Toast.propTypes = {
|
|
59
37
|
syncHosts: PropTypes.number.isRequired,
|
|
60
38
|
disconnectHosts: PropTypes.number.isRequired,
|
|
61
|
-
userOmittedHosts: PropTypes.number,
|
|
62
|
-
};
|
|
63
|
-
Toast.defaultProps = {
|
|
64
|
-
userOmittedHosts: 0,
|
|
65
39
|
};
|
|
66
40
|
|
|
67
41
|
export default Toast;
|
|
@@ -11,13 +11,6 @@ export const getInventoryDocsUrl = () =>
|
|
|
11
11
|
)}`
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
-
export const getSubscriptionServiceDocsUrl = () =>
|
|
15
|
-
foremanUrl(
|
|
16
|
-
`/links/manual/?root_url=${URI.encode(
|
|
17
|
-
'https://docs.redhat.com/en/documentation/subscription_central/1-latest/html-single/getting_started_with_the_subscriptions_service/index'
|
|
18
|
-
)}`
|
|
19
|
-
);
|
|
20
|
-
|
|
21
14
|
export const getActionsHistoryUrl = () =>
|
|
22
15
|
foremanUrl(
|
|
23
16
|
'/foreman_tasks/tasks?search=label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AHostInventoryReportJob+or+label+%3D+ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1'
|
|
@@ -33,28 +33,13 @@ const NewHostDetailsTab = ({ hostName, router }) => {
|
|
|
33
33
|
const hits = useSelector(selectHits);
|
|
34
34
|
const isIop = useIopConfig();
|
|
35
35
|
|
|
36
|
-
useEffect(
|
|
37
|
-
() => () => {
|
|
38
|
-
// Preserve hash when clearing search params to prevent tab navigation bugs
|
|
39
|
-
if (router && typeof router.replace === 'function') {
|
|
40
|
-
const replaceOptions = { search: null };
|
|
41
|
-
if (router.location && router.location.hash) {
|
|
42
|
-
replaceOptions.hash = router.location.hash;
|
|
43
|
-
}
|
|
44
|
-
router.replace(replaceOptions);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
[router]
|
|
48
|
-
);
|
|
36
|
+
useEffect(() => () => router.replace({ search: null }), [router]);
|
|
49
37
|
|
|
50
38
|
const onSearch = q => dispatch(fetchInsights({ query: q, page: 1 }));
|
|
51
39
|
|
|
52
40
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
53
|
-
const onSatInsightsClick = () =>
|
|
54
|
-
|
|
55
|
-
router.push({ pathname: '/foreman_rh_cloud/insights_cloud' });
|
|
56
|
-
}
|
|
57
|
-
};
|
|
41
|
+
const onSatInsightsClick = () =>
|
|
42
|
+
router.push({ pathname: '/foreman_rh_cloud/insights_cloud' });
|
|
58
43
|
|
|
59
44
|
const dropdownItems = [
|
|
60
45
|
<DropdownItem key="insights-link" ouiaId="insights-link">
|
|
@@ -128,32 +113,17 @@ NewHostDetailsTab.defaultProps = {
|
|
|
128
113
|
const scope = 'advisor';
|
|
129
114
|
const module = './SystemDetailWrapped';
|
|
130
115
|
|
|
131
|
-
const IopInsightsTab = props =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
IopInsightsTab.propTypes = {
|
|
149
|
-
hostName: PropTypes.string,
|
|
150
|
-
response: PropTypes.object,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
IopInsightsTab.defaultProps = {
|
|
154
|
-
hostName: '',
|
|
155
|
-
response: {},
|
|
156
|
-
};
|
|
116
|
+
const IopInsightsTab = props => (
|
|
117
|
+
<div className="advisor">
|
|
118
|
+
<ScalprumComponent
|
|
119
|
+
scope={scope}
|
|
120
|
+
module={module}
|
|
121
|
+
IopRemediationModal={RemediationModal}
|
|
122
|
+
generateRuleUrl={generateRuleUrl}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
157
127
|
|
|
158
128
|
const IopInsightsTabWrapped = props => {
|
|
159
129
|
const permissions = useInsightsPermissions();
|