foreman_inventory_upload 1.0.0.beta7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +39 -0
  3. data/app/controllers/foreman_inventory_upload/reports_controller.rb +3 -4
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +3 -3
  5. data/app/views/scripts/uploader.sh.erb +21 -9
  6. data/config/routes.rb +5 -5
  7. data/lib/foreman_inventory_upload.rb +14 -10
  8. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +4 -7
  9. data/lib/foreman_inventory_upload/async/generate_report_job.rb +13 -9
  10. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +7 -7
  11. data/lib/foreman_inventory_upload/async/upload_report_job.rb +22 -17
  12. data/lib/foreman_inventory_upload/generators/archived_report.rb +2 -2
  13. data/lib/foreman_inventory_upload/generators/queries.rb +18 -9
  14. data/lib/foreman_inventory_upload/generators/slice.rb +16 -9
  15. data/lib/foreman_inventory_upload/version.rb +1 -1
  16. data/lib/tasks/generator.rake +19 -5
  17. data/test/controllers/{statuses_controller_test.rb → accounts_controller_test.rb} +6 -7
  18. data/test/controllers/reports_controller_test.rb +3 -3
  19. data/test/controllers/uploads_controller_test.rb +3 -3
  20. data/test/unit/archived_report_generator_test.rb +3 -3
  21. data/test/unit/slice_generator_test.rb +22 -0
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +5 -2
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +11 -9
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +3 -3
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +7 -7
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +1 -1
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +1 -1
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +9 -7
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +6 -4
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +2 -1
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +5 -5
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +2 -2
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +4 -4
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +15 -12
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +13 -10
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +9 -3
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +3 -6
  38. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +5 -5
  39. data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +1 -4
  40. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +4 -4
  41. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +4 -1
  42. metadata +7 -7
  43. data/app/controllers/foreman_inventory_upload/statuses_controller.rb +0 -41
@@ -9,7 +9,7 @@ import {
9
9
  } from '../AccountListConstants';
10
10
  import reducer from '../AccountListReducer';
