foreman_rh_cloud 4.0.25 → 5.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +4 -1
  3. data/app/controllers/concerns/inventory_upload/report_actions.rb +1 -1
  4. data/app/controllers/foreman_inventory_upload/cloud_status_controller.rb +26 -0
  5. data/app/controllers/foreman_inventory_upload/reports_controller.rb +1 -1
  6. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +18 -4
  7. data/app/controllers/insights_cloud/hits_controller.rb +0 -1
  8. data/app/models/setting/rh_cloud.rb +0 -1
  9. data/app/models/task_output_line.rb +2 -0
  10. data/app/models/task_output_status.rb +2 -0
  11. data/app/services/foreman_rh_cloud/cloud_ping_service.rb +83 -0
  12. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +15 -3
  13. data/config/Gemfile.lock.gh_test +169 -160
  14. data/config/database.yml.example +2 -2
  15. data/config/package-lock.json.plugin +10551 -7500
  16. data/config/rh_cert-api_chain.pem +74 -0
  17. data/config/routes.rb +3 -1
  18. data/db/migrate/20211027000001_create_task_output.foreman_rh_cloud.rb +18 -0
  19. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +11 -7
  20. data/lib/foreman_inventory_upload/async/generate_report_job.rb +24 -12
  21. data/lib/foreman_inventory_upload/async/progress_output.rb +5 -28
  22. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +20 -5
  23. data/lib/foreman_inventory_upload/async/shell_process.rb +17 -4
  24. data/lib/foreman_inventory_upload/async/upload_report_job.rb +22 -13
  25. data/lib/foreman_inventory_upload/generators/queries.rb +0 -16
  26. data/lib/foreman_inventory_upload/generators/tags.rb +1 -2
  27. data/lib/foreman_rh_cloud/engine.rb +4 -11
  28. data/lib/foreman_rh_cloud/version.rb +1 -1
  29. data/lib/foreman_rh_cloud.rb +16 -1
  30. data/lib/insights_cloud/async/insights_client_status_aging.rb +4 -0
  31. data/lib/insights_cloud/async/insights_full_sync.rb +4 -0
  32. data/lib/insights_cloud/async/insights_generate_notifications.rb +4 -0
  33. data/lib/insights_cloud/async/insights_resolutions_sync.rb +7 -2
  34. data/lib/insights_cloud/async/insights_rules_sync.rb +10 -2
  35. data/lib/insights_cloud/async/insights_scheduled_sync.rb +11 -7
  36. data/lib/insights_cloud.rb +4 -0
  37. data/lib/inventory_sync/async/inventory_full_sync.rb +4 -0
  38. data/lib/inventory_sync/async/inventory_hosts_sync.rb +4 -0
  39. data/lib/inventory_sync/async/inventory_scheduled_sync.rb +4 -0
  40. data/lib/inventory_sync/async/inventory_self_host_sync.rb +4 -0
  41. data/lib/inventory_sync/async/query_inventory_job.rb +4 -0
  42. data/lib/tasks/rh_cloud_inventory.rake +4 -11
  43. data/package.json +7 -12
  44. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +20 -39
  45. data/test/controllers/inventory_upload/cloud_status_controller_test.rb +44 -0
  46. data/test/factories/inventory_upload_factories.rb +14 -0
  47. data/test/jobs/insights_resolutions_sync_test.rb +10 -1
  48. data/test/jobs/upload_report_job_test.rb +5 -3
  49. data/test/test_plugin_helper.rb +53 -0
  50. data/test/unit/foreman_rh_cloud_self_host_test.rb +28 -0
  51. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +29 -34
  52. data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +66 -0
  53. data/test/unit/shell_process_job_test.rb +3 -1
  54. data/test/unit/slice_generator_test.rb +24 -4
  55. data/test/unit/tags_generator_test.rb +16 -16
  56. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +8 -0
  57. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +0 -4
  58. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +17 -4
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +36 -12
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +58 -37
  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 +12 -10
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +10 -10
  65. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -0
  66. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +1 -1
  67. data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +5 -1
  68. data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +6 -6
  69. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +9 -5
  70. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +6 -6
  71. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -14
  72. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +5 -24
  73. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +11 -4
  74. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +0 -3
  75. data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +51 -0
  76. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +7 -69
  77. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +10 -0
  78. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +11 -10
  79. data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +0 -2
  80. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +32 -0
  81. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +5 -5
  82. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +24 -13
  83. data/webpack/InsightsCloudSync/InsightsCloudSync.js +19 -13
  84. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +82 -2
  85. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +16 -6
  86. data/webpack/__mocks__/foremanReact/components/Head.js +11 -0
  87. data/webpack/common/Switcher/HelpLabel.js +1 -1
  88. data/webpack/common/Switcher/SwitcherPF4.js +1 -1
  89. data/webpack/common/Switcher/SwitcherPF4.scss +6 -7
  90. data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +1 -1
  91. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +2 -1
  92. metadata +20 -24
  93. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +0 -1
  94. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +0 -45
  95. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +0 -17
  96. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +0 -38
  97. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +0 -1
  98. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +0 -3
  99. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -59
