foreman_rh_cloud 4.0.23 → 4.0.25.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/cloud_status_controller.rb +26 -0
  3. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +15 -7
  4. data/app/controllers/insights_cloud/hits_controller.rb +0 -1
  5. data/app/models/insights_client_report_status.rb +11 -22
  6. data/app/services/foreman_rh_cloud/cloud_auth.rb +4 -0
  7. data/app/services/foreman_rh_cloud/cloud_ping_service.rb +83 -0
  8. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -9
  9. data/app/services/foreman_rh_cloud/insights_status_cleaner.rb +17 -0
  10. data/app/services/foreman_rh_cloud/remediations_retriever.rb +5 -0
  11. data/config/Gemfile.lock.gh_test +0 -8
  12. data/config/rh_cert-api_chain.pem +74 -0
  13. data/config/routes.rb +2 -0
  14. data/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +6 -0
  15. data/lib/foreman_inventory_upload.rb +9 -1
  16. data/lib/foreman_inventory_upload/generators/queries.rb +1 -16
  17. data/lib/foreman_inventory_upload/generators/slice.rb +1 -0
  18. data/lib/foreman_inventory_upload/generators/tags.rb +3 -1
  19. data/lib/foreman_rh_cloud.rb +4 -0
  20. data/lib/foreman_rh_cloud/engine.rb +14 -12
  21. data/lib/foreman_rh_cloud/version.rb +1 -1
  22. data/lib/insights_cloud.rb +4 -0
  23. data/lib/insights_cloud/async/insights_client_status_aging.rb +23 -0
  24. data/lib/insights_cloud/async/insights_full_sync.rb +5 -0
  25. data/lib/insights_cloud/async/insights_resolutions_sync.rb +9 -0
  26. data/lib/insights_cloud/async/insights_rules_sync.rb +5 -0
  27. data/lib/inventory_sync/async/host_result.rb +4 -0
  28. data/lib/inventory_sync/async/inventory_full_sync.rb +5 -0
  29. data/lib/inventory_sync/async/inventory_hosts_sync.rb +15 -0
  30. data/lib/inventory_sync/async/inventory_self_host_sync.rb +39 -0
  31. data/lib/inventory_sync/async/query_inventory_job.rb +5 -1
  32. data/lib/tasks/insights.rake +15 -0
  33. data/lib/tasks/rh_cloud_inventory.rake +2 -9
  34. data/package.json +2 -2
  35. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +45 -0
  36. data/test/controllers/inventory_upload/cloud_status_controller_test.rb +44 -0
  37. data/test/jobs/insights_client_status_aging_test.rb +33 -0
  38. data/test/jobs/insights_full_sync_test.rb +1 -0
  39. data/test/jobs/insights_resolutions_sync_test.rb +1 -0
  40. data/test/jobs/insights_rules_sync_test.rb +1 -0
  41. data/test/jobs/inventory_full_sync_test.rb +10 -0
  42. data/test/jobs/inventory_hosts_sync_test.rb +3 -0
  43. data/test/jobs/inventory_self_host_sync_test.rb +104 -0
  44. data/test/models/insights_client_report_status_test.rb +70 -72
  45. data/test/test_plugin_helper.rb +53 -0
  46. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +6 -37
  47. data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +66 -0
  48. data/test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb +31 -0
  49. data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +1 -0
  50. data/test/unit/slice_generator_test.rb +15 -0
  51. data/test/unit/tags_generator_test.rb +41 -0
  52. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +1 -1
  53. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +1 -2
  54. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +3 -1
  55. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +2 -1
  56. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -2
  57. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -1
  58. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +0 -4
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +12 -0
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +10 -0
  61. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +144 -0
  62. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.scss +5 -0
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +2 -2
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +1 -1
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +2 -2
  66. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +4 -3
  67. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -0
  68. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +3 -1
  69. data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +5 -1
  70. data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +6 -4
  71. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +9 -5
  72. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +6 -6
  73. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +0 -14
  74. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +4 -22
  75. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +25 -4
  76. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +0 -3
  77. data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +51 -0
  78. data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +1 -1
  79. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +3 -68
  80. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +10 -0
  81. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +11 -10
  82. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +14 -0
  83. data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +0 -2
  84. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +32 -0
  85. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +5 -4
  86. data/webpack/InsightsCloudSync/InsightsCloudSync.js +17 -13
  87. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +82 -2
  88. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +15 -6
  89. data/webpack/InsightsHostDetailsTab/InsightsTab.js +3 -2
  90. data/webpack/InsightsHostDetailsTab/InsightsTab.scss +4 -4
  91. data/webpack/InsightsHostDetailsTab/components/ListItem/ListItem.js +9 -7
  92. data/webpack/common/Switcher/SwitcherPF4.js +1 -1
  93. data/webpack/common/Switcher/SwitcherPF4.scss +6 -7
  94. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -1
  95. metadata +23 -24
  96. data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +0 -9
  97. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +0 -1
  98. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +0 -45
  99. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +0 -17
  100. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +0 -38
  101. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +0 -1
  102. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +0 -3
  103. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -59
