foreman_rh_cloud 3.0.18 → 3.0.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (18) hide show
  1. checksums.yaml +4 -4
  2. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -0
  3. data/lib/foreman_rh_cloud/version.rb +1 -1
  4. data/package.json +1 -1
  5. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +12 -0
  6. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +2 -1
  7. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +29 -16
  8. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +1 -16
  9. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +7 -1
  10. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +1 -17
  11. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +4 -9
  12. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +0 -12
  13. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +2 -2
  14. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +1 -1
  15. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js +2 -0
  16. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +1 -1
  17. data/webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js +1 -0
  18. metadata +23 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50f4cac8e85d4aa6a6f5311e0276277ee3de729dfe29954d2fb8e907c2996e65
4
- data.tar.gz: 96a40dac10cabdcf362add97a29d841a88a16d96a9cfb2a59c10eab0a64b8b5d
3
+ metadata.gz: 72303b7bc3f1bc2deb3972acde6131cdbe4d1760381d1eb8cdaa5704e3189481
4
+ data.tar.gz: 725efab879cee6224007359547068820882319d078089760cac43a8c763df754
5
5
  SHA512:
6
- metadata.gz: 9dee0e2da14903584e433cf39e5f21c0e6e913ee54a6c579d929dee1db8163d60990502d7404285d7df8fed49f2b2910e923d47adc529dbda0c5f9aada23174b
7
- data.tar.gz: 9c468f95609d7d844ae0b0c1b8bbe697c4b43e55529a6dfc5030b74089b05c2d0fae0843e415cb98bec95dacd45c056d25b2130c8df141238059552303a62573
6
+ metadata.gz: 28d7e810476e8202a62aa7381e8d3ef86cec5f2f6a7bc9580d5a116a543275183201ad573e848f30a65253bee2f20e7b0385f0cc6f0ab90637cfb03398557188
7
+ data.tar.gz: 52560a0917aecaed1c9897c593769c19b7dde9348c1b0450cd32fb4998d5c63e4232d671a1b767e33e6dcec960b3f4647bc23d56a80f15c1f18930db8b772409
@@ -27,6 +27,7 @@ module ForemanRhCloud
27
27
  headers: {
28
28
  params: forward_params,
29
29
  user_agent: http_user_agent(original_request),
30
+ content_type: original_request.media_type,
30
31
  },
31
32
  }
32
33
  base_params.merge(path_params(original_request.path, certs))
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '3.0.18'.freeze
2
+ VERSION = '3.0.18.1'.freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "3.0.18",
3
+ "version": "3.0.18.1",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,6 +23,18 @@ module InsightsCloud::Api
23
23
  assert_equal @body, @response.body
24
24
  end
25
25
 
26
+ test "should respond with the same content type" do
27
+ net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
28
+ net_http_resp.add_field 'Set-Cookie', 'Monster'
29
+ res = RestClient::Response.create(@body, net_http_resp, @http_req)
30
+ ::ForemanRhCloud::CloudRequestForwarder.any_instance.expects(:execute_cloud_request).with do |opts|
31
+ opts[:headers][:content_type] == 'application/json'
32
+ end.returns(res)
33
+
34
+ post :forward_request, as: :json, params: { "path" => "static/v1/test", "machine_telemetry" => {"foo" => "bar"} }
35
+ assert_equal @body, @response.body
36
+ end
37
+
26
38
  test "should add headers to response from cloud" do
27
39
  x_resource_count = '101'
28
40
  x_rh_insights_request_id = '202'
@@ -1,2 +1,3 @@
1
1
  export const filterTerm = 'test_filter_term';
2
- export const organization = { title: 'some_org', id: 1 };
2
+
3
+ export const organization = 'some-org';
@@ -1,40 +1,53 @@
1
- import React from 'react';
1
+ /* eslint-disable react-hooks/exhaustive-deps */
2
+ import React, { useEffect } from 'react';
2
3
  import PropTypes from 'prop-types';
3
- import { FormGroup, FormControl } from 'patternfly-react';
4
+ import { FormGroup, TextInput } from '@patternfly/react-core';
4
5
  import { noop } from 'foremanReact/common/helpers';
5
6
  import { translate as __ } from 'foremanReact/common/I18n';
6
7
  import ClearButton from './Components/ClearButton';
7
8
  import './inventoryFilter.scss';
