foreman_rh_cloud 4.0.25 → 4.0.25.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) 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 +10 -4
  4. data/app/controllers/insights_cloud/hits_controller.rb +0 -1
  5. data/app/services/foreman_rh_cloud/cloud_ping_service.rb +83 -0
  6. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -1
  7. data/config/Gemfile.lock.gh_test +0 -8
  8. data/config/rh_cert-api_chain.pem +74 -0
  9. data/config/routes.rb +2 -0
  10. data/lib/foreman_inventory_upload/generators/queries.rb +0 -16
  11. data/lib/foreman_rh_cloud.rb +4 -0
  12. data/lib/foreman_rh_cloud/engine.rb +0 -1
  13. data/lib/foreman_rh_cloud/version.rb +1 -1
  14. data/lib/insights_cloud.rb +4 -0
  15. data/lib/tasks/rh_cloud_inventory.rake +2 -9
  16. data/package.json +2 -2
  17. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +4 -0
  18. data/test/controllers/inventory_upload/cloud_status_controller_test.rb +44 -0
  19. data/test/test_plugin_helper.rb +53 -0
  20. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -34
  21. data/test/unit/services/foreman_rh_cloud/cloud_status_service_test.rb +66 -0
  22. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +0 -4
  23. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +12 -0
  24. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +10 -0
  25. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +144 -0
  26. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.scss +5 -0
  27. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -0
  28. data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +5 -1
  29. data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +6 -4
  30. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +9 -5
  31. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +6 -6
  32. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +0 -14
  33. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +5 -24
  34. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +11 -4
  35. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +0 -3
  36. data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +51 -0
  37. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +3 -68
  38. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +10 -0
  39. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +11 -10
  40. data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +0 -2
  41. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +32 -0
  42. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +5 -4
  43. data/webpack/InsightsCloudSync/InsightsCloudSync.js +17 -13
  44. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +82 -2
  45. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +15 -6
  46. data/webpack/common/Switcher/SwitcherPF4.js +1 -1
  47. data/webpack/common/Switcher/SwitcherPF4.scss +6 -7
  48. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -1
  49. metadata +13 -23
  50. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +0 -1
  51. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +0 -45
  52. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +0 -17
  53. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +0 -38
  54. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +0 -1
  55. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +0 -3
  56. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -59
@@ -2,41 +2,10 @@ require 'test_plugin_helper'
2
2
  require 'puma/null_io'
3
3
 
4
4
  class CloudRequestForwarderTest < ActiveSupport::TestCase
5
+ include MockCerts
6
+
5
7
  setup do
6
8
  @forwarder = ::ForemanRhCloud::CloudRequestForwarder.new