@@ -3,7 +3,7 @@
3
3
  exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
4
4
  <Switch
5
5
  aria-label=""
6
- className="foreman-switcher"
6
+ className="foreman-rh-cloud-switcher"
7
7
  id="rh-cloud-switcher-some-id"
8
8
  isChecked={true}
9
9
  isDisabled={false}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.23
4
+ version: 4.0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-30 00:00:00.000000000 Z
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: redhat_access
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: foreman_ansible
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +138,7 @@ files:
152
138
  - app/controllers/concerns/inventory_upload/report_actions.rb
153
139
  - app/controllers/concerns/inventory_upload/task_actions.rb
154
140
  - app/controllers/foreman_inventory_upload/accounts_controller.rb
141
+ - app/controllers/foreman_inventory_upload/cloud_status_controller.rb
155
142
  - app/controllers/foreman_inventory_upload/reports_controller.rb
156
143
  - app/controllers/foreman_inventory_upload/tasks_controller.rb
157
144
  - app/controllers/foreman_inventory_upload/uploads_controller.rb
@@ -176,11 +163,12 @@ files:
176
163
  - app/services/foreman_rh_cloud/branch_info.rb
177
164
  - app/services/foreman_rh_cloud/cloud_auth.rb
178
165
  - app/services/foreman_rh_cloud/cloud_connector.rb
166
+ - app/services/foreman_rh_cloud/cloud_ping_service.rb
179
167
  - app/services/foreman_rh_cloud/cloud_request.rb
180
168
  - app/services/foreman_rh_cloud/cloud_request_forwarder.rb
169
+ - app/services/foreman_rh_cloud/insights_status_cleaner.rb
181
170
  - app/services/foreman_rh_cloud/remediations_retriever.rb
182
171
  - app/services/foreman_rh_cloud/template_renderer_helper.rb
183
- - app/subscribers/foreman_rh_cloud/insights_subscriber.rb
184
172
  - app/views/hosts/_insights_tab.html.erb
185
173
  - app/views/job_templates/rh_cloud_remediations.erb
186
174
  - app/views/layouts/foreman_rh_cloud/application.html.erb
@@ -188,6 +176,7 @@ files:
188
176
  - config/database.yml.example
189
177
  - config/package-lock.json.gh_test
190
178
  - config/package-lock.json.plugin
179
+ - config/rh_cert-api_chain.pem
191
180
  - config/routes.rb
192
181
  - db/migrate/20191215104806_create_insights_hits.foreman_inventory_upload.rb
193
182
  - db/migrate/20191216062008_create_insights_facets.foreman_inventory_upload.rb
@@ -198,6 +187,7 @@ files:
198
187
  - db/migrate/20210214000002_add_rule_id_to_hits.foreman_rh_cloud.rb