9
+ import { ANY_ORGANIZATION } from './InventoryFilterConstants';
8
10
 
9
11
  const InventoryFilter = ({
10
12
  handleFilterChange,
11
13
  handleFilterClear,
12
14
  filterTerm,
13
- }) => (
14
- <form id="inventory_filter_form">
15
- <FormGroup controlId="inventory_filter_input">
16
- <FormControl
17
- value={filterTerm}
18
- type="text"
19
- placeholder={__('Filter..')}
20
- bsSize="lg"
21
- onChange={e => handleFilterChange(e.target.value)}
22
- />
23
- <ClearButton onClear={handleFilterClear} />
24
- </FormGroup>
25
- </form>
26
- );
15
+ organization,
16
+ }) => {
17
+ useEffect(() => {
18
+ const initialTerm =
19
+ organization === __(ANY_ORGANIZATION) ? '' : organization;
20
+ handleFilterChange(initialTerm);
21
+ }, [organization]);
22
+
23
+ return (
24
+ <form id="inventory_filter_form">
25
+ <FormGroup>
26
+ <TextInput
27
+ id="inventory_filter_input"
28
+ value={filterTerm}
29
+ type="text"
30
+ placeholder={__('Filter..')}
31
+ onChange={handleFilterChange}
32
+ />
33
+ <ClearButton onClear={handleFilterClear} />
34
+ </FormGroup>
35
+ </form>
36
+ );
37
+ };
27
38
 
28
39
  InventoryFilter.propTypes = {
29
40
  handleFilterChange: PropTypes.func,
30
41
  handleFilterClear: PropTypes.func,
31
42
  filterTerm: PropTypes.string,
43
+ organization: PropTypes.string,
32
44
  };
33
45
 
34
46
  InventoryFilter.defaultProps = {
35
47
  handleFilterChange: noop,
36
48
  handleFilterClear: noop,
37
49
  filterTerm: '',
50
+ organization: '',
38
51
  };
39
52
 
40
53
  export default InventoryFilter;
@@ -1,13 +1,7 @@
1
1
  import Immutable from 'seamless-immutable';
2
- import {
3
- LAYOUT_CHANGE_ORG,
4
- LAYOUT_INITIALIZE,
5
- } from 'foremanReact/components/Layout/LayoutConstants';
6
- import { translate as __ } from 'foremanReact/common/I18n';
7
2
  import {
8
3
  INVENTORY_FILTER_UPDATE,
9
4
  INVENTORY_FILTER_CLEAR,
10
- ANY_ORGANIZATION,
11
5
  } from './InventoryFilterConstants';
12
6
 
13
7
  const initialState = Immutable({
@@ -16,7 +10,7 @@ const initialState = Immutable({
16
10
 
17
11
  export default (
18
12
  state = initialState,
19
- { type, payload: { filterTerm, organization } = {} }
13
+ { type, payload: { filterTerm } = {} }
20
14
  ) => {
21
15
  switch (type) {
22
16
  case INVENTORY_FILTER_UPDATE:
@@ -27,15 +21,6 @@ export default (
27
21
  return state.merge({
28
22
  filterTerm: '',
29
23
  });
30
- case LAYOUT_CHANGE_ORG:
31
- case LAYOUT_INITIALIZE: {
32
- const { title } = organization || {};
33
- // Any org is used only in it's translated form in the redux
34
- const term = title === __(ANY_ORGANIZATION) ? '' : title;
35
- return state.merge({
36
- filterTerm: term,
37
- });
38
- }
39
24
  default:
40
25
  return state;
41
26
  }
@@ -2,9 +2,15 @@ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
  import { noop } from 'foremanReact/common/helpers';
3
3
 
4
4
  import InventoryFilter from '../InventoryFilter';
5
+ import { filterTerm, organization } from '../InventoryFilter.fixtures';
5
6
 
6
7
  const fixtures = {
7
- 'render with props': { handleFilterChange: noop },
8
+ 'render with props': {
9
+ handleFilterChange: noop,
10
+ handleFilterClear: noop,
11
+ filterTerm,
12
+ organization,
13
+ },
8
14
  /** fixtures, props for the component */
9
15
  };
10
16
 
@@ -1,10 +1,6 @@
1
1
  import { testReducerSnapshotWithFixtures } from '@theforeman/test';
2
- import {
3
- LAYOUT_CHANGE_ORG,
4
- LAYOUT_INITIALIZE,
5
- } from 'foremanReact/components/Layout/LayoutConstants';
6
2
  import reducer from '../InventoryFilterReducer';
7
- import { filterTerm, organization } from '../InventoryFilter.fixtures';
3
+ import { filterTerm } from '../InventoryFilter.fixtures';
8
4
  import {
9
5
  INVENTORY_FILTER_UPDATE,
10
6
  INVENTORY_FILTER_CLEAR,
@@ -26,18 +22,6 @@ const fixtures = {
26
22
  payload: {},
27
23
  },
28
24
  },
29
- 'should handle LAYOUT_CHANGE_ORG': {
30
- action: {
31
- type: LAYOUT_CHANGE_ORG,
32
- payload: { organization },
33
- },
34
- },
35
- 'should handle LAYOUT_INITIALIZE': {
36
- action: {
37
- type: LAYOUT_INITIALIZE,
38
- payload: { organization },
39
- },
40
- },
41
25
  };
42
26
 
43
27
  describe('AccountList reducer', () =>
@@ -4,18 +4,13 @@ exports[`InventoryFilter rendering render with props 1`] = `
4
4
  <form
5
5
  id="inventory_filter_form"
6
6
  >
7
- <FormGroup
8
- bsClass="form-group"
9
- controlId="inventory_filter_input"
10
- >
11
- <FormControl
12
- bsClass="form-control"
13
- bsSize="lg"
14
- componentClass="input"
7
+ <FormGroup>
8
+ <TextInput
9
+ id="inventory_filter_input"
15
10
  onChange={[Function]}
16
11
  placeholder="Filter.."
17
12
  type="text"
18
- value=""
13
+ value="test_filter_term"
19
14
  />
20
15
  <ClearButton
21
16
  onClear={[Function]}
@@ -12,18 +12,6 @@ Object {
12
12
  }
13
13
  `;
14
14
 
15
- exports[`AccountList reducer should handle LAYOUT_CHANGE_ORG 1`] = `
16
- Object {
17
- "filterTerm": "some_org",
18
- }
19
- `;
20
-
21
- exports[`AccountList reducer should handle LAYOUT_INITIALIZE 1`] = `
22
- Object {
23
- "filterTerm": "some_org",
24
- }
25
- `;
26
-
27
15
  exports[`AccountList reducer should return the initial state 1`] = `
28
16
  Object {
29
17
  "filterTerm": "",
@@ -6,7 +6,7 @@ Object {
6
6
  Array [
7
7
  Object {
8
8
  "payload": Object {
9
- "filterTerm": "some_new_filter",
9
+ "filterTerm": "some-org",
10
10
  },
11
11
  "type": "INVENTORY_FILTER_UPDATE",
12
12
  },
@@ -35,7 +35,7 @@ Object {
35
35
  },
36
36
  "dashboard": Object {},
37
37
  "inventoryFilter": Object {
38
- "filterTerm": "some_new_filter",
38
+ "filterTerm": "some-org",
39
39
  },
40
40
  "inventorySync": Object {},
41
41
  },
@@ -7,7 +7,7 @@ describe('InventoryFilter integration test', () => {
7
7
  it('should flow', async () => {
8
8
  const integrationTestHelper = new IntegrationTestHelper(reducers);
9
9
  const wrapper = integrationTestHelper.mount(<InventoryFilter />);
10
- const input = wrapper.find('#inventory_filter_input');
10
+ const input = wrapper.find('input[id="inventory_filter_input"]');
11
11
  input.simulate('change', { target: { value: 'some_new_filter' } });
12
12
  await IntegrationTestHelper.flushAllPromises();
13
13
  wrapper.update();
@@ -1,5 +1,6 @@
1
1
  import { bindActionCreators } from 'redux';
2
2
  import { connect } from 'react-redux';
3
+ import { selectCurrentOrganization } from 'foremanReact/components/Layout/LayoutSelectors';
3
4
  import reducer from './InventoryFilterReducer';
4
5
  import * as actions from './InventoryFilterActions';
5
6
  import InventoryFilter from './InventoryFilter';
@@ -9,6 +10,7 @@ export const reducers = { inventoryFilter: reducer };
9
10
 
10
11
  const mapStateToProps = state => ({
11
12
  filterTerm: selectFilterTerm(state),
13
+ organization: selectCurrentOrganization(state),
12
14
  });
13
15
  // map action dispatchers to props
14
16
  const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
@@ -1,5 +1,5 @@
1
1
  #inventory_filter_form {
2
- .form-group {
2
+ .pf-c-form__group-control {
3
3
  display: -ms-flexbox;
4
4
  display: -webkit-flex;
5
5
  display: flex;
@@ -0,0 +1 @@
1
+ export const selectCurrentOrganization = state => 'some-org';
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: 3.0.18
4
+ version: 3.0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -58,20 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.3
62
- - - "<"
63
- - !ruby/object:Gem::Version
64
- version: 4.0.0
61
+ version: '0'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
- version: 3.0.3
72
- - - "<"
73
- - !ruby/object:Gem::Version
74
- version: 4.0.0
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: foreman_ansible_core
77
71
  requirement: !ruby/object:Gem::Requirement
@@ -589,6 +583,7 @@ files:
589
583
  - webpack/__mocks__/foremanReact/common/MountingService.js
590
584
  - webpack/__mocks__/foremanReact/common/helpers.js
591
585
  - webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
586
+ - webpack/__mocks__/foremanReact/components/Layout/LayoutSelectors.js
592
587
  - webpack/__mocks__/foremanReact/constants.js
593
588
  - webpack/__mocks__/foremanReact/redux/API/APISelectors.js
594
589
  - webpack/__mocks__/foremanReact/redux/API/index.js
@@ -615,7 +610,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
615
610
  licenses:
616
611
  - GPL-3.0
617
612
  metadata: {}
618
- post_install_message:
613
+ post_install_message:
619
614
  rdoc_options: []
620
615
  require_paths:
621
616
  - lib
@@ -630,31 +625,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
630
625
  - !ruby/object:Gem::Version
631
626
  version: '0'
632
627
  requirements: []
633
- rubygems_version: 3.2.3
634
- signing_key:
628
+ rubygems_version: 3.0.6
629
+ signing_key:
635
630
  specification_version: 4
636
631
  summary: Summary of ForemanRhCloud.
637
632
  test_files:
633
+ - test/controllers/uploads_controller_test.rb
634
+ - test/controllers/insights_sync/settings_controller_test.rb
638
635
  - test/controllers/accounts_controller_test.rb
636
+ - test/controllers/uploads_settings_controller_test.rb
639
637
  - test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb
640
- - test/controllers/insights_sync/settings_controller_test.rb
641
638
  - test/controllers/reports_controller_test.rb
642
- - test/controllers/uploads_controller_test.rb
643
- - test/controllers/uploads_settings_controller_test.rb
644
- - test/factories/insights_factories.rb
645
- - test/factories/inventory_upload_factories.rb
639
+ - test/test_plugin_helper.rb
640
+ - test/jobs/upload_report_job_test.rb
646
641
  - test/jobs/insights_full_sync_test.rb
647
642
  - test/jobs/insights_rules_sync_test.rb
648
643
  - test/jobs/inventory_full_sync_test.rb
649
- - test/jobs/upload_report_job_test.rb
650
- - test/test_plugin_helper.rb
651
- - test/unit/archived_report_generator_test.rb
652
- - test/unit/fact_helpers_test.rb
653
- - test/unit/insights_facet_test.rb
644
+ - test/factories/inventory_upload_factories.rb
645
+ - test/factories/insights_factories.rb
646
+ - test/unit/tags_generator_test.rb
647
+ - test/unit/shell_process_job_test.rb
654
648
  - test/unit/metadata_generator_test.rb
655
- - test/unit/rh_cloud_http_proxy_test.rb
656
- - test/unit/services/foreman_rh_cloud/branch_info_test.rb
649
+ - test/unit/insights_facet_test.rb
657
650
  - test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb
658
- - test/unit/shell_process_job_test.rb
651
+ - test/unit/services/foreman_rh_cloud/branch_info_test.rb
652
+ - test/unit/rh_cloud_http_proxy_test.rb
653
+ - test/unit/fact_helpers_test.rb
654
+ - test/unit/archived_report_generator_test.rb
659
655
  - test/unit/slice_generator_test.rb
660
- - test/unit/tags_generator_test.rb