foreman_acd 0.7.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +17 -2
  4. data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
  5. data/app/controllers/foreman_acd/app_instances_controller.rb +15 -30
  6. data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
  7. data/app/controllers/ui_acd_controller.rb +42 -3
  8. data/app/lib/actions/foreman_acd/run_configurator.rb +1 -0
  9. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +40 -27
  10. data/app/models/foreman_acd/app_instance.rb +47 -2
  11. data/app/models/foreman_acd/foreman_host.rb +8 -0
  12. data/app/services/foreman_acd/app_deployer.rb +19 -2
  13. data/app/services/foreman_acd/inventory_creator.rb +11 -1
  14. data/app/views/foreman_acd/app_definitions/_form.html.erb +4 -0
  15. data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
  16. data/app/views/foreman_acd/app_definitions/index.html.erb +3 -6
  17. data/app/views/foreman_acd/app_instances/_form.html.erb +4 -0
  18. data/app/views/foreman_acd/app_instances/index.html.erb +15 -11
  19. data/app/views/foreman_acd/app_instances/report.html.erb +7 -2
  20. data/app/views/ui_acd/host_report.json.rabl +4 -0
  21. data/app/views/ui_acd/report_data.json.rabl +10 -0
  22. data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
  23. data/config/routes.rb +3 -0
  24. data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
  25. data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
  26. data/lib/foreman_acd/plugin.rb +9 -9
  27. data/lib/foreman_acd/version.rb +1 -1
  28. data/lib/foreman_acd.rb +27 -9
  29. data/package.json +8 -25
  30. data/test/controllers/ui_acd_controller_test.rb +4 -1
  31. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  32. data/webpack/__snapshots__/helper.test.js.snap +1 -1
  33. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +34 -10
  34. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +12 -0
  35. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
  36. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
  37. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
  38. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +1 -0
  39. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +12 -0
  40. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +31 -5
  41. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +8 -0
  42. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +1 -1
  43. data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +3 -3
  44. data/webpack/components/ApplicationDefinition/index.js +8 -0
  45. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
  46. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
  47. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
  48. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
  49. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
  50. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
  51. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
  52. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
  53. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
  54. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
  55. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
  56. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
  57. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
  58. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
  59. data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
  60. data/webpack/components/ApplicationInstance/ApplicationInstance.js +102 -26
  61. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +118 -6
  62. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -0
  63. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
  64. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +71 -30
  65. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
  66. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +2 -0
  67. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +1 -0
  68. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +12 -0
  69. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +12 -0
  70. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +98 -7
  71. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +271 -0
  72. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +8 -0
  73. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
  74. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
  75. data/webpack/components/ApplicationInstance/helper.js +0 -0
  76. data/webpack/components/ApplicationInstance/index.js +8 -0
  77. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +81 -6
  78. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +35 -1
  79. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +3 -0
  80. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -0
  81. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
  82. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +1 -124
  83. data/webpack/components/ApplicationInstanceReport/index.js +8 -1
  84. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
  85. data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
  86. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
  87. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
  88. data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
  89. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
  90. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
  91. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
  92. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
  93. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
  94. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
  95. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
  96. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
  97. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
  98. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
  99. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
  100. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
  101. data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
  102. data/webpack/components/ExistingHostSelection/index.js +26 -0
  103. data/webpack/components/ParameterSelection/ParameterSelection.js +103 -1
  104. data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
  105. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +46 -4
  106. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
  107. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
  108. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +52 -11
  109. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -0
  110. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +8 -0
  111. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +2 -0
  112. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -0
  113. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +96 -0
  114. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +117 -17
  115. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +13 -0
  116. data/webpack/components/ParameterSelection/index.js +4 -1
  117. data/webpack/components/SyncGitRepo/SyncGitRepo.js +2 -10
  118. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +2 -3
  119. data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +0 -1
  120. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +1 -0
  121. data/webpack/components/SyncGitRepo/components/FormTextInput.js +1 -1
  122. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +3 -2
  123. data/webpack/components/common/DeleteTableEntry.js +16 -2
  124. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +38 -0
  125. data/webpack/helper.js +21 -1
  126. data/webpack/helper.test.js +20 -1
  127. data/webpack/index.js +5 -0
  128. data/webpack/js-yaml.js +3874 -0
  129. data/webpack/reducer.js +13 -2
  130. data/webpack/test_setup.js +0 -2
  131. metadata +46 -2