@@ -0,0 +1,11 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { Helmet } from 'react-helmet';
4
+
5
+ const Head = ({ children }) => <Helmet>{children}</Helmet>;
6
+
7
+ Head.propTypes = {
8
+ children: PropTypes.node.isRequired,
9
+ };
10
+
11
+ export default Head;
@@ -11,7 +11,7 @@ export const HelpLabel = ({ text, id, className }) => {
11
11
  onClick={e => e.preventDefault()}
12
12
  className={`pf-c-form__group-label-help ${className}`}
13
13
  >
14
- <HelpIcon noVerticalAlign />
14
+ <HelpIcon />
15
15
  </button>
16
16
  </Popover>
17
17
  );
@@ -6,7 +6,7 @@ import './SwitcherPF4.scss';
6
6
 
7
7
  const SwitcherPF4 = ({ id, label, tooltip, isChecked, onChange }) => (
8
8
  <Switch
9
- className="foreman-switcher"
9
+ className="foreman-rh-cloud-switcher"
10
10
  id={`rh-cloud-switcher-${id}`}
11
11
  isChecked={isChecked}
12
12
  onChange={onChange}
@@ -1,10 +1,9 @@
1
- .rh-cloud-inventory-page {
2
- label.foreman-switcher {
3
- font-weight: 400;
4
- margin-bottom: 5px;
1
+ label.foreman-rh-cloud-switcher {
2
+ display: block;
3
+ font-weight: 400;
4
+ margin-bottom: 5px;
5
5
 
6
- .switcher-help-label {
7
- padding-left: 5px;
8
- }
6
+ .switcher-help-label {
7
+ padding-left: 5px;
9
8
  }
10
9
  }
@@ -12,7 +12,7 @@ exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
12
12
  >
13
13
  <HelpIcon
14
14
  color="currentColor"
15
- noVerticalAlign={true}
15
+ noVerticalAlign={false}
16
16
  size="sm"
17
17
  />
18
18
  </button>
@@ -3,10 +3,11 @@
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}
10
+ isReversed={false}
10
11
  label={
11
12
  <div>
12
13
  some-label
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.25
4
+ version: 5.0.28
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-08-01 00:00:00.000000000 Z
11
+ date: 2021-11-04 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
@@ -171,11 +158,14 @@ files:
171
158
  - app/models/insights_rule.rb
172
159
  - app/models/inventory_sync/inventory_status.rb
173
160
  - app/models/setting/rh_cloud.rb
161
+ - app/models/task_output_line.rb
162
+ - app/models/task_output_status.rb
174
163
  - app/overrides/hosts_list.rb
175
164
  - app/overrides/layouts/base/styles.html.erb.deface
176
165
  - app/services/foreman_rh_cloud/branch_info.rb
177
166
  - app/services/foreman_rh_cloud/cloud_auth.rb
178
167
  - app/services/foreman_rh_cloud/cloud_connector.rb
168
+ - app/services/foreman_rh_cloud/cloud_ping_service.rb
179
169
  - app/services/foreman_rh_cloud/cloud_request.rb
180
170
  - app/services/foreman_rh_cloud/cloud_request_forwarder.rb
181
171
  - app/services/foreman_rh_cloud/insights_status_cleaner.rb
@@ -188,6 +178,7 @@ files:
188
178
  - config/database.yml.example
189
179
  - config/package-lock.json.gh_test
190
180
  - config/package-lock.json.plugin
181
+ - config/rh_cert-api_chain.pem
191
182
  - config/routes.rb
192
183
  - db/migrate/20191215104806_create_insights_hits.foreman_inventory_upload.rb
193
184
  - db/migrate/20191216062008_create_insights_facets.foreman_inventory_upload.rb
@@ -199,6 +190,7 @@ files:
199
190
  - db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
200
191
  - db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
201
192
  - db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb
193
+ - db/migrate/20211027000001_create_task_output.foreman_rh_cloud.rb
202
194
  - db/seeds.d/179_ui_notifications.rb
203
195
  - db/seeds.d/50_job_templates.rb
204
196
  - lib/foreman_inventory_upload.rb
@@ -247,6 +239,7 @@ files:
247
239
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
248
240
  - test/controllers/insights_sync/settings_controller_test.rb
249
241
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
242
+ - test/controllers/inventory_upload/cloud_status_controller_test.rb
250
243
  - test/controllers/reports_controller_test.rb
251
244
  - test/controllers/uploads_controller_test.rb
252
245
  - test/controllers/uploads_settings_controller_test.rb
@@ -265,11 +258,13 @@ files:
265
258
  - test/test_plugin_helper.rb
266
259
  - test/unit/archived_report_generator_test.rb
267
260
  - test/unit/fact_helpers_test.rb
261
+ - test/unit/foreman_rh_cloud_self_host_test.rb
268
262
  - test/unit/insights_facet_test.rb
269
263
  - test/unit/metadata_generator_test.rb
270
264
  - test/unit/rh_cloud_http_proxy_test.rb
271
265
  - test/unit/services/foreman_rh_cloud/branch_info_test.rb
272
266
  - test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
267
+ - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
273
268
  - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
274
269
  - test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
275
270
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
@@ -418,6 +413,8 @@ files:
418
413
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap
419
414
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap
420
415
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js
416
+ - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js
417
+ - webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.scss
421
418
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js
422
419
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js
423
420
  - webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap
@@ -548,18 +545,13 @@ files:
548
545
  - webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsSelectors.test.js.snap
549
546
  - webpack/InsightsCloudSync/Components/InsightsSettings/index.js
550
547
  - webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss
551
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js
552
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js
553
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js
554
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap
555
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js
556
- - webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss
557
548
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js
558
549
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js
559
550
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js
560
551
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js
561
552
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js
562
553
  - webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js
554
+ - webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js
563
555
  - webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
564
556
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js
565
557
  - webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js
@@ -571,7 +563,6 @@ files:
571
563
  - webpack/InsightsCloudSync/Components/InsightsTable/index.js
572
564
  - webpack/InsightsCloudSync/Components/InsightsTable/table.scss
573
565
  - webpack/InsightsCloudSync/Components/NoTokenEmptyState.js
574
- - webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js
575
566
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationActions.js
576
567
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js
577
568
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js
@@ -580,6 +571,7 @@ files:
580
571
  - webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js
581
572
  - webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js
582
573
  - webpack/InsightsCloudSync/Components/RemediationModal/index.js
574
+ - webpack/InsightsCloudSync/Components/ToolbarDropdown.js
583
575
  - webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js
584
576
  - webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js
585
577
  - webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap
@@ -620,6 +612,7 @@ files:
620
612
  - webpack/__mocks__/foremanReact/common/I18n.js
621
613
  - webpack/__mocks__/foremanReact/common/MountingService.js
622
614
  - webpack/__mocks__/foremanReact/common/helpers.js
615
+ - webpack/__mocks__/foremanReact/components/Head.js
623
616
  - webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
624
617
  - webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js
625
618
  - webpack/__mocks__/foremanReact/constants.js
@@ -669,7 +662,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
669
662
  - !ruby/object:Gem::Version
670
663
  version: '0'
671
664
  requirements: []
672
- rubygems_version: 3.2.15
665
+ rubygems_version: 3.2.22
673
666
  signing_key:
674
667
  specification_version: 4
675
668
  summary: Summary of ForemanRhCloud.
@@ -678,6 +671,7 @@ test_files:
678
671
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
679
672
  - test/controllers/insights_sync/settings_controller_test.rb
680
673
  - test/controllers/inventory_upload/api/inventory_controller_test.rb
674
+ - test/controllers/inventory_upload/cloud_status_controller_test.rb
681
675
  - test/controllers/reports_controller_test.rb
682
676
  - test/controllers/uploads_controller_test.rb
683
677
  - test/controllers/uploads_settings_controller_test.rb
@@ -696,11 +690,13 @@ test_files:
696
690
  - test/test_plugin_helper.rb
697
691
  - test/unit/archived_report_generator_test.rb
698
692
  - test/unit/fact_helpers_test.rb
693
+ - test/unit/foreman_rh_cloud_self_host_test.rb
699
694
  - test/unit/insights_facet_test.rb
700
695
  - test/unit/metadata_generator_test.rb
701
696
  - test/unit/rh_cloud_http_proxy_test.rb
702
697
  - test/unit/services/foreman_rh_cloud/branch_info_test.rb
703
698
  - test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
699
+ - test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb
704
700
  - test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb
705
701
  - test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb
706
702
  - test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
@@ -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;