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
@@ -1,4 +1,6 @@
1
1
  import Immutable from 'seamless-immutable';
2
+ import { translate as __ } from 'foremanReact/common/I18n';
3
+ import { calculateServiceUsage } from './ApplicationInstanceHelper';
2
4
 
3
5
  import {
4
6
  cloneDeep,
@@ -8,6 +10,7 @@ import {
8
10
 
9
11
  import {
10
12
  APPLICATION_INSTANCE_INIT,
13
+ APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
11
14
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE,
12
15
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST,
13
16
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS,
@@ -17,10 +20,13 @@ import {
17
20
  APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
18
21
  APPLICATION_INSTANCE_HOST_EDIT_CHANGE,
19
22
  APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
23
+ APPLICATION_INSTANCE_HOST_EDIT_ERROR,
20
24
  APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
21
25
  APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
22
26
  APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
23
27
  APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
28
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN,
29
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE,
24
30
  APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
25
31
  } from './ApplicationInstanceConstants';
26
32
 
@@ -41,7 +47,15 @@ const applicationInstanceConf = (state = initialState, action) => {
41
47
  case APPLICATION_INSTANCE_INIT: {
42
48
  return state.merge(payload);
43
49
  }
50
+ case APPLICATION_INSTANCE_CLOSE_ALERT_MODAL: {
51
+ return state.merge({
52
+ showAlertModal: false,
53
+ alertModalTitle: '',
54
+ alertModalText: '',
55
+ });
56
+ }
44
57
  case APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE: {
58
+ console.log("Error while loading application definition data: "+ payload.error);
45
59
  return state.merge({ error: payload.error, loading: false });
46
60
  }
47
61
  case APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST: {
@@ -87,7 +101,7 @@ const applicationInstanceConf = (state = initialState, action) => {
87
101
  index = Math.max(...hosts.map(e => e.id)) + 1;
88
102
  }
89
103
 
90
- const newRow = {id: index, hostname: "", description: '', service: '', foremanParameters: [], ansibleParameters: [], newEntry: true };
104
+ const newRow = {id: index, hostname: "", description: '', service: '', isExistingHost: false, foremanParameters: [], ansibleParameters: [], newEntry: true };
91
105
  newRow.backup = cloneDeep(newRow)
92
106
  hosts.push(newRow);
93
107
 
@@ -125,48 +139,28 @@ const applicationInstanceConf = (state = initialState, action) => {
125
139
  case APPLICATION_INSTANCE_HOST_EDIT_CONFIRM: {
126
140
  const hosts = cloneDeep(state.hosts);
127
141
  const index = findIndex(hosts, { id: payload.rowData.id });
128
- const services = cloneDeep(state.services);
142
+ let services = cloneDeep(state.services);
129
143
 
130
144
  const thisHost = hosts[index];
131
145
 
132
- if (thisHost.hostname == '') {
133
- window.alert("Every host needs to have a valid name");
134
- return state;
135
- }
136
-
137
146
  // hostnames are lower case
138
147
  thisHost.hostname = thisHost.hostname.toLowerCase();
139
148
 
140
- const hostnameRegex = /^[0-9a-z]([0-9a-z\-]{0,61}[0-9a-z])$/;
141
-
142
- if (thisHost.hostname.match(hostnameRegex) == undefined) {
143
- window.alert("The hostname uses not allowed characters. See https://en.wikipedia.org/wiki/Hostname#Syntax for more details.")
144
- return state;
145
- }
146
-
147
- if (thisHost.service == '') {
148
- window.alert("Every host needs to be assigned to a service.");
149
- return state;
150
- }
151
-
152
149
  if (state.hosts.filter(v => v.hostname === thisHost.hostname && v.id != thisHost.id).length > 0) {
153
- window.alert("Host name already used in this Application Instance. Please make sure that every host name is unique.");
154
- return state;
150
+ return state.merge({
151
+ showAlertModal: true,
152
+ alertModalTitle: __("Error"),
153
+ alertModalText: __("Host name already used in this Application Instance. Please make sure that every host name is unique."),
154
+ });
155
155
  }
156
156
 
157
157
  // Initialize the new Instance with the parameters of the Application Definition.
158
158
  if (thisHost.newEntry === true) {
159
- const selectedService = state.services.filter(entry => entry.id == payload.rowData.service)[0];
159
+ const hostServiceId = Number(thisHost.service);
160
+ const selectedService = services.filter(entry => entry.id == hostServiceId)[0];
160
161
  hosts[index].foremanParameters = selectedService.foremanParameters;
161
162
  hosts[index].ansibleParameters = selectedService.ansibleParameters;
162
-
163
- const hostServiceId = Number(thisHost.service);
164
- const service = services.find(serv => serv['id'] == hostServiceId);
165
- if ('currentCount' in service) {
166
- service['currentCount'] += 1;
167
- } else {
168
- service['currentCount'] = 1;
169
- }
163
+ services = calculateServiceUsage(hostServiceId, services);
170
164
  }
171
165
 
172
166
  delete hosts[index].backup;
@@ -202,6 +196,13 @@ const applicationInstanceConf = (state = initialState, action) => {
202
196
  hosts: hosts
203
197
  });
204
198
  }
199
+ case APPLICATION_INSTANCE_HOST_EDIT_ERROR: {
200
+ return state.merge({
201
+ showAlertModal: true,
202
+ alertModalTitle: __("Error"),
203
+ alertModalText: payload,
204
+ });
205
+ }
205
206
  case APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN: {
206
207
  let parametersData = {};
207
208
 
@@ -298,6 +299,46 @@ const applicationInstanceConf = (state = initialState, action) => {
298
299
  }
299
300
  return state.merge(newState);
300
301
  }
302
+ case APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN: {
303
+ }
304
+ case APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE: {
305
+ if (payload.mode == 'save') {
306
+ let newState;
307
+ let hosts = [];
308
+ let index = 1;
309
+ let services = cloneDeep(state.services);
310
+
311
+ if ('hosts' in state && state.hosts !== undefined && state.hosts.length > 0) {
312
+ hosts = cloneDeep(state.hosts);
313
+ index = Math.max(...hosts.map(e => e.id));
314
+ }
315
+
316
+ payload.selectedHosts.forEach(host => {
317
+ if ((state.hosts == undefined) || (state.hosts.find(h => h.hostname == host.hostname) == undefined)) {
318
+ index += 1;
319
+ const selectedService = services.filter(entry => entry.id == host.serviceId)[0];
320
+ const newRow = {
321
+ id: index,
322
+ hostname: host.hostname,
323
+ description: '',
324
+ service: host.serviceId,
325
+ isExistingHost: true,
326
+ foremanParameters: [], // we will never set this because we don't want to change a already existing host.
327
+ ansibleParameters: selectedService.ansibleParameters,
328
+ }
329
+ hosts.push(newRow);
330
+ services = calculateServiceUsage(host.serviceId, services);
331
+ }
332
+ });
333
+
334
+ return state.merge({
335
+ hosts: hosts,
336
+ services, services
337
+ });
338
+ } else {
339
+ return state;
340
+ }
341
+ }
301
342
  case APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE: {
302
343
  return state.merge({ paramEditMode: payload.mode });
303
344
  }
@@ -1,9 +1,13 @@
1
1
  const applicationInstanceConf = state => state.foremanAcd.applicationInstanceConf;
2
2
 
3
+ export const selectShowAlertModal = state => applicationInstanceConf(state).showAlertModal;
4
+ export const selectAlertModalText = state => applicationInstanceConf(state).alertModalText;
5
+ export const selectAlertModalTitle = state => applicationInstanceConf(state).alertModalTitle;
3
6
  export const selectEditMode = state => applicationInstanceConf(state).editMode;
4
7
  export const selectAppDefinition = state => applicationInstanceConf(state).appDefinition;
5
8
  export const selectHosts = state => applicationInstanceConf(state).hosts;
6
9
  export const selectColumns = state => applicationInstanceConf(state).columns;
10
+ export const selectHiddenForemanParameterTypes = state => applicationInstanceConf(state).hiddenForemanParameterTypes;
7
11
  export const selectServices = state => applicationInstanceConf(state).services;
8
12
  export const selectParametersData = state => applicationInstanceConf(state).parametersData;
9
13
  export const selectAnsibleVarsAll = state => applicationInstanceConf(state).ansibleVarsAll;
@@ -20,6 +20,8 @@ export const editState = Immutable(editClone);
20
20
 
21
21
  // Payload Data
22
22
  export const initApplicationInstancePayload = applicationInstanceConfData_1;
23
+
24
+ export const closeAlertModalPayload = { };
23
25
  export const addHostPayload = { };
24
26
  export const deleteHostPayload = {
25
27
  rowData: {
@@ -13,6 +13,7 @@ const fixtures = {
13
13
  hosts: [],
14
14
  ansibleVarsAll: [],
15
15
  },
16
+ closeAlertModal: noop,
16
17
  loadApplicationDefinition: noop,
17
18
  initApplicationInstance: noop,
18
19
  addApplicationInstanceHost: noop,
@@ -5,6 +5,7 @@ import {
5
5
  successState,
6
6
  editState,
7
7
  initApplicationInstancePayload,
8
+ closeAlertModalPayload,
8
9
  addHostPayload,
9
10
  deleteHostPayload,
10
11
  activateEditHostPayload,
@@ -18,6 +19,7 @@ import {
18
19
 
19
20
  import {
20
21
  APPLICATION_INSTANCE_INIT,
22
+ APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
21
23
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST,
22
24
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS,
23
25
  APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE,
@@ -27,10 +29,13 @@ import {
27
29
  APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
28
30
  APPLICATION_INSTANCE_HOST_EDIT_CHANGE,
29
31
  APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
32
+ APPLICATION_INSTANCE_HOST_EDIT_ERROR,
30
33
  APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
31
34
  APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
32
35
  APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
33
36
  APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
37
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN,
38
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE,
34
39
  APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
35
40
  } from '../ApplicationInstanceConstants';
36
41
 
@@ -50,6 +55,13 @@ const fixtures = {
50
55
  payload: initApplicationInstancePayload,
51
56
  },
52
57
  },
58
+ 'should close alert modal': {
59
+ state: successState,
60
+ action: {
61
+ type: APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
62
+ payload: closeAlertModalPayload,
63
+ },
64
+ },
53
65
  'should add a host': {
54
66
  state: successState,
55
67
  action: {
@@ -1,10 +1,14 @@
1
1
  import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
2
 
3
3
  import {
4
+ selectShowAlertModal,
5
+ selectAlertModalText,
6
+ selectAlertModalTitle,
4
7
  selectEditMode,
5
8
  selectAppDefinition,
6
9
  selectHosts,
7
10
  selectColumns,
11
+ selectHiddenForemanParameterTypes,
8
12
  selectServices,
9
13
  selectParametersData,
10
14
  selectAnsibleVarsAll,
@@ -22,6 +26,12 @@ const stateFactory = obj => ({
22
26
  });
23
27
 
24
28
  const fixtures = {
29
+ 'should return showAlertModal from applicationInstanceConfData_1 fixtures': () =>
30
+ selectShowAlertModal(stateFactory(applicationInstanceConfData_1)),
31
+ 'should return alertModalText from applicationInstanceConfData_1 fixtures': () =>
32
+ selectAlertModalText(stateFactory(applicationInstanceConfData_1)),
33
+ 'should return alertModalTitle from applicationInstanceConfData_1 fixtures': () =>
34
+ selectAlertModalTitle(stateFactory(applicationInstanceConfData_1)),
25
35
  'should return editMode from applicationInstanceConfData_1 fixtures': () =>
26
36
  selectEditMode(stateFactory(applicationInstanceConfData_1)),
27
37
  'should return appDefinition from applicationInstanceConfData_1 fixtures': () =>
@@ -30,6 +40,8 @@ const fixtures = {
30
40
  selectHosts(stateFactory(applicationInstanceConfData_1)),
31
41
  'should return columns from applicationInstanceConfData_1 fixtures': () =>
32
42
  selectColumns(stateFactory(applicationInstanceConfData_1)),
43
+ 'should return hiddenForemanParameterTypes from applicationInstanceConfData_1 fixtures': () =>
44
+ selectHiddenForemanParameterTypes(stateFactory(applicationInstanceConfData_1)),
33
45
  'should return services from applicationInstanceConfData_1 fixtures': () =>
34
46
  selectServices(stateFactory(applicationInstanceConfData_1)),
35
47
  'should return parametersData from applicationInstanceConfData_1 fixtures': () =>
@@ -2,8 +2,32 @@
2
2
 
3
3
  exports[`ApplicationInstance should render application instance 1`] = `
4
4
  <span>
5
+ <MessageDialog
6
+ accessibleDescription=""
7
+ accessibleName=""
8
+ className=""
9
+ enforceFocus={true}
10
+ footer={null}
11
+ icon={
12
+ <Icon
13
+ name="error-circle-o"
14
+ type="pf"
15
+ />
16
+ }
17
+ onHide={[Function]}
18
+ primaryAction={[Function]}
19
+ primaryActionButtonBsStyle="danger"
20
+ primaryActionButtonContent="OK"
21
+ primaryContent=""
22
+ secondaryAction={[Function]}
23
+ secondaryActionButtonBsStyle="default"
24
+ secondaryActionButtonContent={null}
25
+ secondaryContent={null}
26
+ show={false}
27
+ title=""
28
+ />
5
29
  <div
6
- class="service-counter"
30
+ className="service-counter"
7
31
  >
8
32
  <ServiceCounter
9
33
  hostList={Array []}
@@ -19,12 +43,13 @@ exports[`ApplicationInstance should render application instance 1`] = `
19
43
  }
20
44
  }
21
45
  editable={false}
46
+ hidden={false}
22
47
  label="Application Definition"
23
48
  onChange={[Function]}
24
49
  selectValue=""
25
50
  viewText=""
26
51
  />
27
- <p
52
+ <div
28
53
  style={
29
54
  Object {
30
55
  "paddingTop": 25,
@@ -34,7 +59,7 @@ exports[`ApplicationInstance should render application instance 1`] = `
34
59
  <pre>
35
60
  App Definition can't be blank
36
61
  </pre>
37
- </p>
62
+ </div>
38
63
  </div>
39
64
  <div
40
65
  className="form-group"
@@ -75,6 +100,28 @@ exports[`ApplicationInstance should render application instance 1`] = `
75
100
  hidden={false}
76
101
  onAddTableEntry={[Function]}
77
102
  />
103
+ <span
104
+ style={
105
+ Object {
106
+ "marginLeft": 10,
107
+ }
108
+ }
109
+ >
110
+ <Button
111
+ active={false}
112
+ block={false}
113
+ bsClass="btn"
114
+ bsStyle="default"
115
+ disabled={true}
116
+ onClick={[Function]}
117
+ >
118
+ <Icon
119
+ name="server"
120
+ title="Add existing hosts"
121
+ type="pf"
122
+ />
123
+ </Button>
124
+ </span>
78
125
  <span
79
126
  style={
80
127
  Object {
@@ -88,7 +135,7 @@ exports[`ApplicationInstance should render application instance 1`] = `
88
135
  block={false}
89
136
  bsClass="btn"
90
137
  bsStyle="default"
91
- disabled={false}
138
+ disabled={true}
92
139
  onClick={[Function]}
93
140
  style={
94
141
  Object {
@@ -97,7 +144,7 @@ exports[`ApplicationInstance should render application instance 1`] = `
97
144
  }
98
145
  >
99
146
  <span
100
- title="change ansible variables for 'all'"
147
+ title="Change ansible variables for 'all'"
101
148
  >
102
149
  A
103
150
  </span>
@@ -118,6 +165,7 @@ exports[`ApplicationInstance should render application instance 1`] = `
118
165
  <Connect(ParameterSelection)
119
166
  data={Object {}}
120
167
  editModeCallback={[Function]}
168
+ hiddenParameterTypes={Array []}
121
169
  location="Default Location"
122
170
  organization="Default Organization"
123
171
  paramType="PARAMETER_SELECTION_PARAM_TYPE_FOREMAN"
@@ -192,15 +240,58 @@ exports[`ApplicationInstance should render application instance 1`] = `
192
240
  </Footer>
193
241
  </ForemanModal>
194
242
  </div>
243
+ <div>
244
+ <ForemanModal
245
+ dialogClassName="add_existing_hosts_modal"
246
+ id="AppInstanceAddExistingHosts"
247
+ title="Add existing hosts to an Application Instance"
248
+ >
249
+ <Header
250
+ closeButton={false}
251
+ >
252
+ Existing hosts selection
253
+ </Header>
254
+ <Connect(ExistingHostSelection)
255
+ allHosts={Array []}
256
+ location="Default Location"
257
+ organization="Default Organization"
258
+ services={Array []}
259
+ />
260
+ <Footer>
261
+ <div>
262
+ <Button
263
+ active={false}
264
+ block={false}
265
+ bsClass="btn"
266
+ bsStyle="primary"
267
+ disabled={false}
268
+ onClick={[Function]}
269
+ >
270
+ Save
271
+ </Button>
272
+ <Button
273
+ active={false}
274
+ block={false}
275
+ bsClass="btn"
276
+ bsStyle="default"
277
+ disabled={false}
278
+ onClick={[Function]}
279
+ >
280
+ Cancel
281
+ </Button>
282
+ </div>
283
+ </Footer>
284
+ </ForemanModal>
285
+ </div>
195
286
  <div />
196
287
  <RailsData
197
- key="applications_instance"
288
+ key="application_instance_hosts_data"
198
289
  parameter="hosts"
199
290
  value="[]"
200
291
  view="app_instance"
201
292
  />
202
293
  <RailsData
203
- key="applications_instance"
294
+ key="application_instance_ansible_data"
204
295
  parameter="ansible_vars_all"
205
296
  value="[]"
206
297
  view="app_instance"