foreman_rh_cloud 4.0.29 → 5.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/inventory_upload/report_actions.rb +1 -1
  3. data/app/controllers/foreman_inventory_upload/reports_controller.rb +1 -1
  4. data/app/models/setting/rh_cloud.rb +0 -1
  5. data/app/models/task_output_line.rb +2 -0
  6. data/app/models/task_output_status.rb +2 -0
  7. data/config/package-lock.json.plugin +10551 -7500
  8. data/db/migrate/20211027000001_create_task_output.foreman_rh_cloud.rb +18 -0
  9. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +11 -7
  10. data/lib/foreman_inventory_upload/async/generate_report_job.rb +24 -12
  11. data/lib/foreman_inventory_upload/async/progress_output.rb +5 -28
  12. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +20 -5
  13. data/lib/foreman_inventory_upload/async/shell_process.rb +17 -4
  14. data/lib/foreman_inventory_upload/async/upload_report_job.rb +22 -13
  15. data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
  16. data/lib/foreman_rh_cloud/engine.rb +2 -10
  17. data/lib/foreman_rh_cloud/version.rb +1 -1
  18. data/lib/insights_cloud/async/insights_scheduled_sync.rb +11 -7
  19. data/lib/inventory_sync/async/host_result.rb +5 -0
  20. data/lib/inventory_sync/async/inventory_full_sync.rb +9 -14
  21. data/lib/inventory_sync/async/inventory_hosts_sync.rb +6 -2
  22. data/lib/tasks/rh_cloud_inventory.rake +2 -2
  23. data/package.json +7 -12
  24. data/test/jobs/inventory_full_sync_test.rb +2 -28
  25. data/test/jobs/inventory_hosts_sync_test.rb +0 -15
  26. data/test/jobs/upload_report_job_test.rb +5 -3
  27. data/test/unit/shell_process_job_test.rb +3 -1
  28. data/test/unit/slice_generator_test.rb +0 -12
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +8 -0
  30. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +17 -4
  31. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +29 -17
  32. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +58 -47
  33. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +12 -10
  34. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +10 -10
  35. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +1 -1
  36. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +4 -1
  37. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +24 -13
  38. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -1
  39. data/webpack/__mocks__/foremanReact/components/Head.js +11 -0
  40. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +1 -0
  41. metadata +6 -2
@@ -1,6 +1,8 @@
1
1
  require 'test_plugin_helper'
2
+ require 'foreman_tasks/test_helpers'
2
3
 
3
- class UploadReportJobTest < ActiveJob::TestCase
4
+ class UploadReportJobTest < ActiveSupport::TestCase
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
4
6
  include FolderIsolation
5
7
 
6
8
  test 'returns aborted state when disconnected' do
@@ -12,7 +14,7 @@ class UploadReportJobTest < ActiveJob::TestCase
12
14
  )
13
15
  FactoryBot.create(:setting, :name => 'content_disconnected', :value => true)
14
16
 
15
- ForemanInventoryUpload::Async::UploadReportJob.perform_now('', organization.id)
17
+ ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)
16
18
 
17
19
  label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
18
20
  progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
@@ -24,7 +26,7 @@ class UploadReportJobTest < ActiveJob::TestCase
24
26
  organization = FactoryBot.create(:organization)
25
27
  Organization.any_instance.expects(:owner_details).returns(nil)
26
28
 
27
- ForemanInventoryUpload::Async::UploadReportJob.perform_now('', organization.id)
29
+ ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)
28
30
 
29
31
  label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
30
32
  progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
@@ -1,4 +1,5 @@
1
1
  require 'test_plugin_helper'
2
+ require 'foreman_tasks/test_helpers'
2
3
 
3
4
  class ShellProcessJobTest < ActiveSupport::TestCase
4
5
  class TestProcessJob < ForemanInventoryUpload::Async::ShellProcess
@@ -13,11 +14,12 @@ class ShellProcessJobTest < ActiveSupport::TestCase
13
14
  end
