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.
- checksums.yaml +4 -4
- data/lib/foreman_inventory_upload/version.rb +1 -1
- data/package.json +124 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +34 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +72 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +18 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +65 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +55 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +8 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +16 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +26 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +7 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +23 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorStateHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap +20 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +18 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +39 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +48 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +43 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +29 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +78 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +16 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +20 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +60 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +26 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +41 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +47 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +66 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +40 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +9 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +30 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +50 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +146 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +19 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +87 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js +68 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +17 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +25 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +39 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +16 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +64 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +45 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +36 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap +76 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap +44 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap +42 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +37 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +22 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +25 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +3 -0
- data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +50 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +64 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +10 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +10 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +83 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +26 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +89 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +7 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +16 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +57 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +45 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +18 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +57 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +45 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +3 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +25 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +11 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +53 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +74 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +8 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js +31 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +19 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +3 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +24 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap +18 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +8 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +19 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap +12 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +45 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +53 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +21 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js +10 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +112 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +35 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +98 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +31 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/Tree.fixtures.js +3 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/Tree.js +29 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/TreeHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/__tests__/Tree.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/__tests__/__snapshots__/Tree.test.js.snap +63 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/Tree/tree.scss +0 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +15 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +10 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +12 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +4 -0
- data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +16 -0
- data/webpack/ForemanInventoryUpload/index.js +1 -0
- data/webpack/__mocks__/foremanReact/API.js +7 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +5 -0
- data/webpack/__mocks__/foremanReact/common/helpers.js +3 -0
- data/webpack/index.js +18 -0
- data/webpack/stories/ForemanInventoryUploadReducers.js +3 -0
- data/webpack/stories/configureStore.js +15 -0
- data/webpack/stories/decorators/index.js +1 -0
- data/webpack/stories/decorators/withCardsDecorator.js +14 -0
- data/webpack/stories/index.js +10 -0
- data/webpack/stories/index.scss +7 -0
- data/webpack/test_setup.js +6 -0
- 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';
|
File without changes
|
@@ -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,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
|
+
});
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
ADDED
@@ -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));
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js
ADDED
@@ -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
|
+
});
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js
ADDED
@@ -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));
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js
ADDED
@@ -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,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
|
+
};
|