foreman_inventory_upload 0.9.2 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/foreman_inventory_upload/reports_controller.rb +4 -3
  3. data/app/controllers/foreman_inventory_upload/statuses_controller.rb +41 -0
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +3 -3
  5. data/app/views/scripts/uploader.sh.erb +12 -25
  6. data/config/routes.rb +5 -5
  7. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +7 -4
  8. data/lib/foreman_inventory_upload/async/generate_report_job.rb +10 -18
  9. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +17 -12
  10. data/lib/foreman_inventory_upload/async/upload_report_job.rb +17 -22
  11. data/lib/foreman_inventory_upload/engine.rb +0 -2
  12. data/lib/foreman_inventory_upload/generators/archived_report.rb +2 -2
  13. data/lib/foreman_inventory_upload/generators/queries.rb +10 -19
  14. data/lib/foreman_inventory_upload/generators/slice.rb +3 -24
  15. data/lib/foreman_inventory_upload/version.rb +1 -1
  16. data/lib/foreman_inventory_upload.rb +10 -15
  17. data/lib/tasks/foreman_inventory_upload_tasks.rake +1 -1
  18. data/lib/tasks/generator.rake +5 -19
  19. data/test/controllers/reports_controller_test.rb +3 -3
  20. data/test/controllers/{accounts_controller_test.rb → statuses_controller_test.rb} +7 -6
  21. data/test/controllers/uploads_controller_test.rb +3 -3
  22. data/test/unit/archived_report_generator_test.rb +3 -3
  23. data/test/unit/slice_generator_test.rb +0 -74
  24. metadata +41 -180
  25. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +0 -39
  26. data/package.json +0 -125
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +0 -37
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +0 -74
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +0 -18
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +0 -65
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js +0 -9
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +0 -0
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -55
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -8
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js +0 -0
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +0 -16
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js +0 -0
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +0 -13
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +0 -26
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +0 -7
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/index.js +0 -1
  42. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.fixtures.js +0 -0
  43. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +0 -23
  44. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorStateHelper.js +0 -0
  45. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +0 -13
  46. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap +0 -20
  47. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +0 -18
  48. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/index.js +0 -1
  49. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +0 -1
  50. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +0 -41
  51. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js +0 -0
  52. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +0 -13
  53. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +0 -50
  54. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/index.js +0 -1
  55. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
  56. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +0 -7
  57. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +0 -43
  58. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +0 -29
  59. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +0 -14
  60. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +0 -78
  61. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/index.js +0 -1
  62. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
  63. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +0 -13
  64. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +0 -20
  65. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +0 -14
  66. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +0 -60
  67. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +0 -26
  68. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +0 -44
  69. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +0 -47
  70. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +0 -69
  71. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +0 -46
  72. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +0 -9
  73. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +0 -27
  74. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +0 -50
  75. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +0 -146
  76. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +0 -19
  77. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +0 -87
  78. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js +0 -9
  79. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardHelper.js +0 -0
  80. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js +0 -68
  81. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +0 -17
  82. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +0 -25
  83. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +0 -39
  84. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +0 -16
  85. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +0 -64
  86. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +0 -45
  87. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +0 -36
  88. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap +0 -76
  89. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap +0 -44
  90. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap +0 -42
  91. data/webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss +0 -0
  92. data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +0 -34
  93. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
  94. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +0 -22
  95. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
  96. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +0 -13
  97. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +0 -25
  98. data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +0 -3
  99. data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +0 -1
  100. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js +0 -0
  101. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +0 -50
  102. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js +0 -0
  103. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +0 -13
  104. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +0 -64
  105. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +0 -10
  106. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js +0 -1
  107. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +0 -10
  108. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +0 -83
  109. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
  110. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +0 -26
  111. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +0 -89
  112. data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +0 -1
  113. data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +0 -7
  114. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +0 -16
  115. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +0 -57
  116. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js +0 -0
  117. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +0 -14
  118. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +0 -45
  119. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js +0 -1
  120. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss +0 -0
  121. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +0 -18
  122. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +0 -57
  123. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js +0 -0
  124. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +0 -14
  125. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +0 -45
  126. data/webpack/ForemanInventoryUpload/Components/ReportUpload/index.js +0 -1
  127. data/webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss +0 -0
  128. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -3
  129. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +0 -27
  130. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
  131. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +0 -14
  132. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +0 -25
  133. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +0 -1
  134. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +0 -11
  135. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
  136. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +0 -56
  137. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
  138. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +0 -13
  139. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +0 -74
  140. data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +0 -1
  141. data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +0 -8
  142. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js +0 -0
  143. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js +0 -31
  144. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js +0 -0
  145. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +0 -13
  146. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +0 -19
  147. data/webpack/ForemanInventoryUpload/Components/TabBody/index.js +0 -1
  148. data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +0 -3
  149. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
  150. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +0 -24
  151. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
  152. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +0 -13
  153. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap +0 -18
  154. data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +0 -1
  155. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +0 -8
  156. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
  157. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +0 -19
  158. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
  159. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +0 -13
  160. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap +0 -12
  161. data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +0 -1
  162. data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
  163. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
  164. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +0 -45
  165. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
  166. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +0 -13
  167. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +0 -53
  168. data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +0 -1
  169. data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +0 -21
  170. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js +0 -10
  171. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +0 -112
  172. data/webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js +0 -6
  173. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +0 -35
  174. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +0 -98
  175. data/webpack/ForemanInventoryUpload/Components/Terminal/index.js +0 -1
  176. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +0 -31
  177. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +0 -15
  178. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +0 -10
  179. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -12
  180. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
  181. data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +0 -16
  182. data/webpack/ForemanInventoryUpload/index.js +0 -1
  183. data/webpack/__mocks__/foremanReact/API.js +0 -7
  184. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -5
  185. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -3
  186. data/webpack/index.js +0 -18
  187. data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
  188. data/webpack/stories/configureStore.js +0 -15
  189. data/webpack/stories/decorators/index.js +0 -1
  190. data/webpack/stories/decorators/withCardsDecorator.js +0 -14
  191. data/webpack/stories/index.js +0 -10
  192. data/webpack/stories/index.scss +0 -7
  193. data/webpack/test_setup.js +0 -6
@@ -46,13 +46,13 @@ class ArchivedReportGeneratorTest < ActiveSupport::TestCase
46
46
 
47
47
  test 'generates a report for a single host' do
48
48
  batches = Host.where(id: @host.id).in_batches
49
- test_org = FactoryBot.create(:organization)
49
+ portal_user = 'test_portal_user'
50
50
 
51
- ForemanInventoryUpload::Generators::Queries.expects(:for_org).with(test_org.id).returns(batches)
51
+ ForemanInventoryUpload::Generators::Queries.expects(:for_report).with(portal_user).returns(batches)
52
52
  Dir.mktmpdir do |tmpdir|
53
53
  target = File.join(tmpdir, 'test.tar.gz')
54
54
  generator = ForemanInventoryUpload::Generators::ArchivedReport.new(target, Logger.new(STDOUT))
55
- generator.render(organization: test_org.id)
55
+ generator.render(portal_user)
56
56
 
57
57
  files = Dir["#{tmpdir}/*"]
58
58
  assert_equal "#{tmpdir}/test.tar.gz", files.first
@@ -57,78 +57,4 @@ class ReportGeneratorTest < ActiveSupport::TestCase
57
57
  assert_equal @host.fqdn, actual_host['fqdn']
58
58
  assert_equal '1234', actual_host['account']
59
59
  end
60
-
61
- test 'generates a report with satellite facts' do
62
- Foreman.expects(:instance_id).returns('satellite-id')
63
- batch = Host.where(id: @host.id).in_batches.first
64
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice-123')
65
-
66
- json_str = generator.render
67
- actual = JSON.parse(json_str.join("\n"))
68
-
69
- facts = actual['hosts'].first['facts'].first
70
- assert_equal 'satellite', facts['namespace']
71
- satellite_facts = facts['facts']
72
- assert_equal 'satellite-id', satellite_facts['satellite_instance_id']
73
- assert_equal @host.organization_id, satellite_facts['organization_id']
74
-
75
- version = satellite_facts['satellite_version']
76
- if defined?(ForemanThemeSatellite)
77
- assert_equal ForemanThemeSatellite::SATELLITE_VERSION, version
78
- else
79
- assert_nil version
80
- end
81
- end
82
-
83
- test 'generates a report for a host with hypervisor' do
84
- hypervisor_host = FactoryBot.create(
85
- :host,
86
- :with_subscription,
87
- :with_content,
88
- content_view: @host.content_view,
89
- lifecycle_environment: @host.lifecycle_environment,
90
- organization: @host.organization
91
- )
92
-
93
- @host.subscription_facet.hypervisor_host = hypervisor_host
94
- @host.save!
95
-
96
- batch = Host.where(id: @host.id).in_batches.first
97
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
98
-
99
- json_str = generator.render
100
- actual = JSON.parse(json_str.join("\n"))
101
-
102
- assert_equal 'slice_123', actual['report_slice_id']
103
- assert_not_nil(actual_host = actual['hosts'].first)
104
- assert_equal @host.name, actual_host['display_name']
105
- assert_equal @host.fqdn, actual_host['fqdn']
106
- assert_not_nil(host_facts = actual_host['facts']&.first)
107
- assert_equal 'satellite', host_facts['namespace']
108
- assert_not_nil(fact_values = host_facts['facts'])
109
- assert_equal hypervisor_host.name, fact_values['virtual_host_name']
110
- assert_equal hypervisor_host.subscription_facet.uuid, fact_values['virtual_host_uuid']
111
- end
112
-
113
- test 'generates a report with system purpose' do
114
- @host.subscription_facet.purpose_usage = 'test_usage'
115
- @host.subscription_facet.purpose_role = 'test_role'
116
- @host.subscription_facet.save!
117
-
118
- batch = Host.where(id: @host.id).in_batches.first
119
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
120
-
121
- json_str = generator.render
122
- actual = JSON.parse(json_str.join("\n"))
123
-
124
- assert_equal 'slice_123', actual['report_slice_id']
125
- assert_not_nil(actual_host = actual['hosts'].first)
126
- assert_equal @host.name, actual_host['display_name']
127
- assert_equal @host.fqdn, actual_host['fqdn']
128
- assert_not_nil(host_facts = actual_host['facts']&.first)
129
- assert_equal 'satellite', host_facts['namespace']
130
- assert_not_nil(fact_values = host_facts['facts'])
131
- assert_equal 'test_usage', fact_values['system_purpose_usage']
132
- assert_equal 'test_role', fact_values['system_purpose_role']
133
- end
134
60
  end
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: 0.9.2
4
+ version: 1.0.0.beta1
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-12-05 00:00:00.000000000 Z
11
+ date: 2019-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -56,16 +56,44 @@ dependencies:
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
60
88
  - !ruby/object:Gem::Version
61
- version: 0.54.0
89
+ version: '0'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - "~>"
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: 0.54.0
96
+ version: '0'
69
97
  description: Foreman plugin that process & upload data to cloud based host inventory
70
98
  email:
71
99
  - rlavi@redhat.com, sshtein@redhat.com
@@ -76,9 +104,9 @@ files:
76
104
  - LICENSE
77
105
  - README.md
78
106
  - Rakefile
79
- - app/controllers/foreman_inventory_upload/accounts_controller.rb
80
107
  - app/controllers/foreman_inventory_upload/react_controller.rb
81
108
  - app/controllers/foreman_inventory_upload/reports_controller.rb
109
+ - app/controllers/foreman_inventory_upload/statuses_controller.rb
82
110
  - app/controllers/foreman_inventory_upload/uploads_controller.rb
83
111
  - app/helpers/foreman_inventory_upload_helper.rb
