foreman_rh_cloud 1.0.5 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -6
  4. data/app/controllers/foreman_rh_cloud/react_controller.rb +8 -0
  5. data/app/models/setting/rh_cloud.rb +1 -0
  6. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +1 -0
  7. data/app/views/{foreman_inventory_upload/layouts/react.html.erb → layouts/foreman_rh_cloud/application.html.erb} +2 -2
  8. data/config/routes.rb +4 -1
  9. data/lib/foreman_inventory_upload/async/async_helpers.rb +13 -0
  10. data/lib/foreman_inventory_upload/async/shell_process.rb +3 -1
  11. data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
  12. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +56 -0
  13. data/lib/foreman_inventory_upload/generators/queries.rb +6 -0
  14. data/lib/foreman_inventory_upload/generators/slice.rb +14 -9
  15. data/lib/foreman_rh_cloud/engine.rb +17 -5
  16. data/lib/foreman_rh_cloud/version.rb +1 -1
  17. data/package.json +20 -100
  18. data/test/factories/inventory_upload_factories.rb +13 -13
  19. data/test/unit/archived_report_generator_test.rb +1 -0
  20. data/test/unit/fact_helpers_test.rb +29 -0
  21. data/test/unit/slice_generator_test.rb +206 -20
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +6 -2
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +13 -10
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +3 -2
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +10 -0
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +1 -1
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -0
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js +13 -0
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap +18 -0
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +7 -0
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/index.js +1 -0
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +1 -4
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +2 -1
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +12 -0
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +2 -2
  42. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +1 -1
  43. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +8 -9
  44. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +2 -3
  45. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +2 -0
  46. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +4 -1
  47. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +1 -1
  48. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +1 -1
  49. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
  50. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
  51. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +4 -3
  52. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +1 -1
  53. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
  54. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +17 -5
  55. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +2 -2
  56. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
  57. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +4 -3
  58. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
  59. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
  60. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +26 -0
  61. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js +1 -0
  62. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +2 -0
  63. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +39 -0
  64. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterActions.js +16 -0
  65. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -0
  66. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +36 -0
  67. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterSelectors.js +7 -0
  68. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +14 -0
  69. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js +14 -0
  70. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +35 -0
  71. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js +21 -0
  72. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +25 -0
  73. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap +17 -0
  74. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +25 -0
  75. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap +9 -0
  76. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +31 -0
  77. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +18 -0
  78. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js +17 -0
  79. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -0
  80. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
  81. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
  82. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
  83. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +12 -3
  84. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +1 -1
  85. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +11 -2
  86. data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +3 -0
  87. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
  88. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
  89. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +1 -1
  90. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
  91. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
  92. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
  93. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
  94. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
  95. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
  96. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
  97. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +3 -0
  98. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +4 -0
  99. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +16 -8
  100. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +4 -4
  101. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +9 -0
  102. data/webpack/ForemanInventoryUpload/{ForemanInventoryUpload.test.js → __tests__/ForemanInventoryUpload.test.js} +2 -2
  103. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +3 -0
  104. data/webpack/ForemanInventoryUpload/{__snapshots__ → __tests__/__snapshots__}/ForemanInventoryUpload.test.js.snap +0 -0
  105. data/webpack/ForemanRhCloudHelpers.js +6 -0
  106. data/webpack/ForemanRhCloudReducers.js +8 -0
  107. data/webpack/ForemanRhCloudSelectors.js +3 -0
  108. data/webpack/ForemanRhCloudTestHelpers.js +5 -0
  109. data/webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js +1 -0
  110. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +11 -0
  111. data/webpack/__tests__/ForemanRhCloudSelectors.test.js +17 -0
  112. data/webpack/__tests__/ForemanRhCloudTestHelpers.test.js +10 -0
  113. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +3 -0
  114. data/webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap +15 -0
  115. data/webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap +11 -0
  116. data/webpack/index.js +1 -1
  117. metadata +52 -14
  118. data/app/controllers/foreman_inventory_upload/react_controller.rb +0 -7
  119. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
  120. data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
  121. data/webpack/stories/configureStore.js +0 -15
  122. data/webpack/stories/decorators/index.js +0 -1
  123. data/webpack/stories/decorators/withCardsDecorator.js +0 -14
  124. data/webpack/stories/index.js +0 -10
  125. data/webpack/stories/index.scss +0 -7
  126. data/webpack/test_setup.js +0 -6
@@ -0,0 +1,9 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`InventoryFilter selectors should return InventoryFilter 1`] = `
4
+ Object {
5
+ "filterTerm": "test_filter_term",
6
+ }
7
+ `;
8
+
9
+ exports[`InventoryFilter selectors should return filterTerm 1`] = `"test_filter_term"`;
@@ -0,0 +1,31 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`InventoryFilter integration test should flow: filter have been updated 1`] = `
4
+ Object {
5
+ "action": Array [
6
+ Array [
7
+ Object {
8
+ "payload": Object {
9
+ "filterTerm": "some_new_filter",
10
+ },
11
+ "type": "INVENTORY_FILTER_UPDATE",
12
+ },
13
+ ],
14
+ ],
15
+ "state": Object {
16
+ "ForemanRhCloud": Object {
17
+ "inventoryUpload": Object {
18
+ "accountsList": Object {
19
+ "accounts": Object {},
20
+ "error": null,
21
+ "pollingProcessID": 0,
22
+ },
23
+ "dashboard": Object {},
24
+ "inventoryFilter": Object {
25
+ "filterTerm": "some_new_filter",
26
+ },
27
+ },
28
+ },
29
+ },
30
+ }
31
+ `;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { IntegrationTestHelper } from '@theforeman/test';
3
+ import InventoryFilter from '../index';
4
+ import reducers from '../../../../ForemanRhCloudReducers';
5
+
6
+ describe('InventoryFilter integration test', () => {
7
+ it('should flow', async () => {
8
+ const integrationTestHelper = new IntegrationTestHelper(reducers);
9
+ const wrapper = integrationTestHelper.mount(<InventoryFilter />);
10
+ const input = wrapper.find('#inventory_filter_input');
11
+ input.simulate('change', { target: { value: 'some_new_filter' } });
12
+ await IntegrationTestHelper.flushAllPromises();
13
+ wrapper.update();
14
+ integrationTestHelper.takeStoreAndLastActionSnapshot(
15
+ 'filter have been updated'
16
+ );
17
+ });
18
+ });
@@ -0,0 +1,17 @@
1
+ import { bindActionCreators } from 'redux';
2
+ import { connect } from 'react-redux';
3
+ import reducer from './InventoryFilterReducer';
4
+ import * as actions from './InventoryFilterActions';
5
+ import InventoryFilter from './InventoryFilter';
6
+ import { selectFilterTerm } from './InventoryFilterSelectors';
7
+
8
+ export const reducers = { inventoryFilter: reducer };
9
+
10
+ const mapStateToProps = state => ({
11
+ filterTerm: selectFilterTerm(state),
12
+ });
13
+ // map action dispatchers to props
14
+ const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
15
+
16
+ // export connected component
17
+ export default connect(mapStateToProps, mapDispatchToProps)(InventoryFilter);
@@ -0,0 +1,28 @@
1
+ #inventory_filter_form {
2
+ .form-group {
3
+ display: -ms-flexbox;
4
+ display: -webkit-flex;
5
+ display: flex;
6
+ -webkit-flex-direction: row;
7
+ -ms-flex-direction: row;
8
+ flex-direction: row;
9
+ -webkit-flex-wrap: nowrap;
10
+ -ms-flex-wrap: nowrap;
11
+ flex-wrap: nowrap;
12
+ -webkit-justify-content: flex-end;
13
+ -ms-flex-pack: end;
14
+ justify-content: flex-end;
15
+ -webkit-align-content: center;
16
+ -ms-flex-line-pack: center;
17
+ align-content: center;
18
+ -webkit-align-items: center;
19
+ -ms-flex-align: center;
20
+ align-items: center;
21
+ margin-bottom: 0;
22
+
23
+ .inventory-clear-button {
24
+ position: absolute;
25
+ right: 27px;
26
+ }
27
+ }
28
+ }
@@ -1,10 +1,13 @@
1
+ import React from 'react';
2
+ import { noop } from 'patternfly-react';
3
+
1
4
  export const props = {
2
5
  items: [
3
6
  {
4
7
  icon: 'some-icon',
5
8
  name: 'some-name',
6
- component: jest.fn,
7
- onClick: jest.fn,
9
+ component: () => <p>test</p>,
10
+ onClick: noop,
8
11
  },
9
12
  ],
10
13
  };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
3
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+ import { mount, testComponentSnapshotsWithFixtures } from '@theforeman/test';
4
3
  import NavContainer from '../NavContainer';
5
4
  import { props } from '../NavContainer.fixtures';
6
5
 
@@ -45,7 +45,7 @@ exports[`NavContainer rendering render with Props 1`] = `
45
45
  eventKey={0}
46
46
  key="0"
47
47
  >
48
- <bound fn />
48
+ <component />
49
49
  </TabPane>
50
50
  </TabContent>
51
51
  <FullScreenModal
@@ -1,21 +1,30 @@
1
1
  import React from 'react';
2
2
  import { Grid } from 'patternfly-react';
3
- import { translate as __ } from 'foremanReact/common/I18n';
4
3
  import AutoUploadSwitcher from '../AutoUploadSwitcher';
4
+ import InventoryFilter from '../InventoryFilter';
5
+ import { INVENTORY_PAGE_TITLE } from '../../ForemanInventoryConstants';
6
+ import './pageHeader.scss';
5
7
 
6
8
  const PageHeader = () => (
7
9
  <React.Fragment>
8
10
  <Grid.Row>
9
11
  <Grid.Col xs={12}>
10
- <h1>{__('Red Hat Inventory Uploads')}</h1>
12
+ <h1 className="inventory_title">{INVENTORY_PAGE_TITLE}</h1>
11
13
  </Grid.Col>
12
14
  </Grid.Row>
13
15
  <Grid.Row>
14
- <Grid.Col xs={4} xsOffset={8}>
16
+ <Grid.Col xs={3}>
17
+ <InventoryFilter />
18
+ </Grid.Col>
19
+ <Grid.Col xs={4} xsOffset={5}>
15
20
  <AutoUploadSwitcher />
16
21
  </Grid.Col>
17
22
  </Grid.Row>
18
23
  </React.Fragment>
19
24
  );
20
25
 
26
+ PageHeader.propTypes = {};
27
+
28
+ PageHeader.defaultProps = {};
29
+
21
30
  export default PageHeader;
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import PageHeader from '../PageHeader';
4
4
 
@@ -11,7 +11,9 @@ exports[`PageHeader rendering render without Props 1`] = `
11
11
  componentClass="div"
12
12
  xs={12}
13
13
  >
14
- <h1>
14
+ <h1
15
+ className="inventory_title"
16
+ >
15
17
  Red Hat Inventory Uploads
16
18
  </h1>
17
19
  </Col>
