foreman_rh_cloud 1.0.4 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -0
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +14 -7
  5. data/app/models/setting/rh_cloud.rb +13 -0
  6. data/config/routes.rb +1 -0
  7. data/lib/foreman_inventory_upload.rb +12 -0
  8. data/lib/foreman_inventory_upload/async/async_helpers.rb +13 -0
  9. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +8 -0
  10. data/lib/foreman_inventory_upload/async/shell_process.rb +3 -1
  11. data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
  12. data/lib/foreman_inventory_upload/generators/archived_report.rb +6 -3
  13. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +13 -0
  14. data/lib/foreman_inventory_upload/generators/queries.rb +2 -0
  15. data/lib/foreman_inventory_upload/generators/slice.rb +31 -11
  16. data/lib/foreman_rh_cloud/engine.rb +5 -1
  17. data/lib/foreman_rh_cloud/version.rb +1 -1
  18. data/package.json +20 -100
  19. data/test/controllers/accounts_controller_test.rb +8 -3
  20. data/test/controllers/uploads_controller_test.rb +13 -0
  21. data/test/factories/inventory_upload_factories.rb +13 -13
  22. data/test/unit/archived_report_generator_test.rb +1 -0
  23. data/test/unit/fact_helpers_test.rb +29 -0
  24. data/test/unit/slice_generator_test.rb +112 -15
  25. data/test/unit/slice_generator_test.rb.orig +280 -0
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +2 -0
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +2 -1
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +8 -0
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +2 -0
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -1
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +12 -1
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +10 -2
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +10 -0
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +5 -2
  42. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +1 -0
  43. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +32 -0
  44. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +27 -0
  45. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +2 -0
  46. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +14 -0
  47. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +14 -0
  48. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +38 -0
  49. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +14 -0
  50. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +3 -0
  51. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +17 -0
  52. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
  53. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
  54. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
  55. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +15 -2
  56. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +3 -2
  57. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
  58. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +1 -1
  59. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
  60. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
  61. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
  62. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
  63. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +21 -0
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +13 -0
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +33 -0
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/index.js +1 -0
  68. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
  69. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
  70. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +1 -0
  71. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +4 -2
  72. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +1 -2
  73. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +0 -2
  74. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +12 -1
  75. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
  76. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
  77. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +1 -1
  78. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
  79. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
  80. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
  81. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
  82. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
  83. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +5 -4
  84. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +1 -1
  85. data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +6 -5
  86. metadata +22 -9
  87. data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
  88. data/webpack/stories/configureStore.js +0 -15
  89. data/webpack/stories/decorators/index.js +0 -1
  90. data/webpack/stories/decorators/withCardsDecorator.js +0 -14
  91. data/webpack/stories/index.js +0 -10
  92. data/webpack/stories/index.scss +0 -7
  93. data/webpack/test_setup.js +0 -6
@@ -28,6 +28,8 @@ export const accountID = 'user@redhat.com';
28
28
 
29
29
  export const processStatusName = 'upload_report_status';
30
30
 
