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,18 +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 AccountList from './AccountList';
7
-
8
- const store = configureStore();
9
-
10
- storiesOf('Account list', module)
11
- .addDecorator(withKnobs)
12
- .add('Account list', () => (
13
- <div style={{ margin: '20px' }}>
14
- <Provider store={store}>
15
- <AccountList />
16
- </Provider>
17
- </div>
18
- ));
@@ -1,65 +0,0 @@
1
- import API from 'foremanReact/API';
2
- import {
3
- INVENTORY_ACCOUNT_STATUS_POLLING,
4
- INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
5
- INVENTORY_ACCOUNT_STATUS_POLLING_START,
6
- INVENTORY_ACCOUNT_STATUS_POLLING_STOP,
7
- INVENTORY_PROCESS_RESTART,
8
- } from './AccountListConstants';
9
-
10
- export const fetchAccountsStatus = () => async dispatch => {
11
- try {
12
- const {
13
- data: { accounts },
14
- } = await API.get('accounts');
15
- dispatch({
16
- type: INVENTORY_ACCOUNT_STATUS_POLLING,
17
- payload: {
18
- accounts,
19
- },
20
- });
21
- } catch (error) {
22
- dispatch({
23
- type: INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
24
- payload: {
25
- error: error.message,
26
- },
27
- });
28
- }
29
- };
30
-
31
- export const startAccountStatusPolling = pollingProcessID => ({
32
- type: INVENTORY_ACCOUNT_STATUS_POLLING_START,
33
- payload: {
34
- pollingProcessID,
35
- },
36
- });
37
-
38
- export const stopAccountStatusPolling = pollingProcessID => dispatch => {
39
- clearInterval(pollingProcessID);
40
- dispatch({
41
- type: INVENTORY_ACCOUNT_STATUS_POLLING_STOP,
42
- });
43
- };
44
-
45
- export const restartProcess = (accountID, activeTab) => dispatch => {
46
- let processController = null;
47
- let processStatusName = null;
48
-
49
- if (activeTab === 'uploading') {
50
- processController = 'uploads';
51
- processStatusName = 'upload_report_status';
52
- } else {
53
- processController = 'reports';
54
- processStatusName = 'generate_report_status';
55
- }
56
-
57
- API.post(`${accountID}/${processController}`);
58
- dispatch({
59
- type: INVENTORY_PROCESS_RESTART,
60
- payload: {
61
- accountID,
62
- processStatusName,
63
- },
64
- });
65
- };
@@ -1,9 +0,0 @@
1
- export const INVENTORY_ACCOUNT_STATUS_POLLING =
2
- 'INVENTORY_ACCOUNT_STATUS_POLLING';
3
- export const INVENTORY_ACCOUNT_STATUS_POLLING_ERROR =
4
- 'INVENTORY_ACCOUNT_STATUS_POLLING_ERROR';
5
- export const INVENTORY_ACCOUNT_STATUS_POLLING_START =
6
- 'INVENTORY_ACCOUNT_STATUS_POLLING_START';
7
- export const INVENTORY_ACCOUNT_STATUS_POLLING_STOP =
8
- 'INVENTORY_ACCOUNT_STATUS_POLLING_STOP';
9
- export const INVENTORY_PROCESS_RESTART = 'INVENTORY_PROCESS_RESTART';
@@ -1,55 +0,0 @@
1
- import Immutable from 'seamless-immutable';
2
- import {
3
- INVENTORY_ACCOUNT_STATUS_POLLING,
4
- INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
5
- INVENTORY_ACCOUNT_STATUS_POLLING_START,
6
- INVENTORY_PROCESS_RESTART,
7
- } from './AccountListConstants';
8
-
9
- const initialState = Immutable({
10
- accounts: {},
11
- pollingProcessID: 0,
12
- error: null,
13
- });
14
-
15
- export default (state = initialState, action) => {
16
- const {
17
- payload: {
18
- pollingProcessID,
19
- error,
20
- accounts,
21
- accountID,
22
- processStatusName,
23
- } = {},
24
- } = action;
25
-
26
- switch (action.type) {
27
- case INVENTORY_ACCOUNT_STATUS_POLLING:
28
- return state.merge({
29
- ...state,
30
- accounts,
31
- error: null,
32
- });
33
- case INVENTORY_ACCOUNT_STATUS_POLLING_ERROR:
34
- return state.merge({
35
- ...state,
36
- accounts: {},
37
- error,
38
- });
39
- case INVENTORY_ACCOUNT_STATUS_POLLING_START:
40
- return state.merge({
41
- ...state,
42
- pollingProcessID,
43
- });
44
- case INVENTORY_PROCESS_RESTART:
45
- return state.setIn(['accounts'], {
46
- ...state.accounts,
47
- [accountID]: {
48
- ...state.accounts[accountID],
49
- [processStatusName]: 'Restarting...',
50
- },
51
- });
52
- default:
53
- return state;
54
- }
55
- };
@@ -1,8 +0,0 @@
1
- import { selectForemanInventoryUpload } from '../../ForemanInventoryUploadSelectors';
2
-
3
- export const selectAccountsList = state =>
4
- selectForemanInventoryUpload(state).accountsList;
5
- export const selectAccounts = state => selectAccountsList(state).accounts;
6
- export const selectPollingProcessID = state =>
7
- selectAccountsList(state).pollingProcessID;
8
- export const selectError = state => selectAccountsList(state).error;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { EmptyState, Spinner } from 'patternfly-react';
3
- import { translate as __ } from 'foremanReact/common/I18n';
4
- import './emptyState.scss';
5
-
6
- const inventoryEmptyState = () => (
7
- <EmptyState>
8
- <Spinner loading inline size="lg" />
9
- <EmptyState.Title>
10
- {__('Fetching data about your accounts')}
11
- </EmptyState.Title>
12
- <EmptyState.Info>{__('Loading')}...</EmptyState.Info>
13
- </EmptyState>
14
- );
15
-
16
- export default inventoryEmptyState;
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import EmptyState from '../EmptyState';
4
-
5
- const fixtures = {
6
- 'render without Props': {},
7
- /** fixtures, props for the component */
8
- };
9
-
10
- describe('EmptyState', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(EmptyState, fixtures));
13
- });
@@ -1,26 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`EmptyState rendering render without Props 1`] = `
4
- <EmptyState
5
- className=""
6
- >
7
- <Spinner
8
- className=""
9
- inline={true}
10
- inverse={false}
11
- loading={true}
12
- size="lg"
13
- />
14
- <EmptyStateTitle
15
- className=""
16
- >
17
- Fetching data about your accounts
18
- </EmptyStateTitle>
19
- <EmptyStateInfo
20
- className=""
21
- >
22
- Loading
23
- ...
24
- </EmptyStateInfo>
25
- </EmptyState>
26
- `;
@@ -1,7 +0,0 @@
1
- .blank-slate-pf {
2
- margin-top: 100px;
3
-
4
- .spinner {
5
- float: none;
6
- }
7
- }
@@ -1 +0,0 @@
1
- export { default } from './EmptyState';
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Icon } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import './errorState.scss';
6
-
7
- const ErrorState = ({ error }) => (
8
- <div className="error_state">
9
- <Icon className="error_icon" name="times" size="2x" />
10
- <p>{__('Encountered an error while trying to access the server:')}</p>
11
- <p className="error_description">{error}</p>
12
- </div>
13
- );
14
-
15
- ErrorState.propTypes = {
16
- error: PropTypes.string,
17
- };
18
-
19
- ErrorState.defaultProps = {
20
- error: '',
21
- };
22
-
23
- export default ErrorState;
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import ErrorState from '../ErrorState';
4
-
5
- const fixtures = {
6
- 'render without Props': {},
7
- /** fixtures, props for the component */
8
- };
9
-
10
- describe('ErrorState', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(ErrorState, fixtures));
13
- });
@@ -1,20 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ErrorState rendering render without Props 1`] = `
4
- <div
5
- className="error_state"
6
- >
7
- <Icon
8
- className="error_icon"
9
- name="times"
10
- size="2x"
11
- type="fa"
12
- />
13
- <p>
14
- Encountered an error while trying to access the server:
15
- </p>
16
- <p
17
- className="error_description"
18
- />
19
- </div>
20
- `;
@@ -1,18 +0,0 @@
1
- $error_color: #d10d0d;
2
-
3
- .error_state {
4
- margin-top: 100px;
5
- text-align: center;
6
- font-weight: bold;
7
- font-size: 16px;
8
-
9
- .error_icon {
10
- color: $error_color;
11
- margin-right: 15px;
12
- margin-bottom: 10px;
13
- }
14
-
15
- .error_description {
16
- color: $error_color;
17
- }
18
- }
@@ -1 +0,0 @@
1
- export { default } from './ErrorState';
@@ -1 +0,0 @@
1
- export const props = { accountID: '1' };
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { ListView } from 'patternfly-react';
3
- import PropTypes from 'prop-types';
4
- import ListItemStatus from '../ListItemStatus';
5
- import Dashboard from '../../../Dashboard';
6
-
7
- const ListItem = ({ accountID, account, initExpanded }) => (
8
- <ListView.Item
9
- leftContent={<ListView.Icon name="user" />}
10
- heading={account.label}
11
- additionalInfo={[
12
- <ListItemStatus key={`${accountID}_status`} account={account} />,
13
- ]}
14
- stacked
15
- hideCloseIcon
16
- initExpanded={initExpanded}
17
- >
18
- <Dashboard accountID={accountID} account={account} />
19
- </ListView.Item>
20
- );
21
-
22
- ListItem.propTypes = {
23
- accountID: PropTypes.string.isRequired,
24
- account: PropTypes.shape({
25
- generate_report_status: PropTypes.string,
26
- upload_report_status: PropTypes.string,
27
- label: PropTypes.string,
28
- }),
29
- initExpanded: PropTypes.bool,
30
- };
31
-
32
- ListItem.defaultProps = {
33
- account: {
34
- generate_report_status: 'unknown',
35
- upload_report_status: 'unknown',
36
- label: 'default_org_name',
37
- },
38
- initExpanded: false,
39
- };
40
-
41
- export default ListItem;
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import ListItem from '../ListItem';
4
- import { props } from '../ListItem.fixtures';
5
-
6
- const fixtures = {
7
- 'render with Props': props,
8
- };
9
-
10
- describe('ListItem', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(ListItem, fixtures));
13
- });
@@ -1,50 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ListItem rendering render with Props 1`] = `
4
- <ListViewItem
5
- actions={null}
6
- additionalInfo={
7
- Array [
8
- <ListItemStatus
9
- account={
10
- Object {
11
- "generate_report_status": "unknown",
12
- "label": "default_org_name",
13
- "upload_report_status": "unknown",
14
- }
15
- }
16
- />,
17
- ]
18
- }
19
- checkboxInput={null}
20
- compoundExpand={false}
21
- compoundExpanded={false}
22
- description={null}
23
- heading="default_org_name"
24
- hideCloseIcon={true}
25
- initExpanded={false}
26
- leftContent={
27
- <ListViewIcon
28
- className=""
29
- name="user"
30
- size="sm"
31
- type="fa"
32
- />
33
- }
34
- onCloseCompoundExpand={[Function]}
35
- onExpand={[Function]}
36
- onExpandClose={[Function]}
37
- stacked={true}
38
- >
39
- <Connect(Dashboard)
40
- account={
41
- Object {
42
- "generate_report_status": "unknown",
43
- "label": "default_org_name",
44
- "upload_report_status": "unknown",
45
- }
46
- }
47
- accountID="1"
48
- />
49
- </ListViewItem>
50
- `;
@@ -1 +0,0 @@
1
- export { default } from './ListItem';
@@ -1,7 +0,0 @@
1
- export const props = {
2
- account: {
3
- generate_report_status: 'Exit Code: pid 22191 exit 0',
4
- upload_report_status: 'Exit Code: Running in pid 22376',
5
- label: 'Default Org',
6
- },
7
- };
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import { Grid } from 'patternfly-react';
3
- import PropTypes from 'prop-types';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import './listItemStatus.scss';
6
- import { getStatusIconByRegex } from './ListItemStatusHelper';
7
-
8
- const ListItemStatus = ({ account }) => {
9
- const generatingStatusIcon = getStatusIconByRegex(
10
- account.generate_report_status
11
- );
12
- const uploadingStatusIcon = getStatusIconByRegex(
13
- account.upload_report_status
14
- );
15
- return (
16
- <Grid className="status">
17
- <Grid.Col sm={6} className="item">
18
- <p>{__('Generating')}</p>
19
- {generatingStatusIcon}
20
- </Grid.Col>
21
- <Grid.Col sm={6} className="item">
22
- <p>{__('Uploading')}</p>
23
- {uploadingStatusIcon}
24
- </Grid.Col>
25
- </Grid>
26
- );
27
- };
28
-
29
- ListItemStatus.propTypes = {
30
- account: PropTypes.shape({
31
- generate_report_status: PropTypes.string,
32
- upload_report_status: PropTypes.string,
33
- }),
34
- };
35
-
36
- ListItemStatus.defaultProps = {
37
- account: {
38
- generate_report_status: 'unknown',
39
- uploupload_report_statusading: 'unknown',
40
- },
41
- };
42
-
43
- export default ListItemStatus;
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import { Icon, Spinner } from 'patternfly-react';
3
-
4
- const STATUS_ICONS = {
5
- success: <Icon name="check" />,
6
- failure: <Icon name="times" />,
7
- running: <Spinner loading inline size="xs" />,
8
- unknown: <span>--</span>,
9
- };
10
-
11
- export const getStatusIconByRegex = status => {
12
- if (!status || status === 'unknown') {
13
- return STATUS_ICONS.unknown;
14
- }
15
-
16
- const statusCopy = status.toLowerCase();
17
- if (statusCopy.indexOf('exit 0') !== -1) {
18
- return STATUS_ICONS.success;
19
- }
20
-
21
- if (
22
- statusCopy.indexOf('running') !== -1 ||
23
- statusCopy.indexOf('restarting') !== -1
24
- ) {
25
- return STATUS_ICONS.running;
26
- }
27
-
28
- return STATUS_ICONS.failure;
29
- };
@@ -1,14 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import ListItemStatus from '../ListItemStatus';
4
- import { props } from '../ListItemStatus.fixtures';
5
-
6
- const fixtures = {
7
- 'render without Props': {},
8
- 'render with Props': props,
9
- };
10
-
11
- describe('ListItemStatus', () => {
12
- describe('rendering', () =>
13
- testComponentSnapshotsWithFixtures(ListItemStatus, fixtures));
14
- });
@@ -1,78 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ListItemStatus rendering render with Props 1`] = `
4
- <Grid
5
- bsClass="container"
6
- className="status"
7
- componentClass="div"
8
- fluid={false}
9
- >
10
- <Col
11
- bsClass="col"
12
- className="item"
13
- componentClass="div"
14
- sm={6}
15
- >
16
- <p>
17
- Generating
18
- </p>
19
- <Icon
20
- name="check"
21
- type="fa"
22
- />
23
- </Col>
24
- <Col
25
- bsClass="col"
26
- className="item"
27
- componentClass="div"
28
- sm={6}
29
- >
30
- <p>
31
- Uploading
32
- </p>
33
- <Spinner
34
- className=""
35
- inline={true}
36
- inverse={false}
37
- loading={true}
38
- size="xs"
39
- />
40
- </Col>
41
- </Grid>
42
- `;
43
-
44
- exports[`ListItemStatus rendering render without Props 1`] = `
45
- <Grid
46
- bsClass="container"
47
- className="status"
48
- componentClass="div"
49
- fluid={false}
50
- >
51
- <Col
52
- bsClass="col"
53
- className="item"
54
- componentClass="div"
55
- sm={6}
56
- >
57
- <p>
58
- Generating
59
- </p>
60
- <span>
61
- --
62
- </span>
63
- </Col>
64
- <Col
65
- bsClass="col"
66
- className="item"
67
- componentClass="div"
68
- sm={6}
69
- >
70
- <p>
71
- Uploading
72
- </p>
73
- <span>
74
- --
75
- </span>
76
- </Col>
77
- </Grid>
78
- `;
@@ -1 +0,0 @@
1
- export { default } from './ListItemStatus';
@@ -1,16 +0,0 @@
1
- .status {
2
- max-width: 250px;
3
-
4
- .item {
5
- text-align: center;
6
- font-weight: 600;
7
-
8
- p {
9
- margin: auto;
10
- }
11
- }
12
-
13
- .spinner {
14
- float: none;
15
- }
16
- }
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import AccountList from '../AccountList';
4
- import { props } from '../AccountList.fixtures';
5
-
6
- const fixtures = {
7
- 'render with props': props,
8
- };
9
-
10
- describe('AccountList', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(AccountList, fixtures));
13
- });