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
@@ -22,7 +22,13 @@ class SliceGeneratorTest < ActiveSupport::TestCase
22
22
  location: location
23
23
  )
24
24
 
25
- @host.organization.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
25
+ @host.organization.pools << FactoryBot.create(
26
+ :katello_pool,
27
+ account_number: '1234',
28
+ cp_id: 1,
29
+ organization: env.organization,
30
+ subscription: FactoryBot.create(:katello_subscription, organization_id: env.organization.id)
31
+ )
26
32
  @host.interfaces.first.identifier = 'test_nic1'
27
33
  @host.save!
28
34
 
@@ -457,9 +463,23 @@ class SliceGeneratorTest < ActiveSupport::TestCase
457
463
  end
458
464
 
459
465
  test 'reports an account for hosts with multiple pools' do
460
- first_pool = @host.organization.pools.first
461
- second_pool = FactoryBot.create(:katello_pool, account_number: nil, cp_id: 2)
462
- new_org = FactoryBot.create(:organization, pools: [first_pool, second_pool])
466
+ new_org = FactoryBot.create(:organization)
467
+ first_pool = FactoryBot.create(
468
+ :katello_pool,
469
+ account_number: '5678',
470
+ cp_id: 2,
471
+ organization: new_org,
472
+ subscription: FactoryBot.create(:katello_subscription, organization_id: new_org.id)
473
+ )
474
+ second_pool = FactoryBot.create(
475
+ :katello_pool,
476
+ account_number: '9012',
477
+ cp_id: 3,
478
+ organization: new_org,
479
+ subscription: FactoryBot.create(:katello_subscription, organization_id: new_org.id)
480
+ )
481
+ new_org.pools << first_pool
482
+ new_org.pools << second_pool
463
483
 
