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,68 +0,0 @@
1
- import Immutable from 'seamless-immutable';
2
-
3
- import {
4
- INVENTORY_POLLING_START,
5
- INVENTORY_POLLING,
6
- INVENTORY_TAB_CHANGED,
7
- INVENTORY_POLLING_ERROR,
8
- INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
9
- } from './DashboardConstants';
10
-
11
- const initialState = Immutable({});
12
-
13
- export default (state = initialState, action) => {
14
- const {
15
- payload: {
16
- accountID,
17
- pollingProcessID,
18
- logs,
19
- error,
20
- activeTab,
21
- scheduled,
22
- } = {},
23
- } = action;
24
-
25
- const getTabState = () =>
26
- state[accountID] ? state[accountID][activeTab] : {};
27
- switch (action.type) {
28
- case INVENTORY_POLLING_START:
29
- return state.setIn([accountID], {
30
- ...state[accountID],
31
- pollingProcessID,
32
- activeTab: 'generating',
33
- });
34
- case INVENTORY_POLLING:
35
- return state.setIn([accountID], {
36
- ...state[accountID],
37
- [activeTab]: {
38
- ...getTabState(),
39
- logs,
40
- scheduled,
41
- error: null,
42
- },
43
- });
44
- case INVENTORY_TAB_CHANGED:
45
- return state.setIn([accountID], {
46
- ...state[accountID],
47
- activeTab,
48
- });
49
- case INVENTORY_POLLING_ERROR:
50
- return state.setIn([accountID], {
51
- ...state[accountID],
52
- [activeTab]: {
53
- ...getTabState(),
54
- error,
55
- },
56
- });
57
- case INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN:
58
- return state.setIn([accountID], {
59
- ...state[accountID],
60
- [activeTab]: {
61
- ...getTabState(),
62
- showFullScreen: !state[accountID][activeTab].showFullScreen,
63
- },
64
- });
65
- default:
66
- return state;
67
- }
68
- };
@@ -1,17 +0,0 @@
1
- import { selectForemanInventoryUpload } from '../../ForemanInventoryUploadSelectors';
2
-
3
- export const selectDashboard = (state, accountID) =>
4
- selectForemanInventoryUpload(state).dashboard[accountID] || {};
5
- export const selectUploading = (state, accountID) =>
6
- selectDashboard(state, accountID).uploading;
7
- export const selectGenerating = (state, accountID) =>
8
- selectDashboard(state, accountID).generating;
9
- export const selectPollingProcessID = (state, accountID) =>
10
- selectDashboard(state, accountID).pollingProcessID;
11
- export const selectActiveTab = (state, accountID) =>
12
- selectDashboard(state, accountID).activeTab || 'generating';
13
- export const selectShowFullScreen = (state, accountID) => {
14
- const activeTab = selectActiveTab(state, accountID);
15
- const tabProperties = selectDashboard(state, accountID)[activeTab];
16
- return tabProperties ? tabProperties.showFullScreen || false : false;
17
- };
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
4
- import Dashboard from '../Dashboard';
5
- import { props } from '../Dashboard.fixtures';
6
-
7
- const fixtures = {
8
- 'with props': props,
9
- };
10
-
11
- describe('Dashboard', () => {
12
- describe('rendering', () =>
13
- testComponentSnapshotsWithFixtures(Dashboard, fixtures));
14
-
15
- it('componentWillUnmount should call "stopPolling"', () => {
16
- const stopPolling = jest.fn();
17
- const modifiedProps = {
18
- ...props,
19
- stopPolling,
20
- };
21
- const wrapper = shallow(<Dashboard {...modifiedProps} />);
22
- wrapper.unmount();
23
- expect(stopPolling).toBeCalled();
24
- });
25
- });
@@ -1,39 +0,0 @@
1
- import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
2
- import API from 'foremanReact/API';
3
- import {
4
- startPolling,
5
- stopPolling,
6
- fetchLogs,
7
- setActiveTab,
8
- downloadReports,
9
- toggleFullScreen,
10
- } from '../DashboardActions';
11
- import {
12
- pollingProcessID,
13
- serverMock,
14
- activeTab,
15
- accountID,
16
- } from '../Dashboard.fixtures';
17
-
18
- jest.mock('foremanReact/API');
19
- API.get.mockImplementation(() => serverMock);
20
-
21
- const runWithGetState = (state, action, params) => dispatch => {
22
- const getState = () => ({
23
- dashboard: state,
24
- });
25
- action(params)(dispatch, getState);
26
- };
27
-
28
- const fixtures = {
29
- 'should startPolling': () => startPolling(accountID, pollingProcessID),
30
- 'should fetchLogs': () =>
31
- runWithGetState({ activeTab: 'uploads' }, fetchLogs, accountID),
32
- 'should stopPolling': () => stopPolling(accountID, pollingProcessID),
33
- 'should setActiveTab': () => setActiveTab(accountID, activeTab),
34
- 'should downloadReports': () => downloadReports(accountID),
35
- 'should toggleFullScreen': () =>
36
- runWithGetState({ activeTab: 'reports' }, toggleFullScreen, accountID),
37
- };
38
-
39
- describe('Dashboard actions', () => testActionSnapshotWithFixtures(fixtures));
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { IntegrationTestHelper } from 'react-redux-test-utils';
3
-
4
- import Dashboard, { reducers } from '../index';
5
- import { accountID } from '../Dashboard.fixtures';
6
-
7
- describe('Dashboard integration test', () => {
8
- it('should flow', async () => {
9
- const integrationTestHelper = new IntegrationTestHelper(reducers);
10
- const component = integrationTestHelper.mount(
11
- <Dashboard accountID={accountID} />
12
- );
13
- component.update();
14
- /** Create a Flow test */
15
- });
16
- });
@@ -1,64 +0,0 @@
1
- import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
-
3
- import {
4
- INVENTORY_POLLING_START,
5
- INVENTORY_POLLING,
6
- INVENTORY_TAB_CHANGED,
7
- INVENTORY_POLLING_ERROR,
8
- } from '../DashboardConstants';
9
- import reducer from '../DashboardReducer';
10
- import {
11
- pollingProcessID,
12
- logs,
13
- initialState,
14
- activeTab,
15
- error,
16
- accountID,
17
- scheduled,
18
- } from '../Dashboard.fixtures';
19
-
20
- const fixtures = {
21
- 'should return the initial state': initialState,
22
- 'should handle INVENTORY_POLLING_START': {
23
- action: {
24
- type: INVENTORY_POLLING_START,
25
- payload: {
26
- pollingProcessID,
27
- accountID,
28
- },
29
- },
30
- },
31
- 'should handle INVENTORY_POLLING': {
32
- action: {
33
- type: INVENTORY_POLLING,
34
- payload: {
35
- logs,
36
- accountID,
37
- activeTab,
38
- scheduled,
39
- },
40
- },
41
- },
42
- 'should handle INVENTORY_TAB_CHANGED': {
43
- action: {
44
- type: INVENTORY_TAB_CHANGED,
45
- payload: {
46
- activeTab,
47
- accountID,
48
- },
49
- },
50
- },
51
- 'should handle INVENTORY_POLLING_ERROR': {
52
- action: {
53
- type: INVENTORY_POLLING_ERROR,
54
- payload: {
55
- error,
56
- accountID,
57
- activeTab,
58
- },
59
- },
60
- },
61
- };
62
-
63
- describe('Dashboard reducer', () =>
64
- testReducerSnapshotWithFixtures(reducer, fixtures));
@@ -1,45 +0,0 @@
1
- import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
- import {
3
- selectDashboard,
4
- selectPollingProcessID,
5
- selectActiveTab,
6
- selectUploading,
7
- selectGenerating,
8
- } from '../DashboardSelectors';
9
- import {
10
- logs,
11
- completed,
12
- pollingProcessID,
13
- activeTab,
14
- accountID,
15
- } from '../Dashboard.fixtures';
16
-
17
- const state = {
18
- dashboard: {
19
- [accountID]: {
20
- generating: {
21
- logs,
22
- completed,
23
- },
24
- uploading: {
25
- logs,
26
- completed,
27
- },
28
- activeTab,
29
- pollingProcessID,
30
- },
31
- },
32
- };
33
-
34
- const fixtures = {
35
- 'should return Dashboard': () => selectDashboard(state, accountID),
36
- 'should return Dashboard uploading': () => selectUploading(state, accountID),
37
- 'should return Dashboard generating': () =>
38
- selectGenerating(state, accountID),
39
- 'should return Dashboard pollingProcessID': () =>
40
- selectPollingProcessID(state, accountID),
41
- 'should return Dashboard activeTab': () => selectActiveTab(state, accountID),
42
- };
43
-
44
- describe('Dashboard selectors', () =>
45
- testSelectorsSnapshotWithFixtures(fixtures));
@@ -1,36 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Dashboard rendering with props 1`] = `
4
- <NavContainer
5
- items={
6
- Array [
7
- Object {
8
- "component": [Function],
9
- "icon": "database",
10
- "name": "Generating",
11
- "onClick": [Function],
12
- "props": Object {
13
- "exitCode": "unknown",
14
- "restartProcess": [Function],
15
- "toggleFullScreen": [Function],
16
- },
17
- },
18
- Object {
19
- "component": [Function],
20
- "icon": "cloud-upload",
21
- "name": "Uploading",
22
- "onClick": [Function],
23
- "props": Object {
24
- "downloadReports": [Function],
25
- "exitCode": "unknown",
26
- "restartProcess": [Function],
27
- "toggleFullScreen": [Function],
28
- },
29
- },
30
- ]
31
- }
32
- showFullScreen={false}
33
- terminalProps={Object {}}
34
- toggleFullScreen={[Function]}
35
- />
36
- `;
@@ -1,76 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Dashboard actions should downloadReports 1`] = `
4
- Object {
5
- "payload": Object {
6
- "accountID": "some-account-ID",
7
- },
8
- "type": "INVENTORY_REPORTS_DOWNLOAD",
9
- }
10
- `;
11
-
12
- exports[`Dashboard actions should fetchLogs 1`] = `
13
- Array [
14
- Array [
15
- Object {
16
- "payload": Object {
17
- "accountID": "some-account-ID",
18
- "activeTab": "generating",
19
- "logs": Array [
20
- "some-logs",
21
- "some-logs",
22
- ],
23
- "scheduled": "2019-08-21T16:14:16.520+03:00",
24
- },
25
- "type": "INVENTORY_POLLING",
26
- },
27
- ],
28
- ]
29
- `;
30
-
31
- exports[`Dashboard actions should setActiveTab 1`] = `
32
- Object {
33
- "payload": Object {
34
- "accountID": "some-account-ID",
35
- "activeTab": "uploads",
36
- },
37
- "type": "INVENTORY_TAB_CHANGED",
38
- }
39
- `;
40
-
41
- exports[`Dashboard actions should startPolling 1`] = `
42
- Object {
43
- "payload": Object {
44
- "accountID": "some-account-ID",
45
- "pollingProcessID": 1,
46
- },
47
- "type": "INVENTORY_POLLING_START",
48
- }
49
- `;
50
-
51
- exports[`Dashboard actions should stopPolling 1`] = `
52
- Array [
53
- Array [
54
- Object {
55
- "payload": Object {
56
- "accountID": "some-account-ID",
57
- },
58
- "type": "INVENTORY_POLLING_STOP",
59
- },
60
- ],
61
- ]
62
- `;
63
-
64
- exports[`Dashboard actions should toggleFullScreen 1`] = `
65
- Array [
66
- Array [
67
- Object {
68
- "payload": Object {
69
- "accountID": "some-account-ID",
70
- "activeTab": "generating",
71
- },
72
- "type": "INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN",
73
- },
74
- ],
75
- ]
76
- `;
@@ -1,44 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Dashboard reducer should handle INVENTORY_POLLING 1`] = `
4
- Object {
5
- "some-account-ID": Object {
6
- "uploads": Object {
7
- "error": null,
8
- "logs": Array [
9
- "some-logs...",
10
- ],
11
- "scheduled": "2019-08-21T16:14:16.520+03:00",
12
- },
13
- },
14
- }
15
- `;
16
-
17
- exports[`Dashboard reducer should handle INVENTORY_POLLING_ERROR 1`] = `
18
- Object {
19
- "some-account-ID": Object {
20
- "uploads": Object {
21
- "error": "some-error",
22
- },
23
- },
24
- }
25
- `;
26
-
27
- exports[`Dashboard reducer should handle INVENTORY_POLLING_START 1`] = `
28
- Object {
29
- "some-account-ID": Object {
30
- "activeTab": "generating",
31
- "pollingProcessID": 1,
32
- },
33
- }
34
- `;
35
-
36
- exports[`Dashboard reducer should handle INVENTORY_TAB_CHANGED 1`] = `
37
- Object {
38
- "some-account-ID": Object {
39
- "activeTab": "uploads",
40
- },
41
- }
42
- `;
43
-
44
- exports[`Dashboard reducer should return the initial state 1`] = `Object {}`;
@@ -1,42 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Dashboard selectors should return Dashboard 1`] = `
4
- Object {
5
- "activeTab": "uploads",
6
- "generating": Object {
7
- "completed": 25,
8
- "logs": Array [
9
- "some-logs...",
10
- ],
11
- },
12
- "pollingProcessID": 1,
13
- "uploading": Object {
14
- "completed": 25,
15
- "logs": Array [
16
- "some-logs...",
17
- ],
18
- },
19
- }
20
- `;
21
-
22
- exports[`Dashboard selectors should return Dashboard activeTab 1`] = `"uploads"`;
23
-
24
- exports[`Dashboard selectors should return Dashboard generating 1`] = `
25
- Object {
26
- "completed": 25,
27
- "logs": Array [
28
- "some-logs...",
29
- ],
30
- }
31
- `;
32
-
33
- exports[`Dashboard selectors should return Dashboard pollingProcessID 1`] = `1`;
34
-
35
- exports[`Dashboard selectors should return Dashboard uploading 1`] = `
36
- Object {
37
- "completed": 25,
38
- "logs": Array [
39
- "some-logs...",
40
- ],
41
- }
42
- `;
@@ -1,34 +0,0 @@
1
- import { bindActionCreators } from 'redux';
2
- import { connect } from 'react-redux';
3
-
4
- import * as actions from './DashboardActions';
5
- import { restartProcess } from '../AccountList/AccountListActions';
6
- import reducer from './DashboardReducer';
7
-
8
- import Dashboard from './Dashboard';
9
- import {
10
- selectUploading,
11
- selectGenerating,
12
- selectPollingProcessID,
13
- selectActiveTab,
14
- selectShowFullScreen,
15
- } from './DashboardSelectors';
16
-
17
- // map state to props
18
- const mapStateToProps = (state, { accountID }) => ({
19
- uploading: selectUploading(state, accountID),
20
- generating: selectGenerating(state, accountID),
21
- pollingProcessID: selectPollingProcessID(state, accountID),
22
- activeTab: selectActiveTab(state, accountID),
23
- showFullScreen: selectShowFullScreen(state, accountID),
24
- });
25
-
26
- // map action dispatchers to props
27
- const mapDispatchToProps = dispatch =>
28
- bindActionCreators({ ...actions, restartProcess }, dispatch);
29
-
30
- // export reducers
31
- export const reducers = { dashboard: reducer };
32
-
33
- // export connected component
34
- export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { noop, Grid, Button, Icon } from 'patternfly-react';
4
- import './fileDownload.scss';
5
-
6
- const FileDownload = ({ onClick }) => (
7
- <Grid.Col sm={12}>
8
- <Button onClick={onClick} className="download-button">
9
- Download Report <Icon name="download" />
10
- </Button>
11
- </Grid.Col>
12
- );
13
-
14
- FileDownload.propTypes = {
15
- onClick: PropTypes.func,
16
- };
17
-
18
- FileDownload.defaultProps = {
19
- onClick: noop,
20
- };
21
-
22
- export default FileDownload;
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import FileDownload from '../FileDownload';
4
-
5
- const fixtures = {
6
- 'render without Props': {},
7
- /** fixtures, props for the component */
8
- };
9
-
10
- describe('FileDownload', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(FileDownload, fixtures));
13
- });
@@ -1,25 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`FileDownload rendering render without Props 1`] = `
4
- <Col
5
- bsClass="col"
6
- componentClass="div"
7
- sm={12}
8
- >
9
- <Button
10
- active={false}
11
- block={false}
12
- bsClass="btn"
13
- bsStyle="default"
14
- className="download-button"
15
- disabled={false}
16
- onClick={[Function]}
17
- >
18
- Download Report
19
- <Icon
20
- name="download"
21
- type="fa"
22
- />
23
- </Button>
24
- </Col>
25
- `;
@@ -1,3 +0,0 @@
1
- button {
2
- float: right;
3
- }
@@ -1 +0,0 @@
1
- export { default } from './FileDownload';
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Modal, Icon, noop } from 'patternfly-react';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
- import Terminal from '../Terminal';
6
- import './fullScreenModal.scss';
7
-
8
- const FullScreenModal = ({
9
- showFullScreen,
10
- toggleFullScreen,
11
- terminalProps,
12
- }) => (
13
- <Modal show={showFullScreen} onHide={toggleFullScreen}>
14
- <Modal.Header>
15
- <button
16
- className="close"
17
- onClick={toggleFullScreen}
18
- aria-hidden="true"
19
- aria-label="Close"
20
- >
21
- <Icon type="pf" name="close" />
22
- </button>
23
- <Modal.Title>{__('Full Screen')}</Modal.Title>
24
- </Modal.Header>
25
- <Modal.Body>
26
- <Terminal autoScroll={false} {...terminalProps} />
27
- </Modal.Body>
28
- </Modal>
29
- );
30
-
31
- FullScreenModal.propTypes = {
32
- showFullScreen: PropTypes.bool,
33
- toggleFullScreen: PropTypes.func,
34
- terminalProps: PropTypes.shape({
35
- exitCode: PropTypes.string,
36
- logs: PropTypes.oneOfType([
37
- PropTypes.arrayOf(PropTypes.string),
38
- PropTypes.string,
39
- ]),
40
- error: PropTypes.string,
41
- }),
42
- };
43
-
44
- FullScreenModal.defaultProps = {
45
- showFullScreen: false,
46
- toggleFullScreen: noop,
47
- terminalProps: {},
48
- };
49
-
50
- export default FullScreenModal;
@@ -1,13 +0,0 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
-
3
- import FullScreenModal from '../FullScreenModal';
4
-
5
- const fixtures = {
6
- 'render without Props': {},
7
- /** fixtures, props for the component */
8
- };
9
-
10
- describe('FullScreenModal', () => {
11
- describe('rendering', () =>
12
- testComponentSnapshotsWithFixtures(FullScreenModal, fixtures));
13
- });