11
11
  import {
12
- statuses,
12
+ accounts,
13
13
  error,
14
14
  pollingProcessID,
15
15
  accountID,
@@ -22,7 +22,7 @@ const fixtures = {
22
22
  action: {
23
23
  type: INVENTORY_ACCOUNT_STATUS_POLLING,
24
24
  payload: {
25
- statuses,
25
+ accounts,
26
26
  },
27
27
  },
28
28
  },
@@ -1,15 +1,15 @@
1
1
  import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
2
  import {
3
3
  selectAccountsList,
4
- selectStatuses,
4
+ selectAccounts,
5
5
  selectPollingProcessID,
6
6
  } from '../AccountListSelectors';
7
- import { pollingProcessID, statuses } from '../AccountList.fixtures';
7
+ import { pollingProcessID, accounts } from '../AccountList.fixtures';
8
8
 
9
9
  const state = {
10
10
  ForemanInventoryUpload: {
11
11
  accountsList: {
12
- statuses,
12
+ accounts,
13
13
  pollingProcessID,
14
14
  },
15
15
  },
@@ -17,7 +17,7 @@ const state = {
17
17
 
18
18
  const fixtures = {
19
19
  'should return AccountsList': () => selectAccountsList(state),
20
- 'should return AccountList statuses': () => selectStatuses(state),
20
+ 'should return AccountList accounts': () => selectAccounts(state),
21
21
  'should return AccountList pollingProcessID': () =>
22
22
  selectPollingProcessID(state),
23
23
  };
@@ -5,37 +5,40 @@ exports[`AccountList rendering render with props 1`] = `
5
5
  className="account_list"
6
6
  >
7
7
  <ListItem
8
- initExpanded={true}
9
- key="0"
10
- name="Account1"
11
- statuses={
8
+ account={
12
9
  Object {
13
10
  "generate_report_status": "running",
11
+ "label": "test_org1",
14
12
  "upload_report_status": "running",
15
13
  }
16
14
  }
15
+ accountID="Account1"
16
+ initExpanded={true}
17
+ key="0"
17
18
  />
18
19
  <ListItem
19
- initExpanded={false}
20
- key="1"
21
- name="Account2"
22
- statuses={
20
+ account={
23
21
  Object {
24
22
  "generate_report_status": "failure",
23
+ "label": "test_org2",
25
24
  "upload_report_status": "unknown",
26
25
  }
27
26
  }
27
+ accountID="Account2"
28
+ initExpanded={false}
29
+ key="1"
28
30
  />
29
31
  <ListItem
30
- initExpanded={false}
31
- key="2"
32
- name="Account3"
33
- statuses={
32
+ account={
34
33
  Object {
35
34
  "generate_report_status": "running",
35
+ "label": "test_org3",
36
36
  "upload_report_status": "success",
37
37
  }
38
38
  }
39
+ accountID="Account3"
40
+ initExpanded={false}
41
+ key="2"
39
42
  />
40
43
  </ListView>
41
44
  `;
@@ -2,65 +2,68 @@
2
2
 
3
3
  exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
4
4
  Object {
5
- "error": null,
6
- "pollingProcessID": 0,
7
- "statuses": Object {
5
+ "accounts": Object {
8
6
  "Account1": Object {
9
7
  "generate_report_status": "running",
8
+ "label": "test_org1",
10
9
  "upload_report_status": "running",
11
10
  },
12
11
  "Account2": Object {
13
12
  "generate_report_status": "failure",
13
+ "label": "test_org2",
14
14
  "upload_report_status": "unknown",
15
15
  },
16
16
  "Account3": Object {
17
17
  "generate_report_status": "running",
18
+ "label": "test_org3",
18
19
  "upload_report_status": "success",
19
20
  },
20
21
  },
22
+ "error": null,
23
+ "pollingProcessID": 0,
21
24
  }
22
25
  `;
23
26
 
24
27
  exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_ERROR 1`] = `
25
28
  Object {
29
+ "accounts": Object {},
26
30
  "error": "some-error",
27
31
  "pollingProcessID": 0,
28
- "statuses": Object {},
29
32
  }
30
33
  `;
31
34
 
32
35
  exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_START 1`] = `
33
36
  Object {
37
+ "accounts": Object {},
34
38
  "error": null,
35
39
  "pollingProcessID": 0,
36
- "statuses": Object {},
37
40
  }
38
41
  `;
39
42
 
40
43
  exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_STOP 1`] = `
41
44
  Object {
45
+ "accounts": Object {},
42
46
  "error": null,
43
47
  "pollingProcessID": 0,
44
- "statuses": Object {},
45
48
  }
46
49
  `;
47
50
 
48
51
  exports[`AccountList reducer should handle INVENTORY_PROCESS_RESTART 1`] = `
49
52
  Object {
50
- "error": null,
51
- "pollingProcessID": 0,
52
- "statuses": Object {
53
+ "accounts": Object {
53
54
  "user@redhat.com": Object {
54
55
  "upload_report_status": "Restarting...",
55
56
  },
56
57
  },
58
+ "error": null,
59
+ "pollingProcessID": 0,
57
60
  }
58
61
  `;
59
62
 
60
63
  exports[`AccountList reducer should return the initial state 1`] = `
61
64
  Object {
65
+ "accounts": Object {},
62
66
  "error": null,
63
67
  "pollingProcessID": 0,
64
- "statuses": Object {},
65
68
  }
66
69
  `;
@@ -2,18 +2,21 @@
2
2
 
3
3
  exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
4
4
 
5
- exports[`AccountList selectors should return AccountList statuses 1`] = `
5
+ exports[`AccountList selectors should return AccountList accounts 1`] = `
6
6
  Object {
7
7
  "Account1": Object {
8
8
  "generate_report_status": "running",
9
+ "label": "test_org1",
9
10
  "upload_report_status": "running",
10
11
  },
11
12
  "Account2": Object {
12
13
  "generate_report_status": "failure",
14
+ "label": "test_org2",
13
15
  "upload_report_status": "unknown",
14
16
  },
15
17
  "Account3": Object {
16
18
  "generate_report_status": "running",
19
+ "label": "test_org3",
17
20
  "upload_report_status": "success",
18
21
  },
19
22
  }
@@ -21,20 +24,23 @@ Object {
21
24
 
22
25
  exports[`AccountList selectors should return AccountsList 1`] = `
23
26
  Object {
24
- "pollingProcessID": 0,
25
- "statuses": Object {
27
+ "accounts": Object {
26
28
  "Account1": Object {
27
29
  "generate_report_status": "running",
30
+ "label": "test_org1",
28
31
  "upload_report_status": "running",
29
32
  },
30
33
  "Account2": Object {
31
34
  "generate_report_status": "failure",
35
+ "label": "test_org2",
32
36
  "upload_report_status": "unknown",
33
37
  },
34
38
  "Account3": Object {
35
39
  "generate_report_status": "running",
40
+ "label": "test_org3",
36
41
  "upload_report_status": "success",
37
42
  },
38
43
  },
44
+ "pollingProcessID": 0,
39
45
  }
40
46
  `;
@@ -5,14 +5,14 @@ import * as actions from './AccountListActions';
5
5
  import reducer from './AccountListReducer';
6
6
  import AccountList from './AccountList';
7
7
  import {
8
- selectStatuses,
8
+ selectAccounts,
9
9
  selectPollingProcessID,
10
10
  selectError,
11
11
  } from './AccountListSelectors';
12
12
 
13
13
  // map state to props
14
14
  const mapStateToProps = state => ({
15
- statuses: selectStatuses(state),
15
+ accounts: selectAccounts(state),
16
16
  pollingProcessID: selectPollingProcessID(state),
17
17
  error: selectError(state),
18
18
  });
@@ -24,7 +24,4 @@ const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
24
24
  export const reducers = { accountsList: reducer };
25
25
 
26
26
  // export connected component
27
- export default connect(
28
- mapStateToProps,
29
- mapDispatchToProps
30
- )(AccountList);
27
+ export default connect(mapStateToProps, mapDispatchToProps)(AccountList);
@@ -45,7 +45,7 @@ class Dashboard extends React.Component {
45
45
  const {
46
46
  uploading,
47
47
  generating,
48
- statuses,
48
+ account,
49
49
  showFullScreen,
50
50
  activeTab,
51
51
  } = this.props;
@@ -59,7 +59,7 @@ class Dashboard extends React.Component {
59
59
  props: {
60
60
  ...generating,
61
61
  restartProcess: this.handleRestart,
62
- exitCode: statuses.generate_report_status,
62
+ exitCode: account.generate_report_status,
63
63
  toggleFullScreen: this.handleToggleFullScreen,
64
64
  },
65
65
  onClick: () => this.handleTabChange('generating'),
@@ -72,7 +72,7 @@ class Dashboard extends React.Component {
72
72
  ...uploading,
73
73
  restartProcess: this.handleRestart,
74
74
  downloadReports: this.handleDownload,
75
- exitCode: statuses.upload_report_status,
75
+ exitCode: account.upload_report_status,
76
76
  toggleFullScreen: this.handleToggleFullScreen,
77
77
  },
78
78
  onClick: () => this.handleTabChange('uploading'),
@@ -115,7 +115,7 @@ Dashboard.propTypes = {
115
115
  restartProcess: PropTypes.func,
116
116
  downloadReports: PropTypes.func,
117
117
  pollingProcessID: PropTypes.number,
118
- statuses: PropTypes.shape({
118
+ account: PropTypes.shape({
119
119
  generate_report_status: PropTypes.string,
120
120
  upload_report_status: PropTypes.string,
121
121
  }),
@@ -134,7 +134,7 @@ Dashboard.defaultProps = {
134
134
  restartProcess: noop,
135
135
  downloadReports: noop,
136
136
  pollingProcessID: 0,
137
- statuses: {
137
+ account: {
138
138
  generate_report_status: 'unknown',
139
139
  upload_report_status: 'unknown',
140
140
  },
@@ -31,7 +31,4 @@ const mapDispatchToProps = dispatch =>
31
31
  export const reducers = { dashboard: reducer };
32
32
 
33
33
  // export connected component
34
- export default connect(
35
- mapStateToProps,
36
- mapDispatchToProps
37
- )(Dashboard);
34
+ export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`NavContainer rendering render with Props 1`] = `
4
- <Uncontrolled(TabContainer)
4
+ <ForwardRef
5
5
  defaultActiveKey={0}
6
6
  id="basic-tabs-pf"
7
7
  >
@@ -54,11 +54,11 @@ exports[`NavContainer rendering render with Props 1`] = `
54
54
  toggleFullScreen={[Function]}
55
55
  />
56
56
  </div>
57
- </Uncontrolled(TabContainer)>
57
+ </ForwardRef>
58
58
  `;
59
59
 
60
60
  exports[`NavContainer rendering render without Props 1`] = `
61
- <Uncontrolled(TabContainer)
61
+ <ForwardRef
62
62
  defaultActiveKey={0}
63
63
  id="basic-tabs-pf"
64
64
  >
@@ -85,5 +85,5 @@ exports[`NavContainer rendering render without Props 1`] = `
85
85
  toggleFullScreen={[Function]}
86
86
  />
87
87
  </div>
88
- </Uncontrolled(TabContainer)>
88
+ </ForwardRef>
89
89
  `;
@@ -5,7 +5,10 @@ import './statusChart.scss';
5
5
 
6
6
  const StatusChart = ({ completed }) => {
7
7
  const donutConfigData = {
8
- columns: [['Completed', completed], ['Remain', 100 - completed]],
8
+ columns: [
9
+ ['Completed', completed],
10
+ ['Remain', 100 - completed],
11
+ ],
9
12
  order: null,
10
13
  };
11
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_inventory_upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inventory upload team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-10 00:00:00.000000000 Z
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -104,9 +104,9 @@ files:
104
104
  - LICENSE
105
105
  - README.md
106
106
  - Rakefile
107
+ - app/controllers/foreman_inventory_upload/accounts_controller.rb
107
108
  - app/controllers/foreman_inventory_upload/react_controller.rb
108
109
  - app/controllers/foreman_inventory_upload/reports_controller.rb
109
- - app/controllers/foreman_inventory_upload/statuses_controller.rb
110
110
  - app/controllers/foreman_inventory_upload/uploads_controller.rb
111
111
  - app/helpers/foreman_inventory_upload_helper.rb
112
112
  - app/views/dashboard/_inventory_upload_widget.html.erb
@@ -134,8 +134,8 @@ files:
134
134
  - locale/foreman_yupana.pot
135
135
  - locale/gemspec.rb
136
136
  - package.json
137
+ - test/controllers/accounts_controller_test.rb
137
138
  - test/controllers/reports_controller_test.rb
138
- - test/controllers/statuses_controller_test.rb
139
139
  - test/controllers/uploads_controller_test.rb
140
140
  - test/factories/inventory_upload_factories.rb
141
141
  - test/test_plugin_helper.rb
@@ -325,9 +325,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
325
325
  version: '0'
326
326
  required_rubygems_version: !ruby/object:Gem::Requirement
327
327
  requirements:
328
- - - ">"
328
+ - - ">="
329
329
  - !ruby/object:Gem::Version
330
- version: 1.3.1
330
+ version: '0'
331
331
  requirements: []
332
332
  rubygems_version: 3.0.6
333
333
  signing_key:
@@ -335,7 +335,7 @@ specification_version: 4
335
335
  summary: Summary of ForemanInventoryUpload.
336
336
  test_files:
337
337
  - test/controllers/uploads_controller_test.rb
338
- - test/controllers/statuses_controller_test.rb
338
+ - test/controllers/accounts_controller_test.rb
339
339
  - test/controllers/reports_controller_test.rb
340
340
  - test/test_plugin_helper.rb
341
341
  - test/factories/inventory_upload_factories.rb
@@ -1,41 +0,0 @@
1
- module ForemanInventoryUpload
2
- class StatusesController < ::ApplicationController
3
- # override default "welcome screen behavior, since we don't have a model"
4
- def welcome
5
- true
6
- end
7
-
8
- def index
9
- portal_users = RedhatAccess::TelemetryConfiguration
10
- .where(enable_telemetry: true)
11
- .distinct
12
- .pluck(:portal_user)
13
-
14
- statuses = Hash[
15
- portal_users.map do |portal_user|
16
- generate_report_status = status_for(portal_user, ForemanInventoryUpload::Async::GenerateReportJob)
17
- upload_report_status = status_for(portal_user, ForemanInventoryUpload::Async::UploadReportJob)
18
-
19
- [
20
- portal_user,
21
- {
22
- generate_report_status: generate_report_status,
23
- upload_report_status: upload_report_status,
24
- },
25
- ]
26
- end
27
- ]
28
-
29
- render json: {
30
- statuses: statuses,
31
- }, status: :ok
32
- end
33
-
34
- private
35
-
36
- def status_for(portal_user, job_class)
37
- label = job_class.output_label(portal_user)
38
- ForemanInventoryUpload::Async::ProgressOutput.get(label)&.status
39
- end
40
- end
41
- end