7
-
8
- @cert1 = "-----BEGIN CERTIFICATE-----\r\n" +
9
- "MIIFdDCCA1ygAwIBAgIJAM5Uqykb3EAtMA0GCSqGSIb3DQEBCwUAME8xCzAJBgNV\r\n" +
10
- "BAYTAklMMREwDwYDVQQIDAhUZWwgQXZpdjEUMBIGA1UECgwLVGhlIEZvcmVtYW4x\r\n" +
11
- "FzAVBgNVBAMMDnRoZWZvcmVtYW4ub3JnMB4XDTE4MDMyNDEyMzYyOFoXDTI4MDMy\r\n" +
12
- "MTEyMzYyOFowTzELMAkGA1UEBhMCSUwxETAPBgNVBAgMCFRlbCBBdml2MRQwEgYD\r\n" +
13
- "VQQKDAtUaGUgRm9yZW1hbjEXMBUGA1UEAwwOdGhlZm9yZW1hbi5vcmcwggIiMA0G\r\n" +
14
- "CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDF04/s4h+BgHPG1HDZ/sDlYq925pkc\r\n" +
15
- "RTVAfnE2EXDAmZ6W4Q9ueDY65MHe3ZWO5Dg72kNSP2sK9kRI7Dk5CAFOgyw1rH8t\r\n" +
16
- "Hd1+0xp/lv6e4SvSYghxIL68vFe0ftKkm1usqejBM5ZTgKr7JCI+XSIN36F65Kde\r\n" +
17
- "c+vxwBnayuhP04r9/aaE/709SXML4eRVYW8I3qFy9FPtUOm+bY8U2PIv5fHayqbG\r\n" +
18
- "cL/4t3+MCtMhHJsLzdBXya+1P5t+HcKjUNlmwoUF961YAktVuEFloGd0RMRlqF3/\r\n" +
19
- "itU3QNlXgA5QBIciE5VPr/PiqgMC3zgd5avjF4OribZ+N9AATLiQMW78il5wSfcc\r\n" +
20
- "kQjU9ChOLrzku455vQ8KE4bc0qvpCWGfUah6MvL9JB+TQkRl/8kxl0b9ZinIvJDH\r\n" +
21
- "ynVMb4cB/TDEjrjOfzn9mWLH0ZJqjmc2bER/G12WQxOaYLxdVwRStD3Yh6PtiFWu\r\n" +
22
- "sXOk19UOTVkeuvGFVtvzLfEwQ1lDEo7+VBQz8FG/HBu2Hpq3IwCFrHuicikwjQJk\r\n" +
23
- "nfturgD0rBOKEc1qWNZRCvovYOLL6ihvv5Orujsx5ZCHOAtnVNxkvIlFt2RS45LF\r\n" +
24
- "MtPJyhAc6SjitllfUEirxprsbmeSZqrIfzcGaEhgOSnyik1WMv6bYiqPfBg8Fzjh\r\n" +
25
- "vOCbtiDNPmvgOwIDAQABo1MwUTAdBgNVHQ4EFgQUtkAgQopsTtG9zSG3MgW2IxHD\r\n" +
26
- "MDwwHwYDVR0jBBgwFoAUtkAgQopsTtG9zSG3MgW2IxHDMDwwDwYDVR0TAQH/BAUw\r\n" +
27
- "AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAJq7iN+ZroRBweNhvUobxs75bLIV6tNn1\r\n" +
28
- "MdNHDRA+hezwf+gxHZhFyaAHfTpst2/9leK5Qe5Zd6gZLr3E5/8ppQuRod72H39B\r\n" +
29
- "vxMlG5zxDss0WMo3vZeKZbTY6QhXi/lY2IZ6OGV4feSvCsYxn27GTjjrRUSLFeHH\r\n" +
30
- "JVemCwCDMavaE3+OIY4v2P4FcG+MjUvfOB9ahI24TWL7YgrsNVmJjCILq+EeUj0t\r\n" +
31
- "Gde1SXVyLkqt7PoxHRJAE0BCEMJSnjxaVB329acJgeehBUxjj4CCPqtDxtbz9HEH\r\n" +
32
- "mOKfNdaKpFor+DUeEKUWVGnr9U9xOaC+Ws+oX7MIEUCDM7p2ob4JwcjnFs1jZgHh\r\n" +
33
- "Hwig+i7doTlc701PvKWO96fuNHK3B3/jTb1fVvSZ49O/RvY1VWODdUdxWmXGHNh3\r\n" +
34
- "LoR8tSPEb46lC2DXGaIQumqQt8PnBG+vL1qkQa1SGTV7dJ8TTbxbv0S+sS+igkk9\r\n" +
35
- "zsIEK8Ea3Ep935cXximz0faAAKHSA+It+xHLAyDtqy2KaAEBgGsBuuWlUfK6TaP3\r\n" +
36
- "Gwdjct3y4yYUO45lUsUfHqX8vk/4ttW5zYeDiW+HArJz+9VUXNbEdury4kGuHgBj\r\n" +
37
- "xHD4Bsul65+hHZ9QywKU26F1A6TLkYpQ2rk/Dx9LGICM4m4IlHjWJPFsQdtkyOor\r\n" +
38
- "osxMtcaZZ1E=\r\n" +
39
- "-----END CERTIFICATE-----"
40
9
  end
