foreman_inventory_upload 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/lib/foreman_inventory_upload/version.rb +1 -1
  3. data/package.json +124 -0
  4. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +34 -0
  5. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +72 -0
  6. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +18 -0
  7. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +65 -0
  8. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js +9 -0
  9. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +0 -0
  10. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +55 -0
  11. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +8 -0
  12. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js +0 -0
  13. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +16 -0
  14. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js +0 -0
  15. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +13 -0
  16. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +26 -0
  17. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +7 -0
  18. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/index.js +1 -0
  19. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.fixtures.js +0 -0
  20. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +23 -0
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorStateHelper.js +0 -0
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +13 -0
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap +20 -0
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +18 -0
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/index.js +1 -0
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +1 -0
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +39 -0
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js +0 -0
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +13 -0
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +48 -0
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/index.js +1 -0
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +6 -0
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +43 -0
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +29 -0
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +14 -0
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +78 -0
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/index.js +1 -0
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +16 -0
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +13 -0
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +20 -0
  42. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +14 -0
  43. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +60 -0
  44. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +26 -0
  45. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +41 -0
  46. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +47 -0
  47. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +66 -0
  48. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +40 -0
  49. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +9 -0
  50. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +30 -0
  51. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +50 -0
  52. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +146 -0
  53. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +19 -0
  54. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +87 -0
  55. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js +9 -0
  56. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardHelper.js +0 -0
  57. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js +68 -0
  58. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +17 -0
  59. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +25 -0
  60. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +39 -0
  61. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +16 -0
  62. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +64 -0
  63. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +45 -0
  64. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +36 -0
  65. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap +76 -0
  66. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap +44 -0
  67. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap +42 -0
  68. data/webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss +0 -0
  69. data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +37 -0
  70. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
  71. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +22 -0
  72. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
  73. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +13 -0
  74. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +25 -0
  75. data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +3 -0
  76. data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +1 -0
  77. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js +0 -0
  78. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +50 -0
  79. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js +0 -0
  80. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +13 -0
  81. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +64 -0
  82. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +10 -0
  83. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js +1 -0
  84. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +10 -0
  85. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +83 -0
  86. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
  87. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +26 -0
  88. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +89 -0
  89. data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +1 -0
  90. data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +7 -0
  91. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +16 -0
  92. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +57 -0
  93. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js +0 -0
  94. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +14 -0
  95. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +45 -0
  96. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js +1 -0
  97. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss +0 -0
  98. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +18 -0
  99. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +57 -0
  100. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js +0 -0
  101. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +14 -0
  102. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +45 -0
  103. data/webpack/ForemanInventoryUpload/Components/ReportUpload/index.js +1 -0
  104. data/webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss +0 -0
  105. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +3 -0
  106. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +27 -0
  107. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
  108. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +14 -0
  109. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +25 -0
  110. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -0
  111. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +11 -0
  112. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
  113. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +53 -0
  114. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
  115. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +13 -0
  116. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +74 -0
  117. data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +1 -0
  118. data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +8 -0
  119. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js +0 -0
  120. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js +31 -0
  121. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js +0 -0
  122. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +13 -0
  123. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +19 -0
  124. data/webpack/ForemanInventoryUpload/Components/TabBody/index.js +1 -0
  125. data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +3 -0
  126. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
  127. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +24 -0
  128. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
  129. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +13 -0
  130. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap +18 -0
  131. data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +1 -0
  132. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +8 -0
  133. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
  134. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +19 -0
  135. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
  136. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +13 -0
  137. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap +12 -0
  138. data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +1 -0
  139. data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
  140. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
  141. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +45 -0
  142. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
  143. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +13 -0
  144. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +53 -0
  145. data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +1 -0
  146. data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +21 -0
  147. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js +10 -0
  148. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +112 -0
  149. data/webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js +6 -0
  150. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +35 -0
  151. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +98 -0
  152. data/webpack/ForemanInventoryUpload/Components/Terminal/index.js +1 -0
  153. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +31 -0
  154. data/webpack/ForemanInventoryUpload/Components/Tree/Tree.fixtures.js +3 -0
  155. data/webpack/ForemanInventoryUpload/Components/Tree/Tree.js +29 -0
  156. data/webpack/ForemanInventoryUpload/Components/Tree/TreeHelper.js +0 -0
  157. data/webpack/ForemanInventoryUpload/Components/Tree/__tests__/Tree.test.js +14 -0
  158. data/webpack/ForemanInventoryUpload/Components/Tree/__tests__/__snapshots__/Tree.test.js.snap +63 -0
  159. data/webpack/ForemanInventoryUpload/Components/Tree/index.js +1 -0
  160. data/webpack/ForemanInventoryUpload/Components/Tree/tree.scss +0 -0
  161. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +15 -0
  162. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +10 -0
  163. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +12 -0
  164. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +4 -0
  165. data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +16 -0
  166. data/webpack/ForemanInventoryUpload/index.js +1 -0
  167. data/webpack/__mocks__/foremanReact/API.js +7 -0
  168. data/webpack/__mocks__/foremanReact/common/I18n.js +5 -0
  169. data/webpack/__mocks__/foremanReact/common/helpers.js +3 -0
  170. data/webpack/index.js +18 -0
  171. data/webpack/stories/ForemanInventoryUploadReducers.js +3 -0
  172. data/webpack/stories/configureStore.js +15 -0
  173. data/webpack/stories/decorators/index.js +1 -0
  174. data/webpack/stories/decorators/withCardsDecorator.js +14 -0
  175. data/webpack/stories/index.js +10 -0
  176. data/webpack/stories/index.scss +7 -0
  177. data/webpack/test_setup.js +6 -0
  178. metadata +177 -2
@@ -0,0 +1,48 @@
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
+ statuses={
10
+ Object {
11
+ "generate_report_status": "unknown",
12
+ "upload_report_status": "unknown",
13
+ }
14
+ }
15
+ />,
16
+ ]
17
+ }
18
+ checkboxInput={null}
19
+ compoundExpand={false}
20
+ compoundExpanded={false}
21
+ description={null}
22
+ heading="some-name"
23
+ hideCloseIcon={true}
24
+ initExpanded={false}
25
+ leftContent={
26
+ <ListViewIcon
27
+ className=""
28
+ name="user"
29
+ size="sm"
30
+ type="fa"
31
+ />
32
+ }
33
+ onCloseCompoundExpand={[Function]}
34
+ onExpand={[Function]}
35
+ onExpandClose={[Function]}
36
+ stacked={true}
37
+ >
38
+ <Connect(Dashboard)
39
+ accountID="some-name"
40
+ statuses={
41
+ Object {
42
+ "generate_report_status": "unknown",
43
+ "upload_report_status": "unknown",
44
+ }
45
+ }
46
+ />
47
+ </ListViewItem>
48
+ `;
@@ -0,0 +1 @@
1
+ export { default } from './ListItem';
@@ -0,0 +1,6 @@
1
+ export const props = {
2
+ statuses: {
3
+ generate_report_status: 'Exit Code: pid 22191 exit 0',
4
+ upload_report_status: 'Exit Code: Running in pid 22376',
5
+ },
6
+ };
@@ -0,0 +1,43 @@
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 = ({ statuses }) => {
9
+ const generatingStatusIcon = getStatusIconByRegex(
10
+ statuses.generate_report_status
11
+ );
12
+ const uploadingStatusIcon = getStatusIconByRegex(
13
+ statuses.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
+ statuses: PropTypes.shape({
31
+ generate_report_status: PropTypes.string,
32
+ upload_report_status: PropTypes.string,
33
+ }),
34
+ };
35
+
36
+ ListItemStatus.defaultProps = {
37
+ statuses: {
38
+ generate_report_status: 'unknown',
39
+ uploupload_report_statusading: 'unknown',
40
+ },
41
+ };
42
+
43
+ export default ListItemStatus;
@@ -0,0 +1,29 @@
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
+ };
@@ -0,0 +1,14 @@
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
+ });
@@ -0,0 +1,78 @@
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
+ `;
@@ -0,0 +1 @@
1
+ export { default } from './ListItemStatus';
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ });
@@ -0,0 +1,20 @@
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));
@@ -0,0 +1,14 @@
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
+ });
@@ -0,0 +1,60 @@
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
+ statuses,
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
+ statuses,
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));
@@ -0,0 +1,26 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import {
3
+ selectAccountsList,
4
+ selectStatuses,
5
+ selectPollingProcessID,
6
+ } from '../AccountListSelectors';
7
+ import { pollingProcessID, statuses } from '../AccountList.fixtures';
8
+
9
+ const state = {
10
+ ForemanInventoryUpload: {
11
+ accountsList: {
12
+ statuses,
13
+ pollingProcessID,
14
+ },
15
+ },
16
+ };
17
+
18
+ const fixtures = {
19
+ 'should return AccountsList': () => selectAccountsList(state),
20
+ 'should return AccountList statuses': () => selectStatuses(state),
21
+ 'should return AccountList pollingProcessID': () =>
22
+ selectPollingProcessID(state),
23
+ };
24
+
25
+ describe('AccountList selectors', () =>
26
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,41 @@
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
+ initExpanded={true}
9
+ key="0"
10
+ name="Account1"
11
+ statuses={
12
+ Object {
13
+ "generate_report_status": "running",
14
+ "upload_report_status": "running",
15
+ }
16
+ }
17
+ />
18
+ <ListItem
19
+ initExpanded={false}
20
+ key="1"
21
+ name="Account2"
22
+ statuses={
23
+ Object {
24
+ "generate_report_status": "failure",
25
+ "upload_report_status": "unknown",
26
+ }
27
+ }
28
+ />
29
+ <ListItem
30
+ initExpanded={false}
31
+ key="2"
32
+ name="Account3"
33
+ statuses={
34
+ Object {
35
+ "generate_report_status": "running",
36
+ "upload_report_status": "success",
37
+ }
38
+ }
39
+ />
40
+ </ListView>
41
+ `;
@@ -0,0 +1,47 @@
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
+ `;
@@ -0,0 +1,66 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
4
+ Object {
5
+ "error": null,
6
+ "pollingProcessID": 0,
7
+ "statuses": Object {
8
+ "Account1": Object {
9
+ "generate_report_status": "running",
10
+ "upload_report_status": "running",
11
+ },
12
+ "Account2": Object {
13
+ "generate_report_status": "failure",
14
+ "upload_report_status": "unknown",
15
+ },
16
+ "Account3": Object {
17
+ "generate_report_status": "running",
18
+ "upload_report_status": "success",
19
+ },
20
+ },
21
+ }
22
+ `;
23
+
24
+ exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_ERROR 1`] = `
25
+ Object {
26
+ "error": "some-error",
27
+ "pollingProcessID": 0,
28
+ "statuses": Object {},
29
+ }
30
+ `;
31
+
32
+ exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_START 1`] = `
33
+ Object {
34
+ "error": null,
35
+ "pollingProcessID": 0,
36
+ "statuses": Object {},
37
+ }
38
+ `;
39
+
40
+ exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING_STOP 1`] = `
41
+ Object {
42
+ "error": null,
43
+ "pollingProcessID": 0,
44
+ "statuses": Object {},
45
+ }
46
+ `;
47
+
48
+ exports[`AccountList reducer should handle INVENTORY_PROCESS_RESTART 1`] = `
49
+ Object {
50
+ "error": null,
51
+ "pollingProcessID": 0,
52
+ "statuses": Object {
53
+ "user@redhat.com": Object {
54
+ "upload_report_status": "Restarting...",
55
+ },
56
+ },
57
+ }
58
+ `;
59
+
60
+ exports[`AccountList reducer should return the initial state 1`] = `
61
+ Object {
62
+ "error": null,
63
+ "pollingProcessID": 0,
64
+ "statuses": Object {},
65
+ }
66
+ `;
@@ -0,0 +1,40 @@
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 statuses 1`] = `
6
+ Object {
7
+ "Account1": Object {
8
+ "generate_report_status": "running",
9
+ "upload_report_status": "running",
10
+ },
11
+ "Account2": Object {
12
+ "generate_report_status": "failure",
13
+ "upload_report_status": "unknown",
14
+ },
15
+ "Account3": Object {
16
+ "generate_report_status": "running",
17
+ "upload_report_status": "success",
18
+ },
19
+ }
20
+ `;
21
+
22
+ exports[`AccountList selectors should return AccountsList 1`] = `
23
+ Object {
24
+ "pollingProcessID": 0,
25
+ "statuses": Object {
26
+ "Account1": Object {
27
+ "generate_report_status": "running",
28
+ "upload_report_status": "running",
29
+ },
30
+ "Account2": Object {
31
+ "generate_report_status": "failure",
32
+ "upload_report_status": "unknown",
33
+ },
34
+ "Account3": Object {
35
+ "generate_report_status": "running",
36
+ "upload_report_status": "success",
37
+ },
38
+ },
39
+ }
40
+ `;
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,30 @@
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
+ selectStatuses,
9
+ selectPollingProcessID,
10
+ selectError,
11
+ } from './AccountListSelectors';
12
+
13
+ // map state to props
14
+ const mapStateToProps = state => ({
15
+ statuses: selectStatuses(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(
28
+ mapStateToProps,
29
+ mapDispatchToProps
30
+ )(AccountList);
@@ -0,0 +1,50 @@
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
+ };