foreman_rh_cloud 1.0.5 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -6
- data/app/controllers/foreman_rh_cloud/react_controller.rb +8 -0
- data/app/models/setting/rh_cloud.rb +1 -0
- data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +1 -0
- data/app/views/{foreman_inventory_upload/layouts/react.html.erb → layouts/foreman_rh_cloud/application.html.erb} +2 -2
- data/config/routes.rb +4 -1
- data/lib/foreman_inventory_upload/async/async_helpers.rb +13 -0
- data/lib/foreman_inventory_upload/async/shell_process.rb +3 -1
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +56 -0
- data/lib/foreman_inventory_upload/generators/queries.rb +6 -0
- data/lib/foreman_inventory_upload/generators/slice.rb +14 -9
- data/lib/foreman_rh_cloud/engine.rb +17 -5
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +20 -100
- data/test/factories/inventory_upload_factories.rb +13 -13
- data/test/unit/archived_report_generator_test.rb +1 -0
- data/test/unit/fact_helpers_test.rb +29 -0
- data/test/unit/slice_generator_test.rb +206 -20
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +6 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +13 -10
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +3 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +10 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js +13 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap +18 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +7 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +1 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +12 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +8 -9
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +2 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +4 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +4 -3
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +17 -5
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +4 -3
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +26 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +2 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +39 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterActions.js +16 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +36 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterSelectors.js +7 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +35 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js +21 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +25 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap +17 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +25 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap +9 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +31 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +18 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js +17 -0
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -0
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +12 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +11 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +3 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +3 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +4 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +16 -8
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +4 -4
- data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +9 -0
- data/webpack/ForemanInventoryUpload/{ForemanInventoryUpload.test.js → __tests__/ForemanInventoryUpload.test.js} +2 -2
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +3 -0
- data/webpack/ForemanInventoryUpload/{__snapshots__ → __tests__/__snapshots__}/ForemanInventoryUpload.test.js.snap +0 -0
- data/webpack/ForemanRhCloudHelpers.js +6 -0
- data/webpack/ForemanRhCloudReducers.js +8 -0
- data/webpack/ForemanRhCloudSelectors.js +3 -0
- data/webpack/ForemanRhCloudTestHelpers.js +5 -0
- data/webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js +1 -0
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +11 -0
- data/webpack/__tests__/ForemanRhCloudSelectors.test.js +17 -0
- data/webpack/__tests__/ForemanRhCloudTestHelpers.test.js +10 -0
- data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +3 -0
- data/webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap +15 -0
- data/webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap +11 -0
- data/webpack/index.js +1 -1
- metadata +52 -14
- data/app/controllers/foreman_inventory_upload/react_controller.rb +0 -7
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
- data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
- data/webpack/stories/configureStore.js +0 -15
- data/webpack/stories/decorators/index.js +0 -1
- data/webpack/stories/decorators/withCardsDecorator.js +0 -14
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -6
@@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
|
|
4
4
|
import ListItem from './Components/ListItem';
|
5
5
|
import EmptyState from './Components/EmptyState';
|
6
6
|
import ErrorState from './Components/ErrorState';
|
7
|
+
import EmptyResults from './Components/EmptyResults';
|
8
|
+
import { filterAccounts } from './AccountListHelper';
|
7
9
|
import './accountList.scss';
|
8
10
|
|
9
11
|
class AccountList extends Component {
|
@@ -20,8 +22,9 @@ class AccountList extends Component {
|
|
20
22
|
}
|
21
23
|
|
22
24
|
render() {
|
23
|
-
const { accounts, error } = this.props;
|
25
|
+
const { accounts, error, filterTerm } = this.props;
|
24
26
|
const accountIds = Object.keys(accounts);
|
27
|
+
const filteredAccountIds = filterAccounts(accounts, accountIds, filterTerm);
|
25
28
|
|
26
29
|
if (error) {
|
27
30
|
return <ErrorState error={error} />;
|
@@ -30,16 +33,14 @@ class AccountList extends Component {
|
|
30
33
|
if (accountIds.length === 0) {
|
31
34
|
return <EmptyState />;
|
32
35
|
}
|
33
|
-
|
36
|
+
|
37
|
+
if (filteredAccountIds.length === 0) {
|
38
|
+
return <EmptyResults />;
|
39
|
+
}
|
40
|
+
|
41
|
+
const items = filteredAccountIds.map((accountID, index) => {
|
34
42
|
const account = accounts[accountID];
|
35
|
-
return
|
36
|
-
<ListItem
|
37
|
-
key={index}
|
38
|
-
accountID={accountID}
|
39
|
-
account={account}
|
40
|
-
initExpanded={index === 0}
|
41
|
-
/>
|
42
|
-
);
|
43
|
+
return <ListItem key={index} accountID={accountID} account={account} />;
|
43
44
|
});
|
44
45
|
return <ListView className="account_list">{items}</ListView>;
|
45
46
|
}
|
@@ -56,6 +57,7 @@ AccountList.propTypes = {
|
|
56
57
|
}),
|
57
58
|
accounts: PropTypes.object,
|
58
59
|
error: PropTypes.string,
|
60
|
+
filterTerm: PropTypes.string,
|
59
61
|
};
|
60
62
|
|
61
63
|
AccountList.defaultProps = {
|
@@ -69,6 +71,7 @@ AccountList.defaultProps = {
|
|
69
71
|
},
|
70
72
|
accounts: {},
|
71
73
|
error: '',
|
74
|
+
filterTerm: null,
|
72
75
|
};
|
73
76
|
|
74
77
|
export default AccountList;
|
@@ -1,18 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { storiesOf } from '@storybook/react';
|
3
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
4
|
-
import { Provider } from 'react-redux';
|
5
|
-
import configureStore from '../../../stories/configureStore';
|
6
2
|
import AccountList from './AccountList';
|
7
3
|
|
8
|
-
|
4
|
+
export default {
|
5
|
+
title: 'AccountList',
|
6
|
+
component: AccountList,
|
7
|
+
};
|
9
8
|
|
10
|
-
|
11
|
-
.addDecorator(withKnobs)
|
12
|
-
.add('Account list', () => (
|
13
|
-
<div style={{ margin: '20px' }}>
|
14
|
-
<Provider store={store}>
|
15
|
-
<AccountList />
|
16
|
-
</Provider>
|
17
|
-
</div>
|
18
|
-
));
|
9
|
+
export const Basic = () => <AccountList />;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import API from 'foremanReact/API';
|
2
|
+
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
2
3
|
import {
|
3
4
|
INVENTORY_ACCOUNT_STATUS_POLLING,
|
4
5
|
INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
|
@@ -11,7 +12,7 @@ export const fetchAccountsStatus = () => async dispatch => {
|
|
11
12
|
try {
|
12
13
|
const {
|
13
14
|
data: { accounts, autoUploadEnabled },
|
14
|
-
} = await API.get('accounts');
|
15
|
+
} = await API.get(inventoryUrl('accounts'));
|
15
16
|
dispatch({
|
16
17
|
type: INVENTORY_ACCOUNT_STATUS_POLLING,
|
17
18
|
payload: {
|
@@ -55,7 +56,7 @@ export const restartProcess = (accountID, activeTab) => dispatch => {
|
|
55
56
|
processStatusName = 'generate_report_status';
|
56
57
|
}
|
57
58
|
|
58
|
-
API.post(`${accountID}/${processController}`);
|
59
|
+
API.post(inventoryUrl(`${accountID}/${processController}`));
|
59
60
|
dispatch({
|
60
61
|
type: INVENTORY_PROCESS_RESTART,
|
61
62
|
payload: {
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export const filterAccounts = (accounts, accountIds, filterTerm) => {
|
2
|
+
if (!filterTerm || !accountIds.length) {
|
3
|
+
return accountIds;
|
4
|
+
}
|
5
|
+
|
6
|
+
const filterTermLowerCased = filterTerm.toLowerCase();
|
7
|
+
return accountIds.filter(id =>
|
8
|
+
accounts[id].label.toLowerCase().includes(filterTermLowerCased)
|
9
|
+
);
|
10
|
+
};
|
data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { EmptyState, Icon } from 'patternfly-react';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import './emptyResults.scss';
|
5
|
+
|
6
|
+
const inventoryEmptyResults = () => (
|
7
|
+
<EmptyState>
|
8
|
+
<EmptyState.Title>
|
9
|
+
<Icon className="no_results_icon" name="meh-o" />
|
10
|
+
{__("Oops! Couldn't find organization that matches your query")}
|
11
|
+
</EmptyState.Title>
|
12
|
+
</EmptyState>
|
13
|
+
);
|
14
|
+
|
15
|
+
export default inventoryEmptyResults;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
|
+
|
3
|
+
import EmptyResults from '../EmptyResults';
|
4
|
+
|
5
|
+
const fixtures = {
|
6
|
+
'render without Props': {},
|
7
|
+
/** fixtures, props for the component */
|
8
|
+
};
|
9
|
+
|
10
|
+
describe('EmptyResults', () => {
|
11
|
+
describe('rendering', () =>
|
12
|
+
testComponentSnapshotsWithFixtures(EmptyResults, fixtures));
|
13
|
+
});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`EmptyResults rendering render without Props 1`] = `
|
4
|
+
<EmptyState
|
5
|
+
className=""
|
6
|
+
>
|
7
|
+
<EmptyStateTitle
|
8
|
+
className=""
|
9
|
+
>
|
10
|
+
<Icon
|
11
|
+
className="no_results_icon"
|
12
|
+
name="meh-o"
|
13
|
+
type="fa"
|
14
|
+
/>
|
15
|
+
Oops! Couldn't find organization that matches your query
|
16
|
+
</EmptyStateTitle>
|
17
|
+
</EmptyState>
|
18
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './EmptyResults';
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
4
4
|
import ListItemStatus from '../ListItemStatus';
|
5
5
|
import Dashboard from '../../../Dashboard';
|
6
6
|
|
7
|
-
const ListItem = ({ accountID, account
|
7
|
+
const ListItem = ({ accountID, account }) => (
|
8
8
|
<ListView.Item
|
9
9
|
leftContent={<ListView.Icon name="user" />}
|
10
10
|
heading={account.label}
|
@@ -13,7 +13,6 @@ const ListItem = ({ accountID, account, initExpanded }) => (
|
|
13
13
|
]}
|
14
14
|
stacked
|
15
15
|
hideCloseIcon
|
16
|
-
initExpanded={initExpanded}
|
17
16
|
>
|
18
17
|
<Dashboard accountID={accountID} account={account} />
|
19
18
|
</ListView.Item>
|
@@ -26,7 +25,6 @@ ListItem.propTypes = {
|
|
26
25
|
upload_report_status: PropTypes.string,
|
27
26
|
label: PropTypes.string,
|
28
27
|
}),
|
29
|
-
initExpanded: PropTypes.bool,
|
30
28
|
};
|
31
29
|
|
32
30
|
ListItem.defaultProps = {
|
@@ -35,7 +33,6 @@ ListItem.defaultProps = {
|
|
35
33
|
upload_report_status: 'unknown',
|
36
34
|
label: 'default_org_name',
|
37
35
|
},
|
38
|
-
initExpanded: false,
|
39
36
|
};
|
40
37
|
|
41
38
|
export default ListItem;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
2
2
|
|
3
3
|
import AccountList from '../AccountList';
|
4
4
|
import { props } from '../AccountList.fixtures';
|
5
5
|
|
6
6
|
const fixtures = {
|
7
7
|
'render with props': props,
|
8
|
+
'show empty results': { ...props, filterTerm: 'not_matching_term' },
|
8
9
|
};
|
9
10
|
|
10
11
|
describe('AccountList', () => {
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
import { filterAccounts } from '../AccountListHelper';
|
2
|
+
import { accounts, accountIDs } from '../AccountList.fixtures';
|
3
|
+
|
4
|
+
describe('AccountList helpers', () => {
|
5
|
+
it('account ids filter should return all accounts where label contains "test"', () => {
|
6
|
+
expect(filterAccounts(accounts, accountIDs, 'test')).toEqual(accountIDs);
|
7
|
+
});
|
8
|
+
|
9
|
+
it('account ids filter should not match', () => {
|
10
|
+
expect(filterAccounts(accounts, accountIDs, 'no_match')).toEqual([]);
|
11
|
+
});
|
12
|
+
});
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { IntegrationTestHelper } from '
|
2
|
+
import { IntegrationTestHelper } from '@theforeman/test';
|
3
3
|
|
4
4
|
import AccountList from '../index';
|
5
|
-
import reducers from '
|
5
|
+
import reducers from '../../../../ForemanRhCloudReducers';
|
6
6
|
|
7
7
|
describe('AccountList integration test', () => {
|
8
8
|
it('should flow', async () => {
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { testSelectorsSnapshotWithFixtures } from '
|
1
|
+
import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
|
2
2
|
import {
|
3
3
|
selectAccountsList,
|
4
4
|
selectAccounts,
|
@@ -10,16 +10,15 @@ import {
|
|
10
10
|
accounts,
|
11
11
|
autoUploadEnabled,
|
12
12
|
} from '../AccountList.fixtures';
|
13
|
+
import { inventoryStateWrapper } from '../../../../ForemanRhCloudTestHelpers';
|
13
14
|
|
14
|
-
const state = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
autoUploadEnabled,
|
20
|
-
},
|
15
|
+
const state = inventoryStateWrapper({
|
16
|
+
accountsList: {
|
17
|
+
accounts,
|
18
|
+
pollingProcessID,
|
19
|
+
autoUploadEnabled,
|
21
20
|
},
|
22
|
-
};
|
21
|
+
});
|
23
22
|
|
24
23
|
const fixtures = {
|
25
24
|
'should return AccountsList': () => selectAccountsList(state),
|
@@ -13,7 +13,6 @@ exports[`AccountList rendering render with props 1`] = `
|
|
13
13
|
}
|
14
14
|
}
|
15
15
|
accountID="Account1"
|
16
|
-
initExpanded={true}
|
17
16
|
key="0"
|
18
17
|
/>
|
19
18
|
<ListItem
|
@@ -25,7 +24,6 @@ exports[`AccountList rendering render with props 1`] = `
|
|
25
24
|
}
|
26
25
|
}
|
27
26
|
accountID="Account2"
|
28
|
-
initExpanded={false}
|
29
27
|
key="1"
|
30
28
|
/>
|
31
29
|
<ListItem
|
@@ -37,8 +35,9 @@ exports[`AccountList rendering render with props 1`] = `
|
|
37
35
|
}
|
38
36
|
}
|
39
37
|
accountID="Account3"
|
40
|
-
initExpanded={false}
|
41
38
|
key="2"
|
42
39
|
/>
|
43
40
|
</ListView>
|
44
41
|
`;
|
42
|
+
|
43
|
+
exports[`AccountList rendering show empty results 1`] = `<inventoryEmptyResults />`;
|
@@ -9,12 +9,14 @@ import {
|
|
9
9
|
selectPollingProcessID,
|
10
10
|
selectError,
|
11
11
|
} from './AccountListSelectors';
|
12
|
+
import { selectFilterTerm } from '../InventoryFilter/InventoryFilterSelectors';
|
12
13
|
|
13
14
|
// map state to props
|
14
15
|
const mapStateToProps = state => ({
|
15
16
|
accounts: selectAccounts(state),
|
16
17
|
pollingProcessID: selectPollingProcessID(state),
|
17
18
|
error: selectError(state),
|
19
|
+
filterTerm: selectFilterTerm(state),
|
18
20
|
});
|
19
21
|
|
20
22
|
// map action dispatchers to props
|
data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import API from 'foremanReact/API';
|
2
|
+
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
2
3
|
import {
|
3
4
|
AUTO_UPLOAD_TOGGLE,
|
4
5
|
AUTO_UPLOAD_TOGGLE_ERROR,
|
@@ -9,7 +10,9 @@ export const handleToggle = currentAutoUploadEnabled => async dispatch => {
|
|
9
10
|
try {
|
10
11
|
const {
|
11
12
|
data: { autoUploadEnabled },
|
12
|
-
} = await API.post('auto_upload', {
|
13
|
+
} = await API.post(inventoryUrl('auto_upload'), {
|
14
|
+
value: toggledAutoUploadEnabled,
|
15
|
+
});
|
13
16
|
dispatch({
|
14
17
|
type: AUTO_UPLOAD_TOGGLE,
|
15
18
|
payload: {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '
|
1
|
+
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
2
|
import API from 'foremanReact/API';
|
3
3
|
import { handleToggle } from '../AutoUploadSwitcherActions';
|
4
4
|
import { handleToggleResponse } from '../AutoUploadSwitcher.fixtures';
|
@@ -8,16 +8,20 @@ export const completed = 25;
|
|
8
8
|
|
9
9
|
export const error = 'some-error';
|
10
10
|
|
11
|
+
export const generating = {
|
12
|
+
logs,
|
13
|
+
completed,
|
14
|
+
};
|
15
|
+
|
16
|
+
export const uploading = {
|
17
|
+
logs,
|
18
|
+
completed,
|
19
|
+
files,
|
20
|
+
};
|
21
|
+
|
11
22
|
export const inventory = {
|
12
|
-
generating
|
13
|
-
|
14
|
-
completed,
|
15
|
-
},
|
16
|
-
uploading: {
|
17
|
-
logs,
|
18
|
-
completed,
|
19
|
-
files,
|
20
|
-
},
|
23
|
+
generating,
|
24
|
+
uploading,
|
21
25
|
};
|
22
26
|
|
23
27
|
export const accountID = 'some-account-ID';
|
@@ -1,19 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { storiesOf } from '@storybook/react';
|
3
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
4
|
-
import { Provider } from 'react-redux';
|
5
|
-
import configureStore from '../../../stories/configureStore';
|
6
2
|
import Dashboard from './index';
|
7
|
-
import { generating, uploading } from './Dashboard.fixtures';
|
8
3
|
|
9
|
-
|
4
|
+
export default {
|
5
|
+
title: 'Dashboard',
|
6
|
+
component: Dashboard,
|
7
|
+
};
|
10
8
|
|
11
|
-
|
12
|
-
.addDecorator(withKnobs)
|
13
|
-
.add('Dashboard', () => (
|
14
|
-
<div style={{ margin: '20px' }}>
|
15
|
-
<Provider store={store}>
|
16
|
-
<Dashboard generating={generating} uploading={uploading} />
|
17
|
-
</Provider>
|
18
|
-
</div>
|
19
|
-
));
|
9
|
+
export const Basic = () => <Dashboard />;
|