41
10
 
42
11
  test 'should prepare correct cloud url' do
@@ -51,7 +20,7 @@ class CloudRequestForwarderTest < ActiveSupport::TestCase
51
20
  }
52
21
 
53
22
  paths.each do |key, value|
54
- actual_params = @forwarder.path_params(key, { cert: @cert1, key: OpenSSL::PKey::RSA.new(1024).to_pem })
23
+ actual_params = @forwarder.path_params(key, generate_certs_hash)
55
24
  assert_equal value, actual_params[:url]
56
25
  end
57
26
  end
@@ -0,0 +1,66 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class CloudStatusServiceTest < ActiveSupport::TestCase
4
+ include MockCerts
5
+
6
+ setup do
7
+ end
8
+
9
+ test 'generates ping response for each org' do
10
+ organizations = FactoryBot.create_list(:organization, 2)
11
+
12
+ ForemanRhCloud::CloudPingService::TokenPing.any_instance.expects(:execute_cloud_request).returns(
13
+ RestClient::Response.new('TEST RESPONSE')
14
+ )
15
+
16
+ setup_certs_expectation do
17
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:candlepin_id_cert).with(organizations[0])
18
+ end
19
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:execute_cloud_request).returns(
20
+ RestClient::Response.new('TEST RESPONSE ORG 0')
21
+ )
22
+
23
+ setup_certs_expectation do
24
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:candlepin_id_cert).with(organizations[1])
25
+ end
26
+
27
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:execute_cloud_request).returns(
28
+ RestClient::Response.new('TEST RESPONSE ORG 1')
29
+ )
30
+
31
+ service = ForemanRhCloud::CloudPingService.new(organizations, nil)
32
+ actual = service.ping
33
+
34
+ assert actual[:token_auth][:success]
35
+ assert_nil actual[:token_auth][:error]
36
+ assert actual[:cert_auth][organizations[0]][:success]
37
+ assert_nil actual[:cert_auth][organizations[0]][:error]
38
+ assert actual[:cert_auth][organizations[1]][:success]
39
+ assert_nil actual[:cert_auth][organizations[1]][:error]
40
+ end
41
+
42
+ test 'generates ping error response for org and token' do
43
+ organizations = FactoryBot.create_list(:organization, 1)
44
+
45
+ ForemanRhCloud::CloudPingService::TokenPing.any_instance.expects(:execute_cloud_request).raises(
46
+ RuntimeError,
47
+ 'TEST RESPONSE TOKEN'
48
+ )
49
+
50
+ setup_certs_expectation do
51
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:candlepin_id_cert).with(organizations[0])
52
+ end
53
+ ForemanRhCloud::CloudPingService::CertPing.any_instance.expects(:execute_cloud_request).raises(
54
+ RuntimeError,
55
+ 'TEST RESPONSE ORG 0'
56
+ )
57
+
58
+ service = ForemanRhCloud::CloudPingService.new(organizations, nil)
59
+ actual = service.ping
60
+
61
+ refute actual[:token_auth][:success]
62
+ assert_match /TEST RESPONSE TOKEN/, actual[:token_auth][:error]
63
+ refute actual[:cert_auth][organizations[0]][:success]
64
+ assert_match /TEST RESPONSE ORG 0/, actual[:cert_auth][organizations[0]][:error]
65
+ end
66
+ end
@@ -10,9 +10,5 @@
10
10
  margin-top: 0;
11
11
  font-weight: 600;
12
12
  }
13
-
14
- .foreman-switcher {
15
- display: block;
16
- }
17
13
  }
18
14
  }