84
112
  - app/views/dashboard/_inventory_upload_widget.html.erb
@@ -105,9 +133,8 @@ files:
105
133
  - locale/en/foreman_yupana.po
106
134
  - locale/foreman_yupana.pot
107
135
  - locale/gemspec.rb
108
- - package.json
109
- - test/controllers/accounts_controller_test.rb
110
136
  - test/controllers/reports_controller_test.rb
137
+ - test/controllers/statuses_controller_test.rb
111
138
  - test/controllers/uploads_controller_test.rb
112
139
  - test/factories/inventory_upload_factories.rb
113
140
  - test/test_plugin_helper.rb
@@ -115,173 +142,6 @@ files:
115
142
  - test/unit/metadata_generator_test.rb
116
143
  - test/unit/shell_process_job_test.rb
117
144
  - test/unit/slice_generator_test.rb
118
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js
119
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js
120
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js
121
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js
122
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js
123
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js
124
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
125
- - webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js
126
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js
127
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js
128
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js
129
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js
130
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap
131
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss
132
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/index.js
133
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.fixtures.js
134
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js
135
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorStateHelper.js
136
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js
137
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap
138
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss
139
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/index.js
140
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js
141
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js
142
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js
143
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js
144
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap
145
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/index.js
146
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss
147
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js
148
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js
149
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js
150
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js
151
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap
152
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/index.js
153
- - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss
154
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js
155
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
156
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js
157
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js
158
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js
159
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap
160
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap
161
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap
162
- - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap
163
- - webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss
164
- - webpack/ForemanInventoryUpload/Components/AccountList/index.js
165
- - webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js
166
- - webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js
167
- - webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js
168
- - webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js
169
- - webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js
170
- - webpack/ForemanInventoryUpload/Components/Dashboard/DashboardHelper.js
171
- - webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js
172
- - webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js
173
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js
174
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js
175
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js
176
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js
177
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js
178
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap
179
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap
180
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap
181
- - webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap
182
- - webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss
183
- - webpack/ForemanInventoryUpload/Components/Dashboard/index.js
184
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js
185
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js
186
- - webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js
187
- - webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js
188
- - webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap
189
- - webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss
190
- - webpack/ForemanInventoryUpload/Components/FileDownload/index.js
191
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js
192
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js
193
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js
194
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js
195
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap
196
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss
197
- - webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js
198
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js
199
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
200
- - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js
201
- - webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js
202
- - webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap
203
- - webpack/ForemanInventoryUpload/Components/NavContainer/index.js
204
- - webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss
205
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js
206
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js
207
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js
208
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js
209
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap
210
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js
211
- - webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss
212
- - webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js
213
- - webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js
214
- - webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js
215
- - webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js
216
- - webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap
217
- - webpack/ForemanInventoryUpload/Components/ReportUpload/index.js
218
- - webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss
219
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js
220
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js
221
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js
222
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js
223
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap
224
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js
225
- - webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss
226
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js
227
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js
228
- - webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js
229
- - webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js
230
- - webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap
231
- - webpack/ForemanInventoryUpload/Components/StatusChart/index.js
232
- - webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss
233
- - webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js
234
- - webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js
235
- - webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js
236
- - webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js
237
- - webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap
238
- - webpack/ForemanInventoryUpload/Components/TabBody/index.js
239
- - webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss
240
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js
241
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js
242
- - webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js
243
- - webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js
244
- - webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap
245
- - webpack/ForemanInventoryUpload/Components/TabContainer/index.js
246
- - webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss
247
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js
248
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js
249
- - webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js
250
- - webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js
251
- - webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap
252
- - webpack/ForemanInventoryUpload/Components/TabFooter/index.js
253
- - webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss
254
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js
255
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js
256
- - webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js
257
- - webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js
258
- - webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap
259
- - webpack/ForemanInventoryUpload/Components/TabHeader/index.js
260
- - webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss
261
- - webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js
262
- - webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js
263
- - webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js
264
- - webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js
265
- - webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap
266
- - webpack/ForemanInventoryUpload/Components/Terminal/index.js
267
- - webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss
268
- - webpack/ForemanInventoryUpload/ForemanInventoryUpload.js
269
- - webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js
270
- - webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js
271
- - webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js
272
- - webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap
273
- - webpack/ForemanInventoryUpload/index.js
274
- - webpack/__mocks__/foremanReact/API.js
275
- - webpack/__mocks__/foremanReact/common/I18n.js
276
- - webpack/__mocks__/foremanReact/common/helpers.js
277
- - webpack/index.js
278
- - webpack/stories/ForemanInventoryUploadReducers.js
279
- - webpack/stories/configureStore.js
280
- - webpack/stories/decorators/index.js
281
- - webpack/stories/decorators/withCardsDecorator.js
282
- - webpack/stories/index.js
283
- - webpack/stories/index.scss
284
- - webpack/test_setup.js
285
145
  homepage: https://github.com/theforeman/foreman_inventory_upload