14
15
  end
15
16
 
17
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
16
18
  include FolderIsolation
17
19
 
18
20
  test 'Runs a process with environment vars' do
19
21
  label = Foreman.uuid
20
- TestProcessJob.perform_now(label)
22
+ ForemanTasks.sync_task(TestProcessJob, label)
21
23
 
22
24
  progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
23
25
 
@@ -447,18 +447,6 @@ class SliceGeneratorTest < ActiveSupport::TestCase
447
447
  assert_equal 1, generator.hosts_count
448
448
  end
449
449
 
450
- test 'excludes hosts with host_registration_insights set to false' do
451
- @host.host_parameters << HostParameter.create(
452
- name: 'host_registration_insights',
453
- value: "false",
454
- parameter_type: 'boolean'
455
- )
456
-
457
- count = ForemanInventoryUpload::Generators::Queries.for_org(@host.organization_id).count
458
-
459
- assert_equal 0, count
460
- end
461
-
462
450
  test 'shows system_memory_bytes in bytes' do
463
451
  FactoryBot.create(:fact_value, fact_name: fact_names['memory::memtotal'], value: '1', host: @host)
464
452
 
@@ -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;
@@ -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,7 +4,10 @@ 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,
@@ -43,23 +46,32 @@ const PageTitle = () => {
43
46
  </DropdownItem>,
44
47
  ];
45
48
  return (
46
- <div className="row form-group inventory-upload-header-title">
47
- <h1 className="col-md-8">{INVENTORY_PAGE_TITLE}</h1>
48
- <Dropdown
49
- className="title-dropdown"
50
- onSelect={() => setIsDropdownOpen(false)}
51
- toggle={<KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />}
52
- isOpen={isDropdownOpen}
53
- isPlain
54
- dropdownItems={dropdownItems}
55
- position={DropdownPosition.right}
56
- />
57
- <CloudPingModal
58
- isOpen={showPingModal}
59
- toggle={togglePingModal}
60
- title={CLOUD_PING_TITLE}
61
- />
62
- </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>
63
75
  );
64
76
  };
65
77
  export default PageTitle;
@@ -1,53 +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
- <DropdownItem
31
- onClick={[Function]}
32
- >
33
- Connectivity test
34
- </DropdownItem>,
35
- ]
36
- }
37
- isOpen={false}
38
- isPlain={true}
39
- onSelect={[Function]}
40
- position="right"
41
- toggle={
42
- <KebabToggle
43
- onToggle={[Function]}
44
- />
45
- }
46
- />
47
- <CloudPingModal
48
- isOpen={false}
49
- title="Connectivity test"
50
- toggle={[Function]}
51
- />
52
- </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>
53
64
  `;
@@ -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
  `;
@@ -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
  />
@@ -60,7 +60,10 @@ exports[`InsightsTable rendering render with Props 1`] = `
60
60
  dropdownPosition="right"
61
61
  expandId="expandable-toggle"
62
62
  gridBreakPoint="grid-md"
63
+ isHeaderSelectDisabled={false}
64
+ isNested={false}
63
65
  isStickyHeader={false}
66
+ isTreeTable={false}
64
67
  onSelect={[Function]}
65
68
  onSort={[Function]}
66
69
  ouiaSafe={true}
@@ -77,7 +80,7 @@ exports[`InsightsTable rendering render with Props 1`] = `
77
80
  variant="compact"
78
81
  >
79
82
  <TableHeader />
80
- <Component />
83
+ <TableBody />
81
84
  </Table>
82
85
  <TableEmptyState
83
86
  error={null}
@@ -157,6 +157,7 @@ exports[`NoTokenEmptyState render 1`] = `
157
157
  isReadOnly={false}
158
158
  isRequired={false}
159
159
  onChange={[Function]}
160
+ ouiaSafe={true}
160
161
  type="password"
161
162
  validated="default"
162
163
  value=""
@@ -165,6 +166,9 @@ exports[`NoTokenEmptyState render 1`] = `
165
166
  aria-invalid={false}