31
+ export const autoUploadEnabled = true;
32
+
31
33
  export const props = {
32
34
  accounts,
33
35
  fetchAccountsStatus: noop,
@@ -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
- const store = configureStore();
4
+ export default {
5
+ title: 'AccountList',
6
+ component: AccountList,
7
+ };
9
8
 
10
- storiesOf('Account list', module)
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 />;
@@ -10,12 +10,13 @@ import {
10
10
  export const fetchAccountsStatus = () => async dispatch => {
11
11
  try {
12
12
  const {
13
- data: { accounts },
13
+ data: { accounts, autoUploadEnabled },
14
14
  } = await API.get('accounts');
15
15
  dispatch({
16
16
  type: INVENTORY_ACCOUNT_STATUS_POLLING,
17
17
  payload: {
18
18
  accounts,
19
+ autoUploadEnabled,
19
20
  },
20
21
  });
21
22
  } catch (error) {
@@ -5,6 +5,7 @@ import {
5
5
  INVENTORY_ACCOUNT_STATUS_POLLING_START,
6
6
  INVENTORY_PROCESS_RESTART,
7
7
  } from './AccountListConstants';
8
+ import { AUTO_UPLOAD_TOGGLE } from '../AutoUploadSwitcher/AutoUploadSwitcherConstants';
8
9
 
9
10
  const initialState = Immutable({
10
11
  accounts: {},
@@ -20,6 +21,7 @@ export default (state = initialState, action) => {
20
21
  accounts,
21
22
  accountID,
22
23
  processStatusName,
24
+ autoUploadEnabled,
23
25
  } = {},
24
26
  } = action;
25
27
 
@@ -28,6 +30,7 @@ export default (state = initialState, action) => {
28
30
  return state.merge({
29
31
  ...state,
30
32
  accounts,
33
+ autoUploadEnabled,
31
34
  error: null,
32
35
  });
33
36
  case INVENTORY_ACCOUNT_STATUS_POLLING_ERROR:
@@ -49,6 +52,11 @@ export default (state = initialState, action) => {
49
52
  [processStatusName]: 'Restarting...',
50
53
  },
51
54
  });
55
+ case AUTO_UPLOAD_TOGGLE:
56
+ return state.merge({
57
+ ...state,
58
+ autoUploadEnabled,
59
+ });
52
60
  default:
53
61
  return state;
54
62
  }
@@ -6,3 +6,5 @@ export const selectAccounts = state => selectAccountsList(state).accounts;
6
6
  export const selectPollingProcessID = state =>
7
7
  selectAccountsList(state).pollingProcessID;
8
8
  export const selectError = state => selectAccountsList(state).error;
9
+ export const selectAutoUploadEnabled = state =>
10
+ selectAccountsList(state).autoUploadEnabled;
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import EmptyState from '../EmptyState';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ErrorState from '../ErrorState';
4
4
 
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ListItem from '../ListItem';
4
4
  import { props } from '../ListItem.fixtures';
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import ListItemStatus from '../ListItemStatus';
4
4
  import { props } from '../ListItemStatus.fixtures';
@@ -1,4 +1,4 @@
1
- import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import AccountList from '../AccountList';
4
4
  import { props } from '../AccountList.fixtures';
@@ -1,4 +1,4 @@
1
- import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
2
  import {
3
3
  fetchAccountsStatus,
4
4
  startAccountStatusPolling,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IntegrationTestHelper } from 'react-redux-test-utils';
2
+ import { IntegrationTestHelper } from '@theforeman/test';
3
3
 
4
4
  import AccountList from '../index';
5
5
  import reducers from '../../../ForemanInventoryUploadReducers';
@@ -1,4 +1,4 @@
1
- import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import { testReducerSnapshotWithFixtures } from '@theforeman/test';
2
2
 
3
3
  import {
4
4
  INVENTORY_ACCOUNT_STATUS_POLLING,
@@ -14,7 +14,9 @@ import {
14
14
  pollingProcessID,
15
15
  accountID,
16
16
  processStatusName,
17
+ autoUploadEnabled,
17
18
  } from '../AccountList.fixtures';
19
+ import { AUTO_UPLOAD_TOGGLE } from '../../AutoUploadSwitcher/AutoUploadSwitcherConstants';
18
20
 
19
21
  const fixtures = {
20
22
  'should return the initial state': {},
@@ -23,6 +25,7 @@ const fixtures = {
23
25
  type: INVENTORY_ACCOUNT_STATUS_POLLING,
24
26
  payload: {
25
27
  accounts,
28
+ autoUploadEnabled,
26
29
  },
27
30
  },
28
31
  },
@@ -54,6 +57,14 @@ const fixtures = {
54
57
  },
55
58
  },
56
59
  },
60
+ 'should handle AUTO_UPLOAD_TOGGLE': {
61
+ action: {
62
+ type: AUTO_UPLOAD_TOGGLE,
63
+ payload: {
64
+ autoUploadEnabled,
65
+ },
66
+ },
67
+ },
57
68
  };
58
69
 
59
70
  describe('AccountList reducer', () =>
@@ -1,16 +1,22 @@
1
- import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
1
+ import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
2
2
  import {
3
3
  selectAccountsList,
4
4
  selectAccounts,
5
5
  selectPollingProcessID,
6
+ selectAutoUploadEnabled,
6
7
  } from '../AccountListSelectors';
7
- import { pollingProcessID, accounts } from '../AccountList.fixtures';
8
+ import {
9
+ pollingProcessID,
10
+ accounts,
11
+ autoUploadEnabled,
12
+ } from '../AccountList.fixtures';
8
13
 
9
14
  const state = {
10
15
  ForemanInventoryUpload: {
11
16
  accountsList: {
12
17
  accounts,
13
18
  pollingProcessID,
19
+ autoUploadEnabled,
14
20
  },
15
21
  },
16
22
  };
@@ -20,6 +26,8 @@ const fixtures = {
20
26
  'should return AccountList accounts': () => selectAccounts(state),
21
27
  'should return AccountList pollingProcessID': () =>
22
28
  selectPollingProcessID(state),
29
+ 'should return AccountList autoUploadEnabled': () =>
30
+ selectAutoUploadEnabled(state),
23
31
  };
24
32
 
25
33
  describe('AccountList selectors', () =>
@@ -1,5 +1,14 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`AccountList reducer should handle AUTO_UPLOAD_TOGGLE 1`] = `
4
+ Object {
5
+ "accounts": Object {},
6
+ "autoUploadEnabled": true,
7
+ "error": null,
8
+ "pollingProcessID": 0,
9
+ }
10
+ `;
11
+
3
12
  exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
4
13
  Object {
5
14
  "accounts": Object {
@@ -19,6 +28,7 @@ Object {
19
28
  "upload_report_status": "success",
20
29
  },
21
30
  },
31
+ "autoUploadEnabled": true,
22
32
  "error": null,
23
33
  "pollingProcessID": 0,
24
34
  }
@@ -1,7 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
4
-
5
3
  exports[`AccountList selectors should return AccountList accounts 1`] = `
6
4
  Object {
7
5
  "Account1": Object {
@@ -22,6 +20,10 @@ Object {
22
20
  }
23
21
  `;
24
22
 
23
+ exports[`AccountList selectors should return AccountList autoUploadEnabled 1`] = `true`;
24
+
25
+ exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
26
+
25
27
  exports[`AccountList selectors should return AccountsList 1`] = `
26
28
  Object {
27
29
  "accounts": Object {
@@ -41,6 +43,7 @@ Object {
41
43
  "upload_report_status": "success",
42
44
  },
43
45
  },
46
+ "autoUploadEnabled": true,
44
47
  "pollingProcessID": 0,
45
48
  }
46
49
  `;
@@ -0,0 +1 @@
1
+ export const handleToggleResponse = { data: { autoUploadEnabled: true } };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Switch, FieldLevelHelp } from 'patternfly-react';
4
+ import { translate as __ } from 'foremanReact/common/I18n';
5
+ import './autoUploadSwitcher.scss';
6
+
7
+ const AutoUploadSwitcher = ({ autoUploadEnabled, handleToggle }) => (
8
+ <div className="auto_upload_switcher">
9
+ <Switch
10
+ size="mini"
11
+ value={autoUploadEnabled}
12
+ onChange={() => handleToggle(autoUploadEnabled)}
13
+ />
14
+ <FieldLevelHelp
15
+ content={__(
16
+ 'Enable automatic upload of your host inventory to the Red Hat cloud'
17
+ )}
18
+ />
19
+ <span>Allow Auto Upload</span>
20
+ </div>
21
+ );
22
+
23
+ AutoUploadSwitcher.propTypes = {
24
+ autoUploadEnabled: PropTypes.bool,
25
+ handleToggle: PropTypes.func.isRequired,
26
+ };
27
+
28
+ AutoUploadSwitcher.defaultProps = {
29
+ autoUploadEnabled: true,
30
+ };
31
+
32
+ export default AutoUploadSwitcher;
@@ -0,0 +1,27 @@
1
+ import API from 'foremanReact/API';
2
+ import {
3
+ AUTO_UPLOAD_TOGGLE,
4
+ AUTO_UPLOAD_TOGGLE_ERROR,
5
+ } from './AutoUploadSwitcherConstants';
6
+
7
+ export const handleToggle = currentAutoUploadEnabled => async dispatch => {
8
+ const toggledAutoUploadEnabled = !currentAutoUploadEnabled;
9
+ try {
10
+ const {
11
+ data: { autoUploadEnabled },
12
+ } = await API.post('auto_upload', { value: toggledAutoUploadEnabled });
13
+ dispatch({
14
+ type: AUTO_UPLOAD_TOGGLE,
15
+ payload: {
16
+ autoUploadEnabled,
17
+ },
18
+ });
19
+ } catch (error) {
20
+ dispatch({
21
+ type: AUTO_UPLOAD_TOGGLE_ERROR,
22
+ payload: {
23
+ error: error.message,
24
+ },
25
+ });
26
+ }
27
+ };
@@ -0,0 +1,2 @@
1
+ export const AUTO_UPLOAD_TOGGLE = 'AUTO_UPLOAD_TOGGLE';
2
+ export const AUTO_UPLOAD_TOGGLE_ERROR = 'AUTO_UPLOAD_TOGGLE_ERROR';
@@ -0,0 +1,14 @@
1
+ import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
+ import { noop } from 'patternfly-react';
3
+
4
+ import AutoUploadSwitcher from '../AutoUploadSwitcher';
5
+
6
+ const fixtures = {
7
+ 'render with props': { autoUploadEnabled: true, handleToggle: noop },
8
+ /** fixtures, props for the component */
9
+ };
10
+
11
+ describe('AutoUploadSwitcher', () => {
12
+ describe('rendering', () =>
13
+ testComponentSnapshotsWithFixtures(AutoUploadSwitcher, fixtures));
14
+ });
@@ -0,0 +1,14 @@
1
+ import { testActionSnapshotWithFixtures } from '@theforeman/test';
2
+ import API from 'foremanReact/API';
3
+ import { handleToggle } from '../AutoUploadSwitcherActions';
4
+ import { handleToggleResponse } from '../AutoUploadSwitcher.fixtures';
5
+
6
+ jest.mock('foremanReact/API');
7
+ API.post.mockImplementation(async () => handleToggleResponse);
8
+
9
+ const fixtures = {
10
+ 'should handleToggle': () => handleToggle(),
11
+ };
12
+
13
+ describe('AutoUploadSwitcher actions', () =>
14
+ testActionSnapshotWithFixtures(fixtures));
@@ -0,0 +1,38 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`AutoUploadSwitcher rendering render with props 1`] = `
4
+ <div
5
+ className="auto_upload_switcher"
6
+ >
7
+ <Switch
8
+ animate={true}
9
+ baseClass="bootstrap-switch"
10
+ bsSize={null}
11
+ defaultValue={true}
12
+ disabled={false}
13
+ handleWidth="auto"
14
+ inverse={false}
15
+ labelText=" "
16
+ labelWidth="auto"
17
+ offColor="default"
18
+ offText="OFF"
19
+ onChange={[Function]}
20
+ onColor="primary"
21
+ onText="ON"
22
+ readonly={false}
23
+ size="mini"
24
+ tristate={false}
25
+ value={true}
26
+ wrapperClass="wrapper"
27
+ />
28
+ <FieldLevelHelp
29
+ buttonClass=""
30
+ content="Enable automatic upload of your host inventory to the Red Hat cloud"
31
+ placement="top"
32
+ rootClose={true}
33
+ />
34
+ <span>
35
+ Allow Auto Upload
36
+ </span>
37
+ </div>
38
+ `;
@@ -0,0 +1,14 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`AutoUploadSwitcher actions should handleToggle 1`] = `
4
+ Array [
5
+ Array [
6
+ Object {
7
+ "payload": Object {
8
+ "autoUploadEnabled": true,
9
+ },
10
+ "type": "AUTO_UPLOAD_TOGGLE",
11
+ },
12
+ ],
13
+ ]
14
+ `;
@@ -0,0 +1,3 @@
1
+ .auto_upload_switcher {
2
+ float: right;
3
+ }
@@ -0,0 +1,17 @@
1
+ import { bindActionCreators } from 'redux';
2
+ import { connect } from 'react-redux';
3
+
4
+ import * as actions from './AutoUploadSwitcherActions';
5
+ import AutoUploadSwitcher from './AutoUploadSwitcher';
6
+ import { selectAutoUploadEnabled } from '../AccountList/AccountListSelectors';
7
+
8
+ // map state to props
9
+ const mapStateToProps = state => ({
10
+ autoUploadEnabled: selectAutoUploadEnabled(state),
11
+ });
12
+
13
+ // map action dispatchers to props
14
+ const mapDispatchToProps = dispatch => bindActionCreators(actions, dispatch);
15
+
16
+ // export connected component
17
+ export default connect(mapStateToProps, mapDispatchToProps)(AutoUploadSwitcher);
@@ -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
- logs,
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';