@@ -20,11 +22,18 @@ exports[`PageHeader rendering render without Props 1`] = `
20
22
  bsClass="row"
21
23
  componentClass="div"
22
24
  >
25
+ <Col
26
+ bsClass="col"
27
+ componentClass="div"
28
+ xs={3}
29
+ >
30
+ <Connect(InventoryFilter) />
31
+ </Col>
23
32
  <Col
24
33
  bsClass="col"
25
34
  componentClass="div"
26
35
  xs={4}
27
- xsOffset={8}
36
+ xsOffset={5}
28
37
  >
29
38
  <Connect(AutoUploadSwitcher) />
30
39
  </Col>
@@ -0,0 +1,3 @@
1
+ .inventory_title {
2
+ margin-bottom: 30px;
3
+ }
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ReportGenerate from '../ReportGenerate';
4
4
  import { props } from '../ReportGenerate.fixtures';
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ReportUpload from '../ReportUpload';
4
4
  import { props } from '../ReportUpload.fixtures';
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ScheduledRun from '../ScheduledRun';
4
4
  import { props } from '../ScheduledRun.fixtures';
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import StatusChart from '../StatusChart';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TabBody from '../TabBody';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TabContainer from '../TabContainer';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TabFooter from '../TabFooter';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import TabHeader from '../TabHeader';
4
4
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Grid, Spinner } from 'patternfly-react';
4
- import isEqual from 'lodash/isEqual';
4
+ import { isEqual } from 'lodash';
5
5
  import './terminal.scss';
6
6
  import { isTerminalScrolledDown } from './TerminalHelper';
7
7
 
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
3
- import { mount } from 'enzyme';
2
+ import { mount, testComponentSnapshotsWithFixtures } from '@theforeman/test';
4
3
  import Terminal from '../Terminal';
5
4
  import { props, logs } from '../Terminal.fixtures';
6
5
 
@@ -0,0 +1,3 @@
1
+ import { translate as __ } from 'foremanReact/common/I18n';
2
+
3
+ export const INVENTORY_PAGE_TITLE = __('Red Hat Inventory Uploads');
@@ -0,0 +1,4 @@
1
+ import { foremanUrl } from '../ForemanRhCloudHelpers';
2
+
3
+ export const inventoryUrl = path =>
4
+ foremanUrl(`/foreman_inventory_upload/${path}`);
@@ -3,14 +3,22 @@ import { IntlProvider } from 'react-intl';
3
3
  import { Grid } from 'patternfly-react';
4
4
  import AccountList from './Components/AccountList';
5
5
  import PageHeader from './Components/PageHeader';
6
+ import { INVENTORY_PAGE_TITLE } from './ForemanInventoryConstants';
6
7
 
7
- const ForemanInventoryUpload = () => (
8
- <IntlProvider locale={navigator.language}>
9
- <Grid fluid className="inventory-upload">
10
- <PageHeader />
11
- <AccountList />
12
- </Grid>
13
- </IntlProvider>
14
- );
8
+ const ForemanInventoryUpload = () => {
9
+ document.title = INVENTORY_PAGE_TITLE;
10
+ return (
11
+ <IntlProvider locale={navigator.language}>
12
+ <Grid fluid className="inventory-upload">
13
+ <PageHeader />
14
+ <AccountList />
15
+ </Grid>
16
+ </IntlProvider>
17
+ );
18
+ };
19
+
20
+ ForemanInventoryUpload.propTypes = {};
21
+
22
+ ForemanInventoryUpload.defaultProps = {};
15
23
 
16
24
  export default ForemanInventoryUpload;
@@ -1,12 +1,12 @@
1
1
  import { combineReducers } from 'redux';
2
2
  import { reducers as accountListReducers } from './Components/AccountList';
3
3
  import { reducers as dashboardReducers } from './Components/Dashboard';
4
+ import { reducers as filterReducers } from './Components/InventoryFilter';
4
5
 
5
- const reducers = {
6
- ForemanInventoryUpload: combineReducers({
6
+ export default {
7
+ inventoryUpload: combineReducers({
7
8
  ...accountListReducers,
8
9
  ...dashboardReducers,
10
+ ...filterReducers,
9
11
  }),
10
12
  };
11
-
12
- export default reducers;
@@ -0,0 +1,9 @@
1
+ import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
2
+ import { inventoryUrl } from '../ForemanInventoryHelpers';
3
+
4
+ const fixtures = {
5
+ 'should return inventory Url': () => inventoryUrl('test_path'),
6
+ };
7
+
8
+ describe('ForemanInventoryUpload helpers', () =>
9
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -1,6 +1,6 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
- import ForemanInventoryUpload from './ForemanInventoryUpload';
3
+ import ForemanInventoryUpload from '../../ForemanInventoryUpload';
4
4
 
5
5
  const fixtures = {
6
6
  'render without Props': {},
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanInventoryUpload helpers should return inventory Url 1`] = `"/foreman_inventory_upload/test_path"`;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * copied from core, since it's not in the ReactApp folder,
3
+ * it's complicated to import it and mock it in tests.
4
+ * should be imported once core moves it to the ReactApp folder.
5
+ */
6
+ export const foremanUrl = path => `${window.URL_PREFIX}${path}`;
@@ -0,0 +1,8 @@
1
+ import { combineReducers } from 'redux';
2
+ import inventoryUploadReducers from './ForemanInventoryUpload/ForemanInventoryUploadReducers';
3
+
4
+ export default {
5
+ ForemanRhCloud: combineReducers({
6
+ ...inventoryUploadReducers,
7
+ }),
8
+ };
@@ -0,0 +1,3 @@
1
+ export const selectForemanRhCloud = state => state.ForemanRhCloud;
2
+ export const selectForemanInventoryUpload = state =>
3
+ selectForemanRhCloud(state).inventoryUpload;
@@ -0,0 +1,5 @@
1
+ export const inventoryStateWrapper = innerState => ({
2
+ ForemanRhCloud: {
3
+ inventoryUpload: { ...innerState },
4
+ },
5
+ });
@@ -0,0 +1 @@
1
+ export const LAYOUT_CHANGE_ORG = 'LAYOUT_CHANGE_ORG';
@@ -0,0 +1,11 @@
1
+ import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
2
+ import { foremanUrl } from '../ForemanRhCloudHelpers';
3
+
4
+ global.URL_PREFIX = 'MY_TEST_URL_PREFIX.example.com';
5
+
6
+ const fixtures = {
7
+ 'should return foreman Url': () => foremanUrl('/test_path'),
8
+ };
9
+
10
+ describe('ForemanRhCloud helpers', () =>
11
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,17 @@
1
+ import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
2
+ import { inventoryStateWrapper } from '../ForemanRhCloudTestHelpers';
3
+ import {
4
+ selectForemanRhCloud,
5
+ selectForemanInventoryUpload,
6
+ } from '../ForemanRhCloudSelectors';
7
+
8
+ const state = inventoryStateWrapper({ inventoryReducersNamespaces: {} });
9
+
10
+ const fixtures = {
11
+ 'should return ForemanRhCloud': () => selectForemanRhCloud(state),
12
+ 'should return ForemanInventoryUpload': () =>
13
+ selectForemanInventoryUpload(state),
14
+ };
15
+
16
+ describe('ForemanRhCloud selectors', () =>
17
+ testSelectorsSnapshotWithFixtures(fixtures));