foreman_rh_cloud 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +38 -0
- data/Rakefile +47 -0
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +39 -0
- data/app/controllers/foreman_inventory_upload/react_controller.rb +7 -0
- data/app/controllers/foreman_inventory_upload/reports_controller.rb +30 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +31 -0
- data/app/helpers/foreman_inventory_upload_helper.rb +13 -0
- data/app/views/foreman_inventory_upload/layouts/react.html.erb +16 -0
- data/config/routes.rb +10 -0
- data/lib/foreman_inventory_upload.rb +51 -0
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +19 -0
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +37 -0
- data/lib/foreman_inventory_upload/async/progress_output.rb +61 -0
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +47 -0
- data/lib/foreman_inventory_upload/async/shell_process.rb +36 -0
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +58 -0
- data/lib/foreman_inventory_upload/generators/archived_report.rb +53 -0
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +18 -0
- data/lib/foreman_inventory_upload/generators/json_stream.rb +55 -0
- data/lib/foreman_inventory_upload/generators/metadata.rb +36 -0
- data/lib/foreman_inventory_upload/generators/queries.rb +61 -0
- data/lib/foreman_inventory_upload/generators/slice.rb +147 -0
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +44 -0
- data/lib/foreman_rh_cloud.rb +4 -0
- data/lib/foreman_rh_cloud/engine.rb +62 -0
- data/lib/foreman_rh_cloud/version.rb +3 -0
- data/lib/tasks/foreman_rh_cloud_tasks.rake +37 -0
- data/lib/tasks/generator.rake +29 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_rh_cloud.po +19 -0
- data/locale/foreman_rh_cloud.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/package.json +125 -0
- data/test/controllers/accounts_controller_test.rb +25 -0
- data/test/controllers/reports_controller_test.rb +21 -0
- data/test/controllers/uploads_controller_test.rb +21 -0
- data/test/factories/inventory_upload_factories.rb +88 -0
- data/test/test_plugin_helper.rb +26 -0
- data/test/unit/archived_report_generator_test.rb +61 -0
- data/test/unit/metadata_generator_test.rb +40 -0
- data/test/unit/shell_process_job_test.rb +27 -0
- data/test/unit/slice_generator_test.rb +177 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +37 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +74 -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 +41 -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 +50 -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 +7 -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 +44 -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 +69 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +46 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +9 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +50 -0
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +145 -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 +35 -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 +34 -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 +18 -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 +53 -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 +56 -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 +47 -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 +43 -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/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 +318 -0
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './ErrorState';
|
data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export const props = { accountID: '1' };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ListView } from 'patternfly-react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import ListItemStatus from '../ListItemStatus';
|
5
|
+
import Dashboard from '../../../Dashboard';
|
6
|
+
|
7
|
+
const ListItem = ({ accountID, account, initExpanded }) => (
|
8
|
+
<ListView.Item
|
9
|
+
leftContent={<ListView.Icon name="user" />}
|
10
|
+
heading={account.label}
|
11
|
+
additionalInfo={[
|
12
|
+
<ListItemStatus key={`${accountID}_status`} account={account} />,
|
13
|
+
]}
|
14
|
+
stacked
|
15
|
+
hideCloseIcon
|
16
|
+
initExpanded={initExpanded}
|
17
|
+
>
|
18
|
+
<Dashboard accountID={accountID} account={account} />
|
19
|
+
</ListView.Item>
|
20
|
+
);
|
21
|
+
|
22
|
+
ListItem.propTypes = {
|
23
|
+
accountID: PropTypes.string.isRequired,
|
24
|
+
account: PropTypes.shape({
|
25
|
+
generate_report_status: PropTypes.string,
|
26
|
+
upload_report_status: PropTypes.string,
|
27
|
+
label: PropTypes.string,
|
28
|
+
}),
|
29
|
+
initExpanded: PropTypes.bool,
|
30
|
+
};
|
31
|
+
|
32
|
+
ListItem.defaultProps = {
|
33
|
+
account: {
|
34
|
+
generate_report_status: 'unknown',
|
35
|
+
upload_report_status: 'unknown',
|
36
|
+
label: 'default_org_name',
|
37
|
+
},
|
38
|
+
initExpanded: false,
|
39
|
+
};
|
40
|
+
|
41
|
+
export default ListItem;
|
data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import ListItem from '../ListItem';
|
4
|
+
import { props } from '../ListItem.fixtures';
|
5
|
+
|
6
|
+
const fixtures = {
|
7
|
+
'render with Props': props,
|
8
|
+
};
|
9
|
+
|
10
|
+
describe('ListItem', () => {
|
11
|
+
describe('rendering', () =>
|
12
|
+
testComponentSnapshotsWithFixtures(ListItem, fixtures));
|
13
|
+
});
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`ListItem rendering render with Props 1`] = `
|
4
|
+
<ListViewItem
|
5
|
+
actions={null}
|
6
|
+
additionalInfo={
|
7
|
+
Array [
|
8
|
+
<ListItemStatus
|
9
|
+
account={
|
10
|
+
Object {
|
11
|
+
"generate_report_status": "unknown",
|
12
|
+
"label": "default_org_name",
|
13
|
+
"upload_report_status": "unknown",
|
14
|
+
}
|
15
|
+
}
|
16
|
+
/>,
|
17
|
+
]
|
18
|
+
}
|
19
|
+
checkboxInput={null}
|
20
|
+
compoundExpand={false}
|
21
|
+
compoundExpanded={false}
|
22
|
+
description={null}
|
23
|
+
heading="default_org_name"
|
24
|
+
hideCloseIcon={true}
|
25
|
+
initExpanded={false}
|
26
|
+
leftContent={
|
27
|
+
<ListViewIcon
|
28
|
+
className=""
|
29
|
+
name="user"
|
30
|
+
size="sm"
|
31
|
+
type="fa"
|
32
|
+
/>
|
33
|
+
}
|
34
|
+
onCloseCompoundExpand={[Function]}
|
35
|
+
onExpand={[Function]}
|
36
|
+
onExpandClose={[Function]}
|
37
|
+
stacked={true}
|
38
|
+
>
|
39
|
+
<Connect(Dashboard)
|
40
|
+
account={
|
41
|
+
Object {
|
42
|
+
"generate_report_status": "unknown",
|
43
|
+
"label": "default_org_name",
|
44
|
+
"upload_report_status": "unknown",
|
45
|
+
}
|
46
|
+
}
|
47
|
+
accountID="1"
|
48
|
+
/>
|
49
|
+
</ListViewItem>
|
50
|
+
`;
|
@@ -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 = ({ account }) => {
|
9
|
+
const generatingStatusIcon = getStatusIconByRegex(
|
10
|
+
account.generate_report_status
|
11
|
+
);
|
12
|
+
const uploadingStatusIcon = getStatusIconByRegex(
|
13
|
+
account.upload_report_status
|
14
|
+
);
|
15
|
+
return (
|
16
|
+
<Grid className="status">
|
17
|
+
<Grid.Col sm={6} className="item">
|
18
|
+
<p>{__('Generating')}</p>
|
19
|
+
{generatingStatusIcon}
|
20
|
+
</Grid.Col>
|
21
|
+
<Grid.Col sm={6} className="item">
|
22
|
+
<p>{__('Uploading')}</p>
|
23
|
+
{uploadingStatusIcon}
|
24
|
+
</Grid.Col>
|
25
|
+
</Grid>
|
26
|
+
);
|
27
|
+
};
|
28
|
+
|
29
|
+
ListItemStatus.propTypes = {
|
30
|
+
account: PropTypes.shape({
|
31
|
+
generate_report_status: PropTypes.string,
|
32
|
+
upload_report_status: PropTypes.string,
|
33
|
+
}),
|
34
|
+
};
|
35
|
+
|
36
|
+
ListItemStatus.defaultProps = {
|
37
|
+
account: {
|
38
|
+
generate_report_status: 'unknown',
|
39
|
+
uploupload_report_statusading: 'unknown',
|
40
|
+
},
|
41
|
+
};
|
42
|
+
|
43
|
+
export default ListItemStatus;
|
@@ -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
|
+
accounts,
|
13
|
+
error,
|
14
|
+
pollingProcessID,
|
15
|
+
accountID,
|
16
|
+
processStatusName,
|
17
|
+
} from '../AccountList.fixtures';
|
18
|
+
|
19
|
+
const fixtures = {
|
20
|
+
'should return the initial state': {},
|
21
|
+
'should handle INVENTORY_ACCOUNT_STATUS_POLLING': {
|
22
|
+
action: {
|
23
|
+
type: INVENTORY_ACCOUNT_STATUS_POLLING,
|
24
|
+
payload: {
|
25
|
+
accounts,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
},
|
29
|
+
'should handle INVENTORY_ACCOUNT_STATUS_POLLING_ERROR': {
|
30
|
+
action: {
|
31
|
+
type: INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
|
32
|
+
payload: { error },
|
33
|
+
},
|
34
|
+
},
|
35
|
+
'should handle INVENTORY_ACCOUNT_STATUS_POLLING_START': {
|
36
|
+
action: {
|
37
|
+
type: INVENTORY_ACCOUNT_STATUS_POLLING_START,
|
38
|
+
payload: {
|
39
|
+
pollingProcessID,
|
40
|
+
},
|
41
|
+
},
|
42
|
+
},
|
43
|
+
'should handle INVENTORY_ACCOUNT_STATUS_POLLING_STOP': {
|
44
|
+
action: {
|
45
|
+
type: INVENTORY_ACCOUNT_STATUS_POLLING_STOP,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
'should handle INVENTORY_PROCESS_RESTART': {
|
49
|
+
action: {
|
50
|
+
type: INVENTORY_PROCESS_RESTART,
|
51
|
+
payload: {
|
52
|
+
accountID,
|
53
|
+
processStatusName,
|
54
|
+
},
|
55
|
+
},
|
56
|
+
},
|
57
|
+
};
|
58
|
+
|
59
|
+
describe('AccountList reducer', () =>
|
60
|
+
testReducerSnapshotWithFixtures(reducer, fixtures));
|
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
|
+
selectAccounts,
|
5
|
+
selectPollingProcessID,
|
6
|
+
} from '../AccountListSelectors';
|
7
|
+
import { pollingProcessID, accounts } from '../AccountList.fixtures';
|
8
|
+
|
9
|
+
const state = {
|
10
|
+
ForemanInventoryUpload: {
|
11
|
+
accountsList: {
|
12
|
+
accounts,
|
13
|
+
pollingProcessID,
|
14
|
+
},
|
15
|
+
},
|
16
|
+
};
|
17
|
+
|
18
|
+
const fixtures = {
|
19
|
+
'should return AccountsList': () => selectAccountsList(state),
|
20
|
+
'should return AccountList accounts': () => selectAccounts(state),
|
21
|
+
'should return AccountList pollingProcessID': () =>
|
22
|
+
selectPollingProcessID(state),
|
23
|
+
};
|
24
|
+
|
25
|
+
describe('AccountList selectors', () =>
|
26
|
+
testSelectorsSnapshotWithFixtures(fixtures));
|