@@ -0,0 +1,6 @@
1
+ export const APPLICATION_DEFINITION_IMPORT_INIT = 'INIT_APPLICATION_DEFINITION_IMPORT_INIT';
2
+ export const APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE = 'APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE';
3
+ export const APPLICATION_DEFINITION_IMPORT_FILE_FAILURE = 'APPLICATION_DEFINITION_IMPORT_FILE_FAILURE';
4
+ export const APPLICATION_DEFINITION_IMPORT_FILE_REQUEST = 'APPLICATION_DEFINITION_IMPORT_FILE_REQUEST';
5
+ export const APPLICATION_DEFINITION_IMPORT_FILE_SUCCESS = 'APPLICATION_DEFINITION_IMPORT_FILE_SUCCESS';
6
+ export const APPLICATION_DEFINITION_IMPORT_CLOSE_ALERT_MODAL = 'APPLICATION_DEFINITION_IMPORT_CLOSE_ALERT_MODAL';
@@ -0,0 +1,79 @@
1
+ import Immutable from 'seamless-immutable';
2
+
3
+ import {
4
+ cloneDeep,
5
+ findIndex,
6
+ findLastIndex,
7
+ } from 'lodash';
8
+
9
+ import { translate as __ } from 'foremanReact/common/I18n';
10
+
11
+ import {
12
+ APPLICATION_DEFINITION_IMPORT_INIT,
13
+ APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE,
14
+ APPLICATION_DEFINITION_IMPORT_FILE_FAILURE,
15
+ APPLICATION_DEFINITION_IMPORT_FILE_REQUEST,
16
+ APPLICATION_DEFINITION_IMPORT_FILE_SUCCESS,
17
+ APPLICATION_DEFINITION_IMPORT_CLOSE_ALERT_MODAL,
18
+ } from './ApplicationDefinitionImportConstants';
19
+
20
+ export const initialState = Immutable({
21
+ name: false,
22
+ error: { errorMsg: '', status: '', statusText: '' },
23
+ });
24
+
25
+ const applicationDefinitionImportConf = (state = initialState, action) => {
26
+ const { payload } = action;
27
+
28
+ switch (action.type) {
29
+ case APPLICATION_DEFINITION_IMPORT_INIT: {
30
+ return state.merge(payload);
31
+ }
32
+
33
+ case APPLICATION_DEFINITION_IMPORT_CLOSE_ALERT_MODAL: {
34
+ return state.merge({
35
+ showAlertModal: false,
36
+ alertModalTitle: '',
37
+ alertModalText: '',
38
+ });
39
+ }
40
+
41
+ case APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE: {
42
+ const services = cloneDeep(state.ansiblePlaybookServices);
43
+ const index = findIndex(services, { id: payload.rowData.id });
44
+
45
+ services[index][payload.property] = payload.value;
46
+
47
+ return state.set('ansiblePlaybookServices', services);
48
+ }
49
+
50
+ case APPLICATION_DEFINITION_IMPORT_FILE_FAILURE: {
51
+ return state.merge({ error: payload.error, loading: false });
52
+ }
53
+ case APPLICATION_DEFINITION_IMPORT_FILE_REQUEST: {
54
+ return state.set('loading', true);
55
+ }
56
+ case APPLICATION_DEFINITION_IMPORT_FILE_SUCCESS: {
57
+ let newState = {};
58
+ let ansibleServices = [];
59
+ const ansiblePlaybookServices = payload.ansiblePlaybookServices['ansible_services'];
60
+
61
+ for (var ind in ansiblePlaybookServices) {
62
+ const value = ansiblePlaybookServices[ind];
63
+ const newRow = { id: value['id'], name: value['value'], hostgroup: '' };
64
+ newRow.backup = cloneDeep(newRow);
65
+ ansibleServices.push(newRow);
66
+ }
67
+
68
+ newState = {
69
+ ansiblePlaybookServices: ansibleServices,
70
+ };
71
+
72
+ return state.merge(newState);
73
+ }
74
+ default:
75
+ return state;
76
+ }
77
+ };
78
+
79
+ export default applicationDefinitionImportConf;
@@ -0,0 +1,8 @@
1
+ const applicationDefinitionImportConf = state => state.foremanAcd.applicationDefinitionImportConf;
2
+
3
+ export const selectEditMode = state => applicationDefinitionImportConf(state).editMode;
4
+ export const selectColumns = state => applicationDefinitionImportConf(state).columns;
5
+ export const selectAnsiblePlaybookServices = state => applicationDefinitionImportConf(state).ansiblePlaybookServices;
6
+ export const selectShowAlertModal = state => applicationDefinitionImportConf(state).showAlertModal;
7
+ export const selectAlertModalText = state => applicationDefinitionImportConf(state).alertModalText;
8
+ export const selectAlertModalTitle = state => applicationDefinitionImportConf(state).alertModalTitle;
@@ -0,0 +1,129 @@
1
+ export const applicationDefinitionImportConfData_1 = {
2
+ name: false,
3
+ error: {
4
+ errorMsg: '',
5
+ status: '',
6
+ statusText: ''
7
+ },
8
+ columns: [
9
+ {
10
+ property: 'name',
11
+ header: {
12
+ label: 'Service name',
13
+ formatters: [
14
+ null
15
+ ],
16
+ props: {
17
+ index: 3,
18
+ style: {
19
+ width: '20%'
20
+ }
21
+ }
22
+ },
23
+ cell: {
24
+ formatters: [
25
+ null
26
+ ]
27
+ }
28
+ },
29
+ {
30
+ property: 'hostgroup',
31
+ header: {
32
+ label: 'Hostgroup',
33
+ formatters: [
34
+ null
35
+ ],
36
+ props: {
37
+ index: 2,
38
+ style: {
39
+ width: '20%'
40
+ }
41
+ }
42
+ },
43
+ cell: {
44
+ formatters: [
45
+ null
46
+ ]
47
+ }
48
+ }
49
+ ],
50
+ ansiblePlaybookServices: [
51
+ {
52
+ id: 1,
53
+ name: 'web',
54
+ description: '',
55
+ hostgroup: '1',
56
+ ansibleGroup: 'webservers',
57
+ minCount: '2',
58
+ maxCount: '',
59
+ foremanParameters: [
60
+ {
61
+ id: 1,
62
+ locked: false,
63
+ name: 'CP',
64
+ description: '',
65
+ type: 'computeprofile',
66
+ value: '1'
67
+ },
68
+ {
69
+ id: 2,
70
+ locked: true,
71
+ name: 'LE',
72
+ description: '',
73
+ type: 'lifecycleenv',
74
+ value: '1'
75
+ }
76
+ ],
77
+ ansibleParameters: [
78
+ {
79
+ id: 0,
80
+ name: 'dummy_var',
81
+ value: '0'
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ id: 2,
87
+ name: 'db',
88
+ description: '',
89
+ hostgroup: '1',
90
+ ansibleGroup: 'dbservers',
91
+ minCount: '1',
92
+ maxCount: '',
93
+ foremanParameters: [],
94
+ ansibleParameters: [
95
+ {
96
+ id: 0,
97
+ name: 'mysqlservice',
98
+ value: 'mysqld'
99
+ },
100
+ {
101
+ id: 1,
102
+ name: 'mysql_port',
103
+ value: '3306',
104
+ locked: true
105
+ },
106
+ {
107
+ id: 2,
108
+ name: 'dbuser',
109
+ value: 'webapp'
110
+ },
111
+ {
112
+ id: 3,
113
+ name: 'dbname',
114
+ value: 'ANSAP01'
115
+ },
116
+ {
117
+ id: 4,
118
+ name: 'upassword',
119
+ value: 'Bond@007'
120
+ },
121
+ {
122
+ id: 5,
123
+ name: 'masterpassword',
124
+ value: 'MySQL@007'
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+ }
@@ -0,0 +1,29 @@
1
+ import Immutable from 'seamless-immutable';
2
+ import {
3
+ cloneDeep,
4
+ findIndex,
5
+ findLastIndex,
6
+ } from 'lodash';
7
+
8
+ import {
9
+ applicationDefinitionImportConfData_1,
10
+ } from '../__fixtures__/applicationDefinitionImportConfData_1.fixtures';
11
+
12
+ export const successState = Immutable(applicationDefinitionImportConfData_1);
13
+
14
+ const EDIT_ROW_ID = 2;
15
+
16
+ const editClone = applicationDefinitionImportConfData_1;
17
+ const editIndex = findIndex(editClone.ansiblePlaybookServices, { id: EDIT_ROW_ID })
18
+ editClone["ansiblePlaybookServices"][editIndex].backup = cloneDeep(editClone["ansiblePlaybookServices"][editIndex]);
19
+ export const editState = Immutable(editClone);
20
+
21
+ // Payload Data
22
+ export const initApplicationDefinitionImportPayload = applicationDefinitionImportConfData_1;
23
+ export const changeEditServicePayload = {
24
+ value: "helloworld",
25
+ property: "name",
26
+ rowData: {
27
+ id: EDIT_ROW_ID,
28
+ }
29
+ };
@@ -0,0 +1,20 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import ApplicationDefinitionImport from '../ApplicationDefinitionImport';
4
+
5
+ const noop = () => {};
6
+
7
+ const fixtures = {
8
+ 'should render application definition import': {
9
+ location: "Default Location",
10
+ organization: "Default Organization",
11
+ hostgroups: [],
12
+ ansiblePlaybookServices: [],
13
+ initApplicationDefinitionImport: noop,
14
+ addApplicationDefinitionImportService: noop,
15
+ closeAlertModal: noop,
16
+ },
17
+ };
18
+
19
+ describe('ApplicationDefinitionImport', () =>
20
+ testComponentSnapshotsWithFixtures(ApplicationDefinitionImport, fixtures));
@@ -0,0 +1,43 @@
1
+ import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import reducer, { initialState } from '../ApplicationDefinitionImportReducer';
3
+
4
+ import {
5
+ successState,
6
+ editState,
7
+ initApplicationDefinitionImportPayload,
8
+ changeEditServicePayload,
9
+ } from '../__fixtures__/applicationDefinitionImportReducer.fixtures';
10
+
11
+ import {
12
+ APPLICATION_DEFINITION_IMPORT_INIT,
13
+ APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE,
14
+ APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CANCEL,
15
+ } from '../ApplicationDefinitionImportConstants';
16
+
17
+ const fixtures = {
18
+ 'should return initial state': {
19
+ state: initialState,
20
+ action: {
21
+ type: undefined,
22
+ payload: {},
23
+ },
24
+ },
25
+
26
+ 'should initialize component': {
27
+ state: initialState,
28
+ action: {
29
+ type: APPLICATION_DEFINITION_IMPORT_INIT,
30
+ payload: initApplicationDefinitionImportPayload,
31
+ },
32
+ },
33
+ 'should change edit service': {
34
+ state: editState,
35
+ action: {
36
+ type: APPLICATION_DEFINITION_IMPORT_SERVICE_EDIT_CHANGE,
37
+ payload: changeEditServicePayload,
38
+ },
39
+ },
40
+ };
41
+
42
+ describe('ApplicationDefinitionImportReducer', () =>
43
+ testReducerSnapshotWithFixtures(reducer, fixtures));
@@ -0,0 +1,29 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import {
4
+ selectEditMode,
5
+ selectAnsiblePlaybookServices,
6
+ selectColumns,
7
+ } from '../ApplicationDefinitionImportSelectors';
8
+
9
+ import {
10
+ applicationDefinitionImportConfData_1,
11
+ } from '../__fixtures__/applicationDefinitionImportConfData_1.fixtures';
12
+
13
+ const stateFactory = obj => ({
14
+ foremanAcd: {
15
+ applicationDefinitionImportConf: obj,
16
+ },
17
+ });
18
+
19
+ const fixtures = {
20
+ 'should return editMode from applicationDefinitionImportConfData_1 fixtures': () =>
21
+ selectEditMode(stateFactory(applicationDefinitionImportConfData_1)),
22
+ 'should return services from applicationDefinitionImportConfData_1 fixtures': () =>
23
+ selectAnsiblePlaybookServices(stateFactory(applicationDefinitionImportConfData_1)),
24
+ 'should return columns from applicationDefinitionImportConfData_1 fixtures': () =>
25
+ selectColumns(stateFactory(applicationDefinitionImportConfData_1)),
26
+ };
27
+
28
+ describe('ApplicationDefinitionImportSelectors', () =>
29
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,62 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ApplicationDefinitionImport should render application definition import 1`] = `
4
+ <span>
5
+ <Component />
6
+ <Component />
7
+ <MessageDialog
8
+ accessibleDescription=""
9
+ accessibleName=""
10
+ className=""
11
+ enforceFocus={true}
12
+ footer={null}
13
+ icon={
14
+ <Icon
15
+ name="error-circle-o"
16
+ type="pf"
17
+ />
18
+ }
19
+ onHide={[Function]}
20
+ primaryAction={[Function]}
21
+ primaryActionButtonBsStyle="danger"
22
+ primaryActionButtonContent="OK"
23
+ primaryContent=""
24
+ secondaryAction={[Function]}
25
+ secondaryActionButtonBsStyle="default"
26
+ secondaryActionButtonContent={null}
27
+ secondaryContent={null}
28
+ show={false}
29
+ title=""
30
+ />
31
+ <div>
32
+ <CommonForm
33
+ className="custom-file-upload"
34
+ label="Application Definition file"
35
+ >
36
+ <input
37
+ onChange={[Function]}
38
+ type="file"
39
+ />
40
+ </CommonForm>
41
+ <CommonForm>
42
+ <Button
43
+ active={false}
44
+ block={false}
45
+ bsClass="btn"
46
+ bsStyle="default"
47
+ disabled={false}
48
+ onClick={[Function]}
49
+ >
50
+ Import
51
+
52
+ </Button>
53
+ </CommonForm>
54
+ </div>
55
+ <RailsData
56
+ key="applications_definition_import"
57
+ parameter="services"
58
+ value="[]"
59
+ view="app_definition_import"
60
+ />
61
+ </span>
62
+ `;