166
167
  aria-label="input-cloud-token"
167
168
  className="pf-c-form-control"
169
+ data-ouia-component-id="OUIA-Generated-TextInputBase-1"
170
+ data-ouia-component-type="PF4/TextInput"
171
+ data-ouia-safe={true}
168
172
  disabled={false}
169
173
  onBlur={[Function]}
170
174
  onChange={[Function]}
@@ -190,21 +194,28 @@ exports[`NoTokenEmptyState render 1`] = `
190
194
  onClick={[Function]}
191
195
  variant="primary"
192
196
  >
193
- <button
194
- aria-disabled={true}
195
- aria-label={null}
196
- className="pf-c-button pf-m-primary pf-m-disabled"
197
- data-ouia-component-id="OUIA-Generated-Button-primary-1"
198
- data-ouia-component-type="PF4/Button"
199
- data-ouia-safe={true}
200
- disabled={true}
197
+ <ButtonBase
198
+ innerRef={null}
199
+ isDisabled={true}
201
200
  onClick={[Function]}
202
- role={null}
203
- tabIndex={null}
204
- type="button"
201
+ variant="primary"
205
202
  >
206
- Save setting and sync recommendations
207
- </button>
203
+ <button
204
+ aria-disabled={true}
205
+ aria-label={null}
206
+ className="pf-c-button pf-m-primary pf-m-disabled"
207
+ data-ouia-component-id="OUIA-Generated-Button-primary-1"
208
+ data-ouia-component-type="PF4/Button"
209
+ data-ouia-safe={true}
210
+ disabled={true}
211
+ onClick={[Function]}
212
+ role={null}
213
+ tabIndex={null}
214
+ type="button"
215
+ >
216
+ Save setting and sync recommendations
217
+ </button>
218
+ </ButtonBase>
208
219
  </Button>
209
220
  </div>
210
221
  </div>
@@ -32,7 +32,7 @@ exports[`InsightsCloudSync render 1`] = `
32
32
  <span
33
33
  className="insights-toolbar-buttons"
34
34
  >
35
- <UNDEFINED />
35
+ <Memo(Connect(RemediationModal)) />
36
36
  <ToolbarDropdown
37
37
  onRecommendationSync={[Function]}
38
38
  />
@@ -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;
@@ -7,6 +7,7 @@ exports[`InsightsCloudSync helpers should return insights cloud Url 1`] = `
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.29
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-11-29 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
@@ -158,6 +158,8 @@ files:
158
158
  - app/models/insights_rule.rb
159
159
  - app/models/inventory_sync/inventory_status.rb
160
160
  - app/models/setting/rh_cloud.rb
161
+ - app/models/task_output_line.rb
162
+ - app/models/task_output_status.rb
161
163
  - app/overrides/hosts_list.rb
162
164
  - app/overrides/layouts/base/styles.html.erb.deface
163
165
  - app/services/foreman_rh_cloud/branch_info.rb
@@ -188,6 +190,7 @@ files:
188
190
  - db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb
189
191
  - db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb
190
192
  - db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb
193
+ - db/migrate/20211027000001_create_task_output.foreman_rh_cloud.rb
191
194
  - db/seeds.d/179_ui_notifications.rb
192
195
  - db/seeds.d/50_job_templates.rb
193
196
  - lib/foreman_inventory_upload.rb
@@ -609,6 +612,7 @@ files:
609
612
  - webpack/__mocks__/foremanReact/common/I18n.js
610
613
  - webpack/__mocks__/foremanReact/common/MountingService.js
611
614
  - webpack/__mocks__/foremanReact/common/helpers.js
615
+ - webpack/__mocks__/foremanReact/components/Head.js
612
616
  - webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
613
617
  - webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js
614
618
  - webpack/__mocks__/foremanReact/constants.js