199
188
  - db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
200
189
  - db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
190
+ - db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb
201
191
  - db/seeds.d/179_ui_notifications.rb
202
192
  - db/seeds.d/50_job_templates.rb
203
193
  - lib/foreman_inventory_upload.rb
@@ -221,6 +211,7 @@ files:
221
211
  - lib/foreman_rh_cloud/engine.rb
222
212
  - lib/foreman_rh_cloud/version.rb
223
213
  - lib/insights_cloud.rb
214
+ - lib/insights_cloud/async/insights_client_status_aging.rb
224
215
  - lib/insights_cloud/async/insights_full_sync.rb
225
216
  - lib/insights_cloud/async/insights_generate_notifications.rb
226
217
  - lib/insights_cloud/async/insights_resolutions_sync.rb
@@ -231,6 +222,7 @@ files:
231
222
  - lib/inventory_sync/async/inventory_full_sync.rb
232
223
  - lib/inventory_sync/async/inventory_hosts_sync.rb
233
224
  - lib/inventory_sync/async/inventory_scheduled_sync.rb
225
+ - lib/inventory_sync/async/inventory_self_host_sync.rb
234
226
  - lib/inventory_sync/async/query_inventory_job.rb
235
227
  - lib/tasks/foreman_rh_cloud_tasks.rake
236
228
  - lib/tasks/insights.rake
@@ -244,17 +236,20 @@ files:
244
236
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
245
237
  - test/controllers/insights_sync/settings_controller_test.rb
246
238
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
239
+ - test/controllers/inventory_upload/cloud_status_controller_test.rb
247
240
  - test/controllers/reports_controller_test.rb
248
241
  - test/controllers/uploads_controller_test.rb
249
242
  - test/controllers/uploads_settings_controller_test.rb
250
243
  - test/factories/insights_factories.rb
251
244
  - test/factories/inventory_upload_factories.rb
245
+ - test/jobs/insights_client_status_aging_test.rb
252
246
  - test/jobs/insights_full_sync_test.rb
253
247
  - test/jobs/insights_resolutions_sync_test.rb
254
248
  - test/jobs/insights_rules_sync_test.rb
255
249
  - test/jobs/inventory_full_sync_test.rb
256
250
  - test/jobs/inventory_hosts_sync_test.rb
257
251
  - test/jobs/inventory_scheduled_sync_test.rb
252
+ - test/jobs/inventory_self_host_sync_test.rb
258
253
  - test/jobs/upload_report_job_test.rb
259
254
  - test/models/insights_client_report_status_test.rb
260
255
  - test/test_plugin_helper.rb
@@ -265,6 +260,8 @@ files:
265
260
  - test/unit/rh_cloud_http_proxy_test.rb
266
261
  - test/unit/services/foreman_rh_cloud/branch_info_test.rb
267
262
  - test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
263
+ - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
264
+ - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
268
265
  - test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
269
266
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
270
267
  - test/unit/shell_process_job_test.rb
@@ -412,6 +409,8 @@ files:
412
409
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap
413
410
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap
414
411
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js
412
+ - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js
413
+ - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.scss
415
414
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js
416
415
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js
417
416
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap
@@ -542,18 +541,13 @@ files:
542
541
  - webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsSelectors.test.js.snap
543
542
  - webpack/InsightsCloudSync/Components/InsightsSettings/index.js
544
543
  - webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss
545
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js
546
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js
547
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js
548
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap
549
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js
550
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss
551
544
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js
552
545
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js
553
546
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js
554
547
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js
555
548
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js
556
549
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js
550
+ - webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js
557
551
  - webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
558
552
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js
559
553
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js
@@ -565,7 +559,6 @@ files:
565
559
  - webpack/InsightsCloudSync/Components/InsightsTable/index.js
566
560
  - webpack/InsightsCloudSync/Components/InsightsTable/table.scss
567
561
  - webpack/InsightsCloudSync/Components/NoTokenEmptyState.js
568
- - webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js
569
562
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationActions.js
570
563
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js
571
564
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js
@@ -574,6 +567,7 @@ files:
574
567
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js
575
568
  - webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js
576
569
  - webpack/InsightsCloudSync/Components/RemediationModal/index.js
570
+ - webpack/InsightsCloudSync/Components/ToolbarDropdown.js
577
571
  - webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js
578
572
  - webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js
579
573
  - webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap
@@ -672,17 +666,20 @@ test_files:
672
666
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
673
667
  - test/controllers/insights_sync/settings_controller_test.rb
674
668
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
669
+ - test/controllers/inventory_upload/cloud_status_controller_test.rb
675
670
  - test/controllers/reports_controller_test.rb
676
671
  - test/controllers/uploads_controller_test.rb
677
672
  - test/controllers/uploads_settings_controller_test.rb
678
673
  - test/factories/insights_factories.rb
679
674
  - test/factories/inventory_upload_factories.rb
675
+ - test/jobs/insights_client_status_aging_test.rb
680
676
  - test/jobs/insights_full_sync_test.rb
681
677
  - test/jobs/insights_resolutions_sync_test.rb
682
678
  - test/jobs/insights_rules_sync_test.rb
683
679
  - test/jobs/inventory_full_sync_test.rb
684
680
  - test/jobs/inventory_hosts_sync_test.rb
685
681
  - test/jobs/inventory_scheduled_sync_test.rb
682
+ - test/jobs/inventory_self_host_sync_test.rb
686
683
  - test/jobs/upload_report_job_test.rb
687
684
  - test/models/insights_client_report_status_test.rb
688
685
  - test/test_plugin_helper.rb
@@ -693,6 +690,8 @@ test_files:
693
690
  - test/unit/rh_cloud_http_proxy_test.rb
694
691
  - test/unit/services/foreman_rh_cloud/branch_info_test.rb
695
692
  - test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
693
+ - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
694
+ - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
696
695
  - test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
697
696
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
698
697
  - test/unit/shell_process_job_test.rb
@@ -1,9 +0,0 @@
1
- module ForemanRhCloud
2
- class InsightsSubscriber < ::Foreman::BaseSubscriber
3
- def call(*args)
4
- host = args.first.payload[:object]
5
- host_status = host.get_status(InsightsClientReportStatus)
6
- host_status.update(status: host_status.to_status)
7
- end
8
- end
9
- end
@@ -1 +0,0 @@
1
- export const handleToggleResponse = { data: { insightsSyncEnabled: true } };
@@ -1,45 +0,0 @@
1
- import React, { Component } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Switch, FieldLevelHelp } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import './insightsSyncSwitcher.scss';
6
-
7
- class InsightsSyncSwitcher extends Component {
8
- handleToggle = () => {
9
- const { insightsSyncEnabled, setInsightsSyncEnabled } = this.props;
10
-
11
- const toggledInsightsSyncEnabled = !insightsSyncEnabled;
12
- setInsightsSyncEnabled(toggledInsightsSyncEnabled);
13
- };
14
-
15
- render() {
16
- const { insightsSyncEnabled } = this.props;
17
-
18
- return (
19
- <div className="insights_sync_switcher">
20
- <span>Synchronize Automatically</span>
21
- <FieldLevelHelp
22
- content={__(
23
- 'Enable automatic synchronization of Insights recommendations from the Red Hat cloud'
24
- )}
25
- />
26
- <Switch
27
- size="mini"
28
- value={insightsSyncEnabled}
29
- onChange={this.handleToggle}
30
- />
31
- </div>
32
- );
33
- }
34
- }
35
-
36
- InsightsSyncSwitcher.propTypes = {
37
- insightsSyncEnabled: PropTypes.bool,
38
- setInsightsSyncEnabled: PropTypes.func.isRequired,
39
- };
40
-
41
- InsightsSyncSwitcher.defaultProps = {
42
- insightsSyncEnabled: true,
43
- };
44
-
45
- export default InsightsSyncSwitcher;
@@ -1,17 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
- import { noop } from 'foremanReact/common/helpers';
3
-
4
- import InsightsSyncSwitcher from '../InsightsSyncSwitcher';
5
-
6
- const fixtures = {
7
- 'render with props': {
8
- insightsSyncEnabled: true,
9
- setInsightsSyncEnabled: noop,
10
- },
11
- /** fixtures, props for the component */
12
- };
13
-
14
- describe('InsightsSyncSwitcher', () => {
15
- describe('rendering', () =>
16
- testComponentSnapshotsWithFixtures(InsightsSyncSwitcher, fixtures));
17
- });
@@ -1,38 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`InsightsSyncSwitcher rendering render with props 1`] = `
4
- <div
5
- className="insights_sync_switcher"
6
- >
7
- <span>
8
- Synchronize Automatically
9
- </span>
10
- <FieldLevelHelp
11
- buttonClass=""
12
- content="Enable automatic synchronization of Insights recommendations from the Red Hat cloud"
13
- placement="top"
14
- rootClose={true}
15
- />
16
- <Switch
17
- animate={true}
18
- baseClass="bootstrap-switch"
19
- bsSize={null}
20
- defaultValue={true}
21
- disabled={false}
22
- handleWidth="auto"
23
- inverse={false}
24
- labelText=" "
25
- labelWidth="auto"
26
- offColor="default"
27
- offText="OFF"
28
- onChange={[Function]}
29
- onColor="primary"
30
- onText="ON"
31
- readonly={false}
32
- size="mini"
33
- tristate={false}
34
- value={true}
35
- wrapperClass="wrapper"
36
- />
37
- </div>
38
- `;
@@ -1 +0,0 @@
1
- export { default } from './InsightsSyncSwitcher';
@@ -1,3 +0,0 @@
1
- .insights_sync_switcher {
2
- margin-bottom: 5px;
3
- }
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { isEmpty } from 'lodash';
4
- import { Button, Popover } from '@patternfly/react-core';
5
- import { translate as __ } from 'foremanReact/common/I18n';
6
- import { foremanUrl } from '../../../ForemanRhCloudHelpers';
7
-
8
- const RemediateButton = ({ isExperimentalMode, selectedIds, toggleModal }) => {
9
- const [isVisible, setVisible] = React.useState(true);
10
-
11
- const popoverContent = __(
12
- `To use this feature, please enable <a href=${foremanUrl(
13
- '/settings?search=name+%3D+lab_features'
14
- )}>Show Experimental Labs</a> in settings.`
15
- );
16
-
17
- let button = (
18
- <Button
19
- variant="primary"
20
- isDisabled={isEmpty(selectedIds)}
21
- onClick={() => {
22
- if (!isExperimentalMode) {
23
- setVisible(value => !value);
24
- } else {
25
- toggleModal();
26
- }
27
- }}
28
- >
29
- {__('Remediate')}
30
- </Button>
31
- );
32
-
33
- if (!isExperimentalMode) {
34
- button = (
35
- <Popover
36
- isVisible={isVisible}
37
- bodyContent={
38
- <div dangerouslySetInnerHTML={{ __html: popoverContent }} />
39
- }
40
- >
41
- {button}
42
- </Popover>
43
- );
44
- }
45
- return button;
46
- };
47
-
48
- RemediateButton.propTypes = {
49
- selectedIds: PropTypes.object,
50
- isExperimentalMode: PropTypes.bool,
51
- toggleModal: PropTypes.func.isRequired,
52
- };
53
-
54
- RemediateButton.defaultProps = {
55
- selectedIds: {},
56
- isExperimentalMode: false,
57
- };
58
-
59
- export default RemediateButton;