286
146
  licenses:
287
147
  - GPL-3.0
@@ -297,17 +157,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
157
  version: '0'
298
158
  required_rubygems_version: !ruby/object:Gem::Requirement
299
159
  requirements:
300
- - - ">="
160
+ - - ">"
301
161
  - !ruby/object:Gem::Version
302
- version: '0'
162
+ version: 1.3.1
303
163
  requirements: []
304
- rubygems_version: 3.0.6
164
+ rubyforge_project:
165
+ rubygems_version: 2.6.14
305
166
  signing_key:
306
167
  specification_version: 4
307
168
  summary: Summary of ForemanInventoryUpload.
308
169
  test_files:
309
170
  - test/controllers/uploads_controller_test.rb
310
- - test/controllers/accounts_controller_test.rb
171
+ - test/controllers/statuses_controller_test.rb
311
172
  - test/controllers/reports_controller_test.rb
312
173
  - test/test_plugin_helper.rb
313
174
  - test/factories/inventory_upload_factories.rb
@@ -1,39 +0,0 @@
1
- module ForemanInventoryUpload
2
- class AccountsController < ::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
- labels = Organization.all.pluck(:id, :name)
10
-
11
- accounts = Hash[
12
- labels.map do |id, label|
13
- generate_report_status = status_for(id, ForemanInventoryUpload::Async::GenerateReportJob)
14
- upload_report_status = status_for(id, ForemanInventoryUpload::Async::UploadReportJob)
15
-
16
- [
17
- id,
18
- {
19
- generate_report_status: generate_report_status,
20
- upload_report_status: upload_report_status,
21
- label: label,
22
- },
23
- ]
24
- end
25
- ]
26
-
27
- render json: {
28
- accounts: accounts,
29
- }, status: :ok
30
- end
31
-
32
- private
33
-
34
- def status_for(label, job_class)
35
- label = job_class.output_label(label)
36
- ForemanInventoryUpload::Async::ProgressOutput.get(label)&.status
37
- end
38
- end
39
- end
data/package.json DELETED
@@ -1,125 +0,0 @@
1
- {
2
- "name": "foreman_inventory_upload",
3
- "version": "0.0.1",
4
- "description": "Inventory Upload =============",
5
- "main": "index.js",
6
- "scripts": {
7
- "lint": "./node_modules/.bin/eslint -c .eslintrc webpack/",
8
- "test": "node node_modules/.bin/jest --no-cache",
9
- "test:watch": "node node_modules/.bin/jest --watchAll",
10
- "test:current": "node node_modules/.bin/jest --watch",
11
- "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
12
- "storybook": "start-storybook -p 6006",
13
- "storybook:build": "node --max_old_space_size=2048 ./node_modules/.bin/build-storybook --config-dir .storybook --output-dir .storybook-dist",
14
- "storybook:deploy": "surge --project .storybook-dist"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/theforeman/foreman_inventory_upload.git"
19
- },
20
- "bugs": {
21
- "url": "http://projects.theforeman.org/projects/foreman_inventory_upload/issues"
22
- },
23
- "optionalDependencies": {
24
- "babel-plugin-module-resolver": "^3.2.0"
25
- },
26
- "devDependencies": {
27
- "@storybook/addon-actions": "^5.0.1",
28
- "@storybook/addon-knobs": "^5.0.1",
29
- "@storybook/react": "^5.0.1",
30
- "babel-cli": "^6.10.1",
31
- "babel-core": "^6.26.3",
32
- "babel-eslint": "^8.2.3",
33
- "babel-jest": "^23.6.0",
34
- "babel-loader": "^7.1.1",
35
- "babel-plugin-dynamic-import-node": "^2.0.0",
36
- "babel-plugin-lodash": "^3.3.4",
37
- "babel-plugin-syntax-dynamic-import": "^6.18.0",
38
- "babel-plugin-transform-class-properties": "^6.24.1",
39
- "babel-plugin-transform-object-assign": "^6.8.0",
40
- "babel-plugin-transform-object-rest-spread": "^6.8.0",
41
- "babel-preset-env": "^1.7.0",
42
- "babel-preset-react": "^6.5.0",
43
- "coveralls": "^3.0.0",
44
- "enzyme": "^3.4.0",
45
- "enzyme-adapter-react-16": "^1.4.0",
46
- "enzyme-to-json": "^3.2.1",
47
- "eslint": "^4.10.0",
48
- "eslint-import-resolver-babel-module": "^4.0.0",
49
- "eslint-plugin-patternfly-react": "0.2.0",
50
- "identity-obj-proxy": "^3.0.0",
51
- "jed": "^1.1.1",
52
- "jest-cli": "^23.6.0",
53
- "jest-prop-type-error": "^1.1.0",
54
- "node-sass": "^4.5.0",
55
- "patternfly": "^3.58.0",
56
- "prettier": "^1.13.5",
57
- "raf": "^3.4.0",
58
- "react-redux-test-utils": "^0.1.1",
59
- "react-remarkable": "^1.1.3",
60
- "sass-loader": "^6.0.7",
61
- "stylelint": "^9.3.0",
62
- "stylelint-config-standard": "^18.0.0",
63
- "surge": "^0.20.3"
64
- },
65
- "dependencies": {
66
- "babel-polyfill": "^6.26.0",
67
- "classnames": "^2.2.5",
68
- "lodash": "^4.17.10",
69
- "patternfly-react": "^2.19.1",
70
- "prop-types": "^15.6.0",
71
- "react": "^16.4.0",
72
- "react-dom": "^16.4.0",
73
- "react-intl": "^2.8.0",
74
- "react-redux": "^5.0.6",
75
- "redux": "^3.6.0",
76
- "redux-thunk": "^2.2.0",
77
- "reselect": "^3.0.1",
78
- "seamless-immutable": "^7.1.2",
79
- "urijs": "^1.18.10",
80
- "uuid": "^3.0.1"
81
- },
82
- "jest": {
83
- "automock": true,
84
- "verbose": true,
85
- "testMatch": [
86
- "**/*.test.js"
87
- ],
88
- "testURL": "http://localhost/",
89
- "collectCoverage": true,
90
- "collectCoverageFrom": [
91
- "webpack/**/*.js",
92
- "!webpack/index.js",
93
- "!webpack/test_setup.js",
94
- "!webpack/**/bundle*",
95
- "!webpack/stories/**",
96
- "!webpack/**/*stories.js"
97
- ],
98
- "coverageReporters": [
99
- "lcov"
100
- ],
101
- "unmockedModulePathPatterns": [
102
- "webpack/",
103
- "react",
104
- "node_modules/"
105
- ],
106
- "moduleNameMapper": {
107
- "^.+\\.(png|gif|css|scss)$": "identity-obj-proxy"
108
- },
109
- "globals": {
110
- "__testing__": true
111
- },
112
- "transform": {
113
- "^.+\\.js$": "babel-jest"
114
- },
115
- "moduleDirectories": [
116
- "node_modules",
117
- "webpack"
118
- ],
119
- "setupFiles": [
120
- "raf/polyfill",
121
- "jest-prop-type-error",
122
- "./webpack/test_setup.js"
123
- ]
124
- }
125
- }
@@ -1,37 +0,0 @@
1
- import { noop } from 'patternfly-react';
2
-
3
- export const API_SUCCESS_RESPONSE = {
4
- Account1: {
5
- label: 'test_org1',
6
- upload_report_status: 'running',
7
- generate_report_status: 'running',
8
- },
9
- Account2: {
10
- label: 'test_org2',
11
- upload_report_status: 'unknown',
12
- generate_report_status: 'failure',
13
- },
14
- Account3: {
15
- label: 'test_org3',
16
- upload_report_status: 'success',
17
- generate_report_status: 'running',
18
- },
19
- };
20
-
21
- export const accounts = API_SUCCESS_RESPONSE;
22
-
23
- export const pollingProcessID = 0;
24
-
25
- export const error = 'some-error';
26
-
27
- export const accountID = 'user@redhat.com';
28
-
29
- export const processStatusName = 'upload_report_status';
30
-
31
- export const props = {
32
- accounts,
33
- fetchAccountsStatus: noop,
34
- startAccountStatusPolling: noop,
35
- stopAccountStatusPolling: noop,
36
- pollingProcessID,
37
- };
@@ -1,74 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { ListView, noop } from 'patternfly-react';
3
- import PropTypes from 'prop-types';
4
- import ListItem from './Components/ListItem';
5
- import EmptyState from './Components/EmptyState';
6
- import ErrorState from './Components/ErrorState';
7
- import './accountList.scss';
8
-
9
- class AccountList extends Component {
10
- componentDidMount() {
11
- const { fetchAccountsStatus, startAccountStatusPolling } = this.props;
12
- fetchAccountsStatus();
13
- const pollingProcessID = setInterval(fetchAccountsStatus, 5000);
14
- startAccountStatusPolling(pollingProcessID);
15
- }
16
-
17
- componentWillUnmount() {
18
- const { stopAccountStatusPolling, pollingProcessID } = this.props;
19
- stopAccountStatusPolling(pollingProcessID);
20
- }
21
-
22
- render() {
23
- const { accounts, error } = this.props;
24
- const accountIds = Object.keys(accounts);
25
-
26
- if (error) {
27
- return <ErrorState error={error} />;
28
- }
29
-
30
- if (accountIds.length === 0) {
31
- return <EmptyState />;
32
- }
33
- const items = accountIds.map((accountID, index) => {
34
- const account = accounts[accountID];
35
- return (
36
- <ListItem
37
- key={index}
38
- accountID={accountID}
39
- account={account}
40
- initExpanded={index === 0}
41
- />
42
- );
43
- });
44
- return <ListView className="account_list">{items}</ListView>;
45
- }
46
- }
47
-
48
- AccountList.propTypes = {
49
- fetchAccountsStatus: PropTypes.func,
50
- startAccountStatusPolling: PropTypes.func,
51
- stopAccountStatusPolling: PropTypes.func,
52
- pollingProcessID: PropTypes.number,
53
- account: PropTypes.shape({
54
- generate_report_status: PropTypes.string,
55
- upload_report_status: PropTypes.string,
56
- }),
57
- accounts: PropTypes.object,
58
- error: PropTypes.string,
59
- };
60
-
61
- AccountList.defaultProps = {
62
- fetchAccountsStatus: noop,
63
- startAccountStatusPolling: noop,
64
- stopAccountStatusPolling: noop,
65
- pollingProcessID: 0,
66
- account: {
67
- generate_report_status: 'unknown',
68
- upload_report_status: 'unknown',
69
- },
70
- accounts: {},
71
- error: '',
72
- };
73
-
74
- export default AccountList;