464
484
  another_host = FactoryBot.create(
465
485
  :host,
@@ -65,14 +65,14 @@ class TagsGeneratorTest < ActiveSupport::TestCase
65
65
  test 'generates parameter tags' do
66
66
  FactoryBot.create(:setting, :name => 'include_parameter_tags', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => true)
67
67
 
68
- @host.stubs(:host_inherited_params_objects).returns(
69
- [
70
- OpenStruct.new(name: 'bool_param', value: true),
71
- OpenStruct.new(name: 'false_param', value: false),
72
- OpenStruct.new(name: 'int_param', value: 1),
73
- OpenStruct.new(name: 'empty_param', value: nil),
74
- OpenStruct.new(name: 'empty_str_param', value: ''),
75
- ]
68
+ @host.stubs(:host_params).returns(
69
+ {
70
+ 'bool_param' => true,
71
+ 'false_param' => false,
72
+ 'int_param' => 1,
73
+ 'empty_param' => nil,
74
+ 'empty_str_param' => '',
75
+ }
76
76
  )
77
77
 
78
78
  generator = create_generator
@@ -87,14 +87,14 @@ class TagsGeneratorTest < ActiveSupport::TestCase
87
87
  test 'skips parameter tags if include_parameter_tags setting is off' do
88
88
  FactoryBot.create(:setting, :name => 'include_parameter_tags', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)
89
89
 
90
- @host.stubs(:host_inherited_params_objects).returns(
91
- [
92
- OpenStruct.new(name: 'bool_param', value: true),
93
- OpenStruct.new(name: 'false_param', value: false),
94
- OpenStruct.new(name: 'int_param', value: 1),
95
- OpenStruct.new(name: 'empty_param', value: nil),
96
- OpenStruct.new(name: 'empty_str_param', value: ''),
97
- ]
90
+ @host.stubs(:host_params).returns(
91
+ {
92
+ 'bool_param' => true,
93
+ 'false_param' => false,
94
+ 'int_param' => 1,
95
+ 'empty_param' => nil,
96
+ 'empty_str_param' => '',
97
+ }
98
98
  )
99
99
 
100
100
  generator = create_generator
@@ -1,4 +1,12 @@
1
1
  .rh-cloud-inventory-page {
2
+ #main {
3
+ padding: 0;
4
+
5
+ #breadcrumb {
6
+ display: none;
7
+ }
8
+ }
9
+
2
10
  .account-list {
3
11
  .pf-c-accordion__toggle {
4
12
  margin-top: 10px;
@@ -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
  }
@@ -1,5 +1,21 @@
1
1
  .rh-cloud-inventory-page {
2
2
  .inventory-upload-header {
3
+ margin-top: 35px;
4
+
5
+ h1 {
6
+ font-family: 'RedHatDisplay';
7
+ font-weight: 400;
8
+ margin: 0;
9
+ }
10
+
11
+ p {
12
+ font-size: 16px;
13
+ }
14
+
15
+ .pf-c-dropdown__toggle {
16
+ margin-right: -20px;
17
+ }
18
+
3
19
  .settings-alert {
4
20
  margin-bottom: 30px;
5
21
  .pf-c-alert {
@@ -18,10 +34,7 @@
18
34
 
19
35
  .inventory-upload-header-title {
20
36
  margin-top: -15px;
21
-
22
- h1 {
23
- margin: 0;
24
- }
37
+ margin-bottom: 8px;
25
38
  }
26
39
 
27
40
  .title-dropdown {
@@ -4,19 +4,26 @@ import {
4
4
  DropdownItem,
5
5
  KebabToggle,
6
6
  DropdownPosition,
7
+ Grid,
8
+ GridItem,
7
9
  } from '@patternfly/react-core';
10
+ import Head from 'foremanReact/components/Head';
8
11
  import {
9
12
  INVENTORY_PAGE_TITLE,
10
13
  ACTIONS_HISTORY_BUTTON_TEXT,
11
14
  DOCS_BUTTON_TEXT,
15
+ CLOUD_PING_TITLE,
12
16
  } from '../../ForemanInventoryConstants';
13
17
  import {
14
18
  getActionsHistoryUrl,
15
19
  getInventoryDocsUrl,
16
20
  } from '../../ForemanInventoryHelpers';
21
+ import CloudPingModal from './components/CloudPingModal';
17
22
 
18
23
  const PageTitle = () => {
19
24
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
25
+ const [showPingModal, setPingModal] = useState(false);
26
+ const togglePingModal = () => setPingModal(v => !v);
20
27
  const dropdownItems = [
21
28
  <DropdownItem
22
29
  key="tasks-history-button"
@@ -34,20 +41,37 @@ const PageTitle = () => {
34
41
  >
35
42
  {DOCS_BUTTON_TEXT}
36
43
  </DropdownItem>,
44
+ <DropdownItem key="cloud-ping" onClick={togglePingModal}>
45
+ {CLOUD_PING_TITLE}
46
+ </DropdownItem>,
37
47
  ];
38
48
  return (
39
- <div className="row form-group inventory-upload-header-title">
40
- <h1 className="col-md-8">{INVENTORY_PAGE_TITLE}</h1>
41
- <Dropdown
42
- className="title-dropdown"
43
- onSelect={() => setIsDropdownOpen(false)}
44
- toggle={<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />}
45
- isOpen={isDropdownOpen}
46
- isPlain
47
- dropdownItems={dropdownItems}
48
- position={DropdownPosition.right}
49
- />
50
- </div>
49
+ <Grid className="inventory-upload-header-title">
50
+ <GridItem span={6}>
51
+ <Head>
52
+ <title>{INVENTORY_PAGE_TITLE}</title>
53
+ </Head>
54
+ <h1>{INVENTORY_PAGE_TITLE}</h1>
55
+ </GridItem>
56
+ <GridItem span={6}>
57
+ <Dropdown
58
+ className="title-dropdown"
59
+ onSelect={() => setIsDropdownOpen(false)}
60
+ toggle={
61
+ <KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />
62
+ }
63
+ isOpen={isDropdownOpen}
64
+ isPlain
65
+ dropdownItems={dropdownItems}
66
+ position={DropdownPosition.right}
67
+ />
68
+ <CloudPingModal
69
+ isOpen={showPingModal}
70
+ toggle={togglePingModal}
71
+ title={CLOUD_PING_TITLE}
72
+ />
73
+ </GridItem>
74
+ </Grid>
51
75
  );
52
76
  };
53
77
  export default PageTitle;
@@ -1,43 +1,64 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`PageTitle rendering render without Props 1`] = `
4
- <div
5
- className="row form-group inventory-upload-header-title"
4
+ <Grid
5
+ className="inventory-upload-header-title"
6
6
  >
7
- <h1
8
- className="col-md-8"
7
+ <GridItem
8
+ span={6}
9
9
  >
10
- Red Hat Inventory
11
- </h1>
12
- <Dropdown
13
- className="title-dropdown"
14
- dropdownItems={
15
- Array [
16
- <DropdownItem
17
- href="/foreman_tasks/tasks?search=action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateReportJob+or+action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1"
18
- rel="noopener noreferrer"
19
- target="_blank"
20
- >
21
- Actions history
22
- </DropdownItem>,
23
- <DropdownItem
24
- href="/links/manual/+?root_url=https%3A%2F%2Faccess.redhat.com%2Fproducts%2Fsubscription-central"
25
- rel="noopener noreferrer"
26
- target="_blank"
27
- >
28
- Documentation
29
- </DropdownItem>,
30
- ]
31
- }
32
- isOpen={false}
33
- isPlain={true}
34
- onSelect={[Function]}
35
- position="right"
36
- toggle={
37
- <KebabToggle
38
- onToggle={[Function]}
39
- />
40
- }
41
- />
42
- </div>
10
+ <Head>
11
+ <title>
12
+ Red Hat Inventory
13
+ </title>
14
+ </Head>
15
+ <h1>
16
+ Red Hat Inventory
17
+ </h1>
18
+ </GridItem>
19
+ <GridItem
20
+ span={6}
21
+ >
22
+ <Dropdown
23
+ className="title-dropdown"
24
+ dropdownItems={
25
+ Array [
26
+ <DropdownItem
27
+ href="/foreman_tasks/tasks?search=action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateReportJob+or+action++%3D++ForemanInventoryUpload%3A%3AAsync%3A%3AGenerateAllReportsJob&page=1"
28
+ rel="noopener noreferrer"
29
+ target="_blank"
30
+ >
31
+ Actions history
32
+ </DropdownItem>,
33
+ <DropdownItem
34
+ href="/links/manual/+?root_url=https%3A%2F%2Faccess.redhat.com%2Fproducts%2Fsubscription-central"
35
+ rel="noopener noreferrer"
36
+ target="_blank"
37
+ >
38
+ Documentation
39
+ </DropdownItem>,
40
+ <DropdownItem
41
+ onClick={[Function]}
42
+ >
43
+ Connectivity test
44
+ </DropdownItem>,
45
+ ]
46
+ }
47
+ isOpen={false}
48
+ isPlain={true}
49
+ onSelect={[Function]}
50
+ position="right"
51
+ toggle={
52
+ <KebabToggle
53
+ onToggle={[Function]}
54
+ />
55
+ }
56
+ />
57
+ <CloudPingModal
58
+ isOpen={false}
59
+ title="Connectivity test"
60
+ toggle={[Function]}
61
+ />
62
+ </GridItem>
63
+ </Grid>
43
64
  `;
@@ -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
+ }
@@ -1,24 +1,26 @@
1
1
  import React from 'react';
2
+ import { Text } from '@patternfly/react-core';
3
+
2
4
  import { translate as __ } from 'foremanReact/common/I18n';
3
5
 
4
6
  export const PageDescription = () => (
5
7
  <div id="inventory_page_description">
6
- <p>
8
+ <Text>
7
9
  {__(
8
10
  'Red Hat Insights is a set of cloud services which provide unified subscription reporting, predictive analysis and remediation of issues through this Satellite instance.'
9
11
  )}
10
- </p>
11
- <p>
12
+ </Text>
13
+ <Text>
12
14
  {__(
13
15
  'You can toggle the Auto upload switch to the ON position to enable Satellite to automatically upload your host inventory once a day.'
14
16
  )}
15
- </p>
16
- <p>
17
+ </Text>
18
+ <Text>
17
19
  {__(
18
20
  'Click Restart to upload your host inventory to Red Hat Insights. Perform this step for each organization from which you want to manually upload a host inventory.'
19
21
  )}
20
- </p>
21
- <p>
22
+ </Text>
23
+ <Text>
22
24
  {__(
23
25
  'Enabling inventory uploads is required by subscription watch. For more information about subscription watch see link:'
24
26
  )}
@@ -30,8 +32,8 @@ export const PageDescription = () => (
30
32
  >
31
33
  {__('About subscription watch')}
32
34
  </a>
33
- </p>
34
- <p>
35
+ </Text>
36
+ <Text>
35
37
  {__('For more information about Insights and Cloud Connector read')}
36
38
  &nbsp;
37
39
  <a
@@ -41,7 +43,7 @@ export const PageDescription = () => (
41
43
  >
42
44
  {__('Red Hat Insights Data and Application Security')}
43
45
  </a>
44
- </p>
46
+ </Text>
45
47
  </div>
46
48
  );
47
49
 
@@ -4,16 +4,16 @@ exports[`PageDescription rendering render without Props 1`] = `
4
4
  <div
5
5
  id="inventory_page_description"
6
6
  >
7
- <p>
7
+ <Text>
8
8
  Red Hat Insights is a set of cloud services which provide unified subscription reporting, predictive analysis and remediation of issues through this Satellite instance.
9
- </p>
10
- <p>
9
+ </Text>
10
+ <Text>
11
11
  You can toggle the Auto upload switch to the ON position to enable Satellite to automatically upload your host inventory once a day.
12
- </p>
13
- <p>
12
+ </Text>
13
+ <Text>
14
14
  Click Restart to upload your host inventory to Red Hat Insights. Perform this step for each organization from which you want to manually upload a host inventory.
15
- </p>
16
- <p>
15
+ </Text>
16
+ <Text>
17
17
  Enabling inventory uploads is required by subscription watch. For more information about subscription watch see link:
18
18
   
19
19
  <a
@@ -23,8 +23,8 @@ exports[`PageDescription rendering render without Props 1`] = `
23
23
  >
24
24
  About subscription watch
25
25
  </a>
26
- </p>
27
- <p>
26
+ </Text>
27
+ <Text>
28
28
  For more information about Insights and Cloud Connector read
29
29
   
30
30
  <a
@@ -34,6 +34,6 @@ exports[`PageDescription rendering render without Props 1`] = `
34
34
  >
35
35
  Red Hat Insights Data and Application Security
36
36
  </a>
37
- </p>
37
+ </Text>
38
38
  </div>
39
39
  `;
@@ -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');
@@ -33,7 +33,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
33
33
  >
34
34
  <Popover
35
35
  bodyContent={
36
- <UNDEFINED
36
+ <Memo(Connect(AdvancedSettings))
37
37
  autoUploadEnabled={true}
38
38
  handleToggle={[Function]}
39
39
  />
@@ -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,15 +1,15 @@
1
1
  import React from 'react';
2
+ import { Text, TextVariants } from '@patternfly/react-core';
2
3
  import { translate as __ } from 'foremanReact/common/I18n';
3
- import InsightsSettings from '../InsightsSettings';
4
4
  import './InsightsHeader.scss';
5
5
 
6
6
  const InsightsHeader = () => (
7
7
  <div className="insights-header">
8
- <InsightsSettings />
9
- <p>
10
- {__(`Insights synchronization process is used to provide Insights
11
- recommendations output for hosts managed here`)}
12
- </p>
8
+ <Text component={TextVariants.p}>
9
+ {__(
10
+ 'Insights synchronization process is used to provide Insights recommendations output for hosts managed here.'
11
+ )}
12
+ </Text>
13
13
  </div>
14
14
  );
15
15
 
@@ -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
  `;