@@ -9,14 +9,18 @@ import {
9
9
  INVENTORY_PAGE_TITLE,
10
10
  ACTIONS_HISTORY_BUTTON_TEXT,
11
11
  DOCS_BUTTON_TEXT,
12
+ CLOUD_PING_TITLE,
12
13
  } from '../../ForemanInventoryConstants';
13
14
  import {
14
15
  getActionsHistoryUrl,
15
16
  getInventoryDocsUrl,
16
17
  } from '../../ForemanInventoryHelpers';
18
+ import CloudPingModal from './components/CloudPingModal';
17
19
 
18
20
  const PageTitle = () => {
19
21
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
22
+ const [showPingModal, setPingModal] = useState(false);
23
+ const togglePingModal = () => setPingModal(v => !v);
20
24
  const dropdownItems = [
21
25
  <DropdownItem
22
26
  key="tasks-history-button"
@@ -34,6 +38,9 @@ const PageTitle = () => {
34
38
  >
35
39
  {DOCS_BUTTON_TEXT}
36
40
  </DropdownItem>,
41
+ <DropdownItem key="cloud-ping" onClick={togglePingModal}>
42
+ {CLOUD_PING_TITLE}
43
+ </DropdownItem>,
37
44
  ];
38
45
  return (
39
46
  <div className="row form-group inventory-upload-header-title">
@@ -47,6 +54,11 @@ const PageTitle = () => {
47
54
  dropdownItems={dropdownItems}
48
55
  position={DropdownPosition.right}
49
56
  />
57
+ <CloudPingModal
58
+ isOpen={showPingModal}
59
+ toggle={togglePingModal}
60
+ title={CLOUD_PING_TITLE}
61
+ />
50
62
  </div>
51
63
  );
52
64
  };
@@ -27,6 +27,11 @@ exports[`PageTitle rendering render without Props 1`] = `
27
27
  >
28
28
  Documentation
29
29
  </DropdownItem>,
30
+ <DropdownItem
31
+ onClick={[Function]}
32
+ >
33
+ Connectivity test
34
+ </DropdownItem>,
30
35
  ]
31
36
  }
32
37
  isOpen={false}
@@ -39,5 +44,10 @@ exports[`PageTitle rendering render without Props 1`] = `
39
44
  />
40
45
  }
41
46
  />
47
+ <CloudPingModal
48
+ isOpen={false}
49
+ title="Connectivity test"
50
+ toggle={[Function]}
51
+ />
42
52
  </div>
43
53
  `;
@@ -0,0 +1,144 @@
1
+ /* eslint-disable camelcase */
2
+ import React, { useCallback, useEffect, useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { useDispatch, useSelector } from 'react-redux';
5
+ import { Table, TableBody, TableHeader } from '@patternfly/react-table';
6
+ import {
7
+ Card,
8
+ CardTitle,
9
+ CardBody,
10
+ Modal,
11
+ ModalVariant,
12
+ Spinner,
13
+ Text,
14
+ } from '@patternfly/react-core';
15
+ import {
16
+ CheckCircleIcon,
17
+ ExclamationCircleIcon,
18
+ } from '@patternfly/react-icons';
19
+ import { get } from 'foremanReact/redux/API';
20
+ import { translate as __, sprintf } from 'foremanReact/common/I18n';
21
+ import { STATUS } from 'foremanReact/constants';
22
+ import { selectAPIStatus } from 'foremanReact/redux/API/APISelectors';
23
+ import { inventoryUrl } from '../../../../ForemanInventoryHelpers';
24
+ import './index.scss';
25
+
26
+ export const API_KEY = 'CLOUD_PING';
27
+
28
+ const CloudPingModal = ({ title, isOpen, toggle }) => {
29
+ const [rows, setRows] = useState([]);
30
+ const [tokenStatus, setTokenStatus] = useState({});
31
+ const dispatch = useDispatch();
32
+ const handleSuccess = useCallback(
33
+ ({
34
+ data: {
35
+ ping: { cert_auth = [], token_auth = {} },
36
+ },
37
+ }) => {
38
+ cert_auth.length &&
39
+ setRows(
40
+ cert_auth.map(cert => ({
41
+ cells: [
42
+ {
43
+ title: (
44
+ <>
45
+ <StatusIcon
46
+ isPending={status === STATUS.PENDING}
47
+ authStatus={cert}
48
+ />{' '}
49
+ {cert.org_name}
50
+ </>
51
+ ),
52
+ },
53
+ ],
54
+ }))
55
+ );
56
+ setTokenStatus(token_auth);
57
+ },
58
+ [status]
59
+ );
60
+
61
+ useEffect(() => {
62
+ isOpen &&
63
+ dispatch(
64
+ get({
65
+ key: API_KEY,
66
+ url: inventoryUrl('status'),
67
+ handleSuccess,
68
+ })
69
+ );
70
+ }, [isOpen, dispatch, handleSuccess]);
71
+
72
+ const status = useSelector(state => selectAPIStatus(state, API_KEY));
73
+ const isPending = status === STATUS.PENDING;
74
+ // const error = useSelector(state => selectAPIErrorMessage(state, API_KEY));
75
+
76
+ return (
77
+ <>
78
+ <Modal
79
+ id="cloud-ping-modal"
80
+ appendTo={document.getElementsByClassName('react-container')[0]}
81
+ variant={ModalVariant.large}
82
+ title={title}
83
+ isOpen={isOpen}
84
+ onClose={toggle}
85
+ >
86
+ <Card className="token-status">
87
+ <CardTitle>
88
+ <StatusIcon isPending={isPending} authStatus={tokenStatus} />{' '}
89
+ {__('API token status')}
90
+ </CardTitle>
91
+ </Card>
92
+ <Card className="certs-status">
93
+ <CardTitle>{__('Organization status')}</CardTitle>
94
+ <CardBody>
95
+ <Text>
96
+ {__('Displays manifest statuses per accessible organizations.')}
97
+ </Text>
98
+ {isPending ? (
99
+ <Spinner size="xl" />
100
+ ) : (
101
+ <>
102
+ <Text className="pull-right">
103
+ {sprintf(__('%s organizations'), rows.length)}
104
+ </Text>
105
+ <Table aria-label="Simple Table" cells={['']} rows={rows}>
106
+ <TableHeader />
107
+ <TableBody />
108
+ </Table>{' '}
109
+ </>
110
+ )}
111
+ </CardBody>
112
+ </Card>
113
+ </Modal>
114
+ </>
115
+ );
116
+ };
117
+
118
+ const StatusIcon = ({ isPending, authStatus }) => {
119
+ if (isPending) return <Spinner size="sm" />;
120
+ if (authStatus.success) return <CheckCircleIcon color="green" />;
121
+ if (authStatus.error) return <ExclamationCircleIcon color="red" />;
122
+ return <Spinner size="sm" />;
123
+ };
124
+
125
+ StatusIcon.propTypes = {
126
+ isPending: PropTypes.bool,
127
+ authStatus: PropTypes.shape({
128
+ success: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
129
+ error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
130
+ }),
131
+ };
132
+
133
+ StatusIcon.defaultProps = {
134
+ isPending: true,
135
+ authStatus: {},
136
+ };
137
+
138
+ CloudPingModal.propTypes = {
139
+ title: PropTypes.string.isRequired,
140
+ isOpen: PropTypes.bool.isRequired,
141
+ toggle: PropTypes.func.isRequired,
142
+ };
143
+
144
+ export default CloudPingModal;
@@ -0,0 +1,5 @@
1
+ #cloud-ping-modal {
2
+ .token-status {
3
+ margin-bottom: 24px;
4
+ }
5
+ }
@@ -7,3 +7,5 @@ export const DOCS_BUTTON_TEXT = __('Documentation');
7
7
  export const ACTIONS_HISTORY_BUTTON_TEXT = __('Actions history');
8
8
 
9
9
  export const SYNC_BUTTON_TEXT = __(' Sync inventory status');
10
+
11
+ export const CLOUD_PING_TITLE = __('Connectivity test');
@@ -1,4 +1,8 @@
1
1
  .insights-header {
2
- margin-bottom: '15px';
3
2
  overflow: auto;
3
+ margin-bottom: 30px;
4
+
5
+ p {
6
+ font-size: 16px;
7
+ }
4
8
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Text, TextVariants } from '@patternfly/react-core';
2
3
  import { translate as __ } from 'foremanReact/common/I18n';
3
4
  import InsightsSettings from '../InsightsSettings';
4
5
  import './InsightsHeader.scss';
@@ -6,10 +7,11 @@ import './InsightsHeader.scss';
6
7
  const InsightsHeader = () => (
7
8
  <div className="insights-header">
8
9
  <InsightsSettings />
9
- <p>
10
- {__(`Insights synchronization process is used to provide Insights
11
- recommendations output for hosts managed here`)}
12
- </p>
10
+ <Text component={TextVariants.p}>
11
+ {__(
12
+ 'Insights synchronization process is used to provide Insights recommendations output for hosts managed here.'
13
+ )}
14
+ </Text>
13
15
  </div>
14
16
  );
15
17
 
@@ -1,7 +1,7 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { translate as __ } from 'foremanReact/common/I18n';
4
- import InsightsSyncSwitcher from '../InsightsSyncSwitcher';
4
+ import SwitcherPF4 from '../../../common/Switcher/SwitcherPF4';
5
5
  import './insightsSettings.scss';
6
6
 
7
7
  class InsightsSettings extends Component {
@@ -14,10 +14,14 @@ class InsightsSettings extends Component {
14
14
  const { insightsSyncEnabled, setInsightsSyncEnabled } = this.props;
15
15
  return (
16
16
  <div className="insights_settings">
17
- <h3>{__('Settings')}</h3>
18
- <InsightsSyncSwitcher
19
- insightsSyncEnabled={insightsSyncEnabled}
20
- setInsightsSyncEnabled={setInsightsSyncEnabled}
17
+ <SwitcherPF4
18
+ id="insights_sync_switcher"
19
+ label={__('Sync automatically')}
20
+ tooltip={__(
21
+ 'Enable automatic synchronization of Insights recommendations from the Red Hat cloud'
22
+ )}
23
+ isChecked={insightsSyncEnabled}
24
+ onChange={() => setInsightsSyncEnabled(!insightsSyncEnabled)}
21
25
  />
22
26
  </div>
23
27
  );
@@ -4,12 +4,12 @@ exports[`InsightsSettings rendering render without Props 1`] = `
4
4
  <div
5
5
  className="insights_settings"
6
6
  >
7
- <h3>
8
- Settings
9
- </h3>
10
- <InsightsSyncSwitcher
11
- insightsSyncEnabled={false}
12
- setInsightsSyncEnabled={[Function]}
7
+ <SwitcherPF4
8
+ id="insights_sync_switcher"
9
+ isChecked={false}
10
+ label="Sync automatically"
11
+ onChange={[Function]}
12
+ tooltip="Enable automatic synchronization of Insights recommendations from the Red Hat cloud"
13
13
  />
14
14
  </div>
15
15
  `;
@@ -1,17 +1,3 @@
1
1
  .insights_settings {
2
- margin-left: 10px;
3
- border: 1px solid #ededed;
4
- border-radius: 4px;
5
- padding: 10px;
6
- margin-bottom: 15px;
7
2
  float: right;
8
-
9
- h3 {
10
- margin-top: 0;
11
- font-weight: 600;
12
- }
13
-
14
- .bootstrap-switch {
15
- float: right;
16
- }
17
3
  }