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
@@ -1,20 +0,0 @@
1
- import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
2
- import {
3
- fetchAccountsStatus,
4
- startAccountStatusPolling,
5
- stopAccountStatusPolling,
6
- restartProcess,
7
- } from '../AccountListActions';
8
- import { pollingProcessID } from '../AccountList.fixtures';
9
- import { accountID, activeTab } from '../../Dashboard/Dashboard.fixtures';
10
-
11
- const fixtures = {
12
- 'should fetchAccountsStatus': () => fetchAccountsStatus(),
13
- 'should startAccountStatusPolling': () =>
14
- startAccountStatusPolling(pollingProcessID),
15
- 'should stopAccountStatusPolling': () =>
16
- stopAccountStatusPolling(pollingProcessID),
17
- 'should restartProcess': () => restartProcess(accountID, activeTab),
18
- };
19
-
20
- describe('AccountList actions', () => testActionSnapshotWithFixtures(fixtures));
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { IntegrationTestHelper } from 'react-redux-test-utils';
3
-
4
- import AccountList from '../index';
5
- import reducers from '../../../ForemanInventoryUploadReducers';
6
-
7
- describe('AccountList integration test', () => {
8
- it('should flow', async () => {
9
- const integrationTestHelper = new IntegrationTestHelper(reducers);
10
- const component = integrationTestHelper.mount(<AccountList />);
11
- component.update();
12
- /** Create a Flow test */
13
- });
14
- });
@@ -1,60 +0,0 @@
1
- import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
-
3
- import {
4
- INVENTORY_ACCOUNT_STATUS_POLLING,
5
- INVENTORY_ACCOUNT_STATUS_POLLING_START,
6
- INVENTORY_ACCOUNT_STATUS_POLLING_STOP,
7
- INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
8
- INVENTORY_PROCESS_RESTART,
9
- } from '../AccountListConstants';
10
- import reducer from '../AccountListReducer';
11
- import {
12
- accounts,
13
- error,
14
- pollingProcessID,
15
- accountID,
16
- processStatusName,
17
- } from '../AccountList.fixtures';
18
-
19
- const fixtures = {
20
- 'should return the initial state': {},
21
- 'should handle INVENTORY_ACCOUNT_STATUS_POLLING': {
22
- action: {
23
- type: INVENTORY_ACCOUNT_STATUS_POLLING,
24
- payload: {
25
- accounts,
26
- },
27
- },
28
- },
29
- 'should handle INVENTORY_ACCOUNT_STATUS_POLLING_ERROR': {
30
- action: {
31
- type: INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
32
- payload: { error },
33
- },
34
- },
35
- 'should handle INVENTORY_ACCOUNT_STATUS_POLLING_START': {
36
- action: {
37
- type: INVENTORY_ACCOUNT_STATUS_POLLING_START,
38
- payload: {
39
- pollingProcessID,
40
- },
41
- },
42
- },
43
- 'should handle INVENTORY_ACCOUNT_STATUS_POLLING_STOP': {
44
- action: {
45
- type: INVENTORY_ACCOUNT_STATUS_POLLING_STOP,
46
- },
47
- },
48
- 'should handle INVENTORY_PROCESS_RESTART': {
49
- action: {
50
- type: INVENTORY_PROCESS_RESTART,
51
- payload: {
52
- accountID,
53
- processStatusName,
54
- },
55
- },
56
- },
57
- };
58
-
59
- describe('AccountList reducer', () =>
60
- testReducerSnapshotWithFixtures(reducer, fixtures));
@@ -1,26 +0,0 @@
1
- import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
- import {
3
- selectAccountsList,
4
- selectAccounts,
5
- selectPollingProcessID,
6
- } from '../AccountListSelectors';
7
- import { pollingProcessID, accounts } from '../AccountList.fixtures';
8
-
9
- const state = {
10
- ForemanInventoryUpload: {
11
- accountsList: {
12
- accounts,
13
- pollingProcessID,
14
- },
15
- },
16
- };
17
-
18
- const fixtures = {
19
- 'should return AccountsList': () => selectAccountsList(state),
20
- 'should return AccountList accounts': () => selectAccounts(state),
21
- 'should return AccountList pollingProcessID': () =>
22
- selectPollingProcessID(state),
23
- };
24
-
25
- describe('AccountList selectors', () =>
26
- testSelectorsSnapshotWithFixtures(fixtures));
@@ -1,44 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AccountList rendering render with props 1`] = `
4
- <ListView
5
- className="account_list"
6
- >
7
- <ListItem
8
- account={
9
- Object {
10
- "generate_report_status": "running",
11
- "label": "test_org1",
12
- "upload_report_status": "running",
13
- }
14
- }
15
- accountID="Account1"
16
- initExpanded={true}
17
- key="0"
18
- />
19
- <ListItem
20
- account={
21
- Object {
22
- "generate_report_status": "failure",
23
- "label": "test_org2",
24
- "upload_report_status": "unknown",
25
- }
26
- }
27
- accountID="Account2"
28
- initExpanded={false}
29
- key="1"
30
- />
31
- <ListItem
32
- account={
33
- Object {
34
- "generate_report_status": "running",
35
- "label": "test_org3",
36
- "upload_report_status": "success",
37
- }
38
- }
39
- accountID="Account3"
40
- initExpanded={false}
41
- key="2"
42
- />
43
- </ListView>
44
- `;
@@ -1,47 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AccountList actions should fetchAccountsStatus 1`] = `
4
- Array [
5
- Array [
6
- Object {
7
- "payload": Object {
8
- "error": "Cannot read property 'data' of undefined",
9
- },
10
- "type": "INVENTORY_ACCOUNT_STATUS_POLLING_ERROR",
11
- },
12
- ],
13
- ]
14
- `;
15
-
16
- exports[`AccountList actions should restartProcess 1`] = `
17
- Array [
18
- Array [
19
- Object {
20
- "payload": Object {
21
- "accountID": "some-account-ID",
22
- "processStatusName": "generate_report_status",
23
- },
24
- "type": "INVENTORY_PROCESS_RESTART",
25
- },
26
- ],
27
- ]
28
- `;
29
-
30
- exports[`AccountList actions should startAccountStatusPolling 1`] = `
31
- Object {
32
- "payload": Object {
33
- "pollingProcessID": 0,
34
- },
35
- "type": "INVENTORY_ACCOUNT_STATUS_POLLING_START",
36
- }
37
- `;
38
-
39
- exports[`AccountList actions should stopAccountStatusPolling 1`] = `
40
- Array [
41
- Array [
42
- Object {
43
- "type": "INVENTORY_ACCOUNT_STATUS_POLLING_STOP",
44
- },
45
- ],
46
- ]
47
- `;
@@ -1,69 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
4
- Object {
5
- "accounts": Object {
6
- "Account1": Object {
7
- "generate_report_status": "running",
8
- "label": "test_org1",
9
- "upload_report_status": "running",
10
- },
11
- "Account2": Object {
12
- "generate_report_status": "failure",
13
- "label": "test_org2",
14
- "upload_report_status": "unknown",
15
- },
16
- "Account3": Object {
17
- "generate_report_status": "running",
18
- "label": "test_org3",
19
- "upload_report_status": "success",
20
- },
21
- },
22
- "error": null,
23
- "pollingProcessID": 0,
24
- }
25
- `;
26
-
27
- exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_ERROR 1`] = `
28
- Object {
29
- "accounts": Object {},
30
- "error": "some-error",
31
- "pollingProcessID": 0,
32
- }
33
- `;
34
-
35
- exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_START 1`] = `
36
- Object {
37
- "accounts": Object {},
38
- "error": null,
39
- "pollingProcessID": 0,
40
- }
41
- `;
42
-
43
- exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_STOP 1`] = `
44
- Object {
45
- "accounts": Object {},
46
- "error": null,
47
- "pollingProcessID": 0,
48
- }
49
- `;
50
-
51
- exports[`AccountList reducer should handle INVENTORY_PROCESS_RESTART 1`] = `
52
- Object {
53
- "accounts": Object {
54
- "user@redhat.com": Object {
55
- "upload_report_status": "Restarting...",
56
- },
57
- },
58
- "error": null,
59
- "pollingProcessID": 0,
60
- }
61
- `;
62
-
63
- exports[`AccountList reducer should return the initial state 1`] = `
64
- Object {
65
- "accounts": Object {},
66
- "error": null,
67
- "pollingProcessID": 0,
68
- }
69
- `;
@@ -1,46 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
4
-
5
- exports[`AccountList selectors should return AccountList accounts 1`] = `
6
- Object {
7
- "Account1": Object {
8
- "generate_report_status": "running",
9
- "label": "test_org1",
10
- "upload_report_status": "running",
11
- },
12
- "Account2": Object {
13
- "generate_report_status": "failure",
14
- "label": "test_org2",
15
- "upload_report_status": "unknown",
16
- },
17
- "Account3": Object {
18
- "generate_report_status": "running",
19
- "label": "test_org3",
20
- "upload_report_status": "success",
21
- },
22
- }
23
- `;
24
-
25
- exports[`AccountList selectors should return AccountsList 1`] = `
26
- Object {
27
- "accounts": Object {
28
- "Account1": Object {
29
- "generate_report_status": "running",
30
- "label": "test_org1",
31
- "upload_report_status": "running",
32
- },
33
- "Account2": Object {
34
- "generate_report_status": "failure",
35
- "label": "test_org2",
36
- "upload_report_status": "unknown",
37
- },
38
- "Account3": Object {
39
- "generate_report_status": "running",
40
- "label": "test_org3",
41
- "upload_report_status": "success",
42
- },
43
- },
44
- "pollingProcessID": 0,
45
- }
46
- `;
@@ -1,9 +0,0 @@
1
- .account_list {
2
- .list-view-pf-expand {
3
- margin-top: 25px;
4
- }
5
-
6
- .list-group-item-container {
7
- min-height: 435px;
8
- }
9
- }
@@ -1,27 +0,0 @@
1
- import { bindActionCreators } from 'redux';
2
- import { connect } from 'react-redux';
3
-
4
- import * as actions from './AccountListActions';
5
- import reducer from './AccountListReducer';
6
- import AccountList from './AccountList';
7
- import {
8
- selectAccounts,
9
- selectPollingProcessID,
10
- selectError,
11
- } from './AccountListSelectors';
12
-
13
- // map state to props
14
- const mapStateToProps = state => ({
15
- accounts: selectAccounts(state),
16
- pollingProcessID: selectPollingProcessID(state),
17
- error: selectError(state),
18
- });
19
-
20
- // map action dispatchers to props
21
- const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
22
-
23
- // export reducers
24
- export const reducers = { accountsList: reducer };
25
-
26
- // export connected component
27
- export default connect(mapStateToProps, mapDispatchToProps)(AccountList);
@@ -1,50 +0,0 @@
1
- import { noop } from 'patternfly-react';
2
-
3
- export const pollingProcessID = 1;
4
-
5
- export const logs = ['some-logs...'];
6
-
7
- export const completed = 25;
8
-
9
- export const error = 'some-error';
10
-
11
- export const inventory = {
12
- generating: {
13
- logs,
14
- completed,
15
- },
16
- uploading: {
17
- logs,
18
- completed,
19
- files,
20
- },
21
- };
22
-
23
- export const accountID = 'some-account-ID';
24
-
25
- export const exitCode = 0;
26
-
27
- export const files = ['some-file'];
28
-
29
- export const activeTab = 'uploads';
30
-
31
- export const scheduled = '2019-08-21T16:14:16.520+03:00';
32
-
33
- export const serverMock = {
34
- data: { output: 'some-logs\nsome-logs', status: exitCode, scheduled },
35
- };
36
-
37
- export const initialState = {};
38
-
39
- export const props = {
40
- accountID,
41
- uploading: {},
42
- generating: {},
43
- startPolling: noop,
44
- fetchLogs: noop,
45
- stopPolling: noop,
46
- setActiveTab: noop,
47
- restartProcess: noop,
48
- downloadReports: noop,
49
- pollingProcessID: 0,
50
- };
@@ -1,146 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { noop } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import ReportGenerate from '../ReportGenerate';
6
- import ReportUpload from '../ReportUpload';
7
- import NavContainer from '../NavContainer';
8
- import './dashboard.scss';
9
-
10
- class Dashboard extends React.Component {
11
- componentDidMount() {
12
- const { startPolling, fetchLogs, accountID } = this.props;
13
- fetchLogs(accountID);
14
- const pollingProcessID = setInterval(() => fetchLogs(accountID), 5000);
15
- startPolling(accountID, pollingProcessID);
16
- }
17
-
18
- componentWillUnmount() {
19
- const { stopPolling, pollingProcessID, accountID } = this.props;
20
- stopPolling(accountID, pollingProcessID);
21
- }
22
-
23
- handleDownload = () => {
24
- const { downloadReports, accountID } = this.props;
25
- downloadReports(accountID);
26
- };
27
-
28
- handleRestart = () => {
29
- const { restartProcess, accountID, activeTab } = this.props;
30
- restartProcess(accountID, activeTab);
31
- };
32
-
33
- handleTabChange = async tabName => {
34
- const { setActiveTab, accountID, fetchLogs } = this.props;
35
- await setActiveTab(accountID, tabName);
36
- fetchLogs(accountID);
37
- };
38
-
39
- handleToggleFullScreen = () => {
40
- const { toggleFullScreen, accountID } = this.props;
41
- toggleFullScreen(accountID);
42
- };
43
-
44
- render() {
45
- const {
46
- uploading,
47
- generating,
48
- account,
49
- showFullScreen,
50
- activeTab,
51
- } = this.props;
52
- return (
53
- <NavContainer
54
- items={[
55
- {
56
- icon: 'database',
57
- name: __('Generating'),
58
- component: ReportGenerate,
59
- props: {
60
- ...generating,
61
- restartProcess: this.handleRestart,
62
- exitCode: account.generate_report_status,
63
- toggleFullScreen: this.handleToggleFullScreen,
64
- },
65
- onClick: () => this.handleTabChange('generating'),
66
- },
67
- {
68
- icon: 'cloud-upload',
69
- name: __('Uploading'),
70
- component: ReportUpload,
71
- props: {
72
- ...uploading,
73
- restartProcess: this.handleRestart,
74
- downloadReports: this.handleDownload,
75
- exitCode: account.upload_report_status,
76
- toggleFullScreen: this.handleToggleFullScreen,
77
- },
78
- onClick: () => this.handleTabChange('uploading'),
79
- },
80
- ]}
81
- toggleFullScreen={this.handleToggleFullScreen}
82
- showFullScreen={showFullScreen}
83
- terminalProps={this.props[activeTab]}
84
- />
85
- );
86
- }
87
- }
88
-
89
- Dashboard.propTypes = {
90
- accountID: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
91
- .isRequired,
92
- startPolling: PropTypes.func,
93
- fetchLogs: PropTypes.func,
94
- stopPolling: PropTypes.func,
95
- setActiveTab: PropTypes.func,
96
- uploading: PropTypes.shape({
97
- exitCode: PropTypes.string,
98
- logs: PropTypes.oneOfType([
99
- PropTypes.arrayOf(PropTypes.string),
100
- PropTypes.string,
101
- ]),
102
- completed: PropTypes.number,
103
- files: PropTypes.arrayOf(PropTypes.string),
104
- error: PropTypes.string,
105
- }),
106
- generating: PropTypes.shape({
107
- exitCode: PropTypes.string,
108
- logs: PropTypes.oneOfType([
109
- PropTypes.arrayOf(PropTypes.string),
110
- PropTypes.string,
111
- ]),
112
- completed: PropTypes.number,
113
- error: PropTypes.string,
114
- }),
115
- restartProcess: PropTypes.func,
116
- downloadReports: PropTypes.func,
117
- pollingProcessID: PropTypes.number,
118
- account: PropTypes.shape({
119
- generate_report_status: PropTypes.string,
120
- upload_report_status: PropTypes.string,
121
- }),
122
- showFullScreen: PropTypes.bool,
123
- toggleFullScreen: PropTypes.func,
124
- activeTab: PropTypes.string,
125
- };
126
-
127
- Dashboard.defaultProps = {
128
- uploading: {},
129
- generating: {},
130
- startPolling: noop,
131
- fetchLogs: noop,
132
- stopPolling: noop,
133
- setActiveTab: noop,
134
- restartProcess: noop,
135
- downloadReports: noop,
136
- pollingProcessID: 0,
137
- account: {
138
- generate_report_status: 'unknown',
139
- upload_report_status: 'unknown',
140
- },
141
- showFullScreen: false,
142
- toggleFullScreen: noop,
143
- activeTab: 'generating',
144
- };
145
-
146
- export default Dashboard;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { withKnobs } from '@storybook/addon-knobs';
4
- import { Provider } from 'react-redux';
5
- import configureStore from '../../../stories/configureStore';
6
- import Dashboard from './index';
7
- import { generating, uploading } from './Dashboard.fixtures';
8
-
9
- const store = configureStore();
10
-
11
- storiesOf('Dashboard', module)
12
- .addDecorator(withKnobs)
13
- .add('Dashboard', () => (
14
- <div style={{ margin: '20px' }}>
15
- <Provider store={store}>
16
- <Dashboard generating={generating} uploading={uploading} />
17
- </Provider>
18
- </div>
19
- ));
@@ -1,87 +0,0 @@
1
- import API from 'foremanReact/API';
2
- import {
3
- INVENTORY_POLLING_START,
4
- INVENTORY_POLLING_STOP,
5
- INVENTORY_POLLING,
6
- INVENTORY_TAB_CHANGED,
7
- INVENTORY_POLLING_ERROR,
8
- INVENTORY_REPORTS_DOWNLOAD,
9
- INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
10
- } from './DashboardConstants';
11
- import { selectActiveTab } from './DashboardSelectors';
12
-
13
- export const startPolling = (accountID, pollingProcessID) => ({
14
- type: INVENTORY_POLLING_START,
15
- payload: {
16
- accountID,
17
- pollingProcessID,
18
- },
19
- });
20
-
21
- export const stopPolling = (accountID, pollingProcessID) => dispatch => {
22
- clearInterval(pollingProcessID);
23
- dispatch({
24
- type: INVENTORY_POLLING_STOP,
25
- payload: {
26
- accountID,
27
- },
28
- });
29
- };
30
-
31
- export const fetchLogs = accountID => async (dispatch, getState) => {
32
- const activeTab = selectActiveTab(getState(), accountID);
33
- try {
34
- const processController = activeTab === 'uploading' ? 'uploads' : 'reports';
35
- const {
36
- data: { output, scheduled },
37
- } = await API.get(`${accountID}/${processController}/last`);
38
- const outputArray = output.split('\n');
39
- dispatch({
40
- type: INVENTORY_POLLING,
41
- payload: {
42
- accountID,
43
- activeTab,
44
- logs: outputArray,
45
- scheduled,
46
- },
47
- });
48
- } catch (error) {
49
- dispatch({
50
- type: INVENTORY_POLLING_ERROR,
51
- payload: {
52
- accountID,
53
- activeTab,
54
- error: error.message,
55
- },
56
- });
57
- }
58
- };
59
-
60
- export const setActiveTab = (accountID, tabName) => ({
61
- type: INVENTORY_TAB_CHANGED,
62
- payload: {
63
- accountID,
64
- activeTab: tabName,
65
- },
66
- });
67
-
68
- export const downloadReports = accountID => {
69
- window.location.href = `/foreman_inventory_upload/${accountID}/uploads/file`;
70
- return {
71
- type: INVENTORY_REPORTS_DOWNLOAD,
72
- payload: {
73
- accountID,
74
- },
75
- };
76
- };
77
-
78
- export const toggleFullScreen = accountID => (dispatch, getState) => {
79
- const activeTab = selectActiveTab(getState(), accountID);
80
- dispatch({
81
- type: INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
82
- payload: {
83
- activeTab,
84
- accountID,
85
- },
86
- });
87
- };
@@ -1,9 +0,0 @@
1
- export const INVENTORY_POLLING = 'INVENTORY_POLLING';
2
- export const INVENTORY_POLLING_START = 'INVENTORY_POLLING_START';
3
- export const INVENTORY_POLLING_STOP = 'INVENTORY_POLLING_STOP';
4
- export const INVENTORY_POLLING_ERROR = 'INVENTORY_POLLING_ERROR';
5
- export const INVENTORY_TAB_CHANGED = 'INVENTORY_TAB_CHANGED';
6
- export const INVENTORY_REPORTS_DOWNLOAD = 'INVENTORY_REPORTS_DOWNLOAD';
7
- export const INVENTORY_PROCESS_RESTART = 'INVENTORY_PROCESS_RESTART';
8
- export const INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN =
9
- 'INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN';