foreman_acd 0.4.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +84 -84
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +103 -11
  4. data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +21 -3
  5. data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -0
  6. data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +9 -1
  7. data/app/controllers/foreman_acd/app_definitions_controller.rb +117 -15
  8. data/app/controllers/foreman_acd/app_instances_controller.rb +104 -30
  9. data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
  10. data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
  11. data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
  12. data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
  13. data/app/controllers/foreman_acd/remote_execution_controller.rb +36 -23
  14. data/app/controllers/ui_acd_controller.rb +46 -0
  15. data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +47 -0
  16. data/app/lib/actions/foreman_acd/run_configurator.rb +45 -0
  17. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +39 -0
  18. data/app/models/foreman_acd/acd_provider.rb +36 -0
  19. data/app/models/foreman_acd/ansible_playbook.rb +32 -14
  20. data/app/models/foreman_acd/app_definition.rb +24 -1
  21. data/app/models/foreman_acd/app_instance.rb +85 -5
  22. data/app/models/foreman_acd/foreman_host.rb +31 -0
  23. data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
  24. data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
  25. data/app/services/foreman_acd/app_configurator.rb +64 -36
  26. data/app/services/foreman_acd/app_deployer.rb +83 -48
  27. data/app/services/foreman_acd/inventory_creator.rb +36 -25
  28. data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +50 -7
  29. data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +9 -1
  30. data/app/views/foreman_acd/ansible_playbooks/index.html.erb +3 -3
  31. data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +2 -0
  32. data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +2 -0
  33. data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +6 -0
  34. data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +2 -0
  35. data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +2 -0
  36. data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +6 -0
  37. data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +3 -1
  38. data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +2 -0
  39. data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +2 -0
  40. data/app/views/foreman_acd/app_definitions/_form.html.erb +9 -1
  41. data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -5
  42. data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
  43. data/app/views/foreman_acd/app_definitions/index.html.erb +5 -8
  44. data/app/views/foreman_acd/app_instances/_form.html.erb +4 -4
  45. data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
  46. data/app/views/foreman_acd/app_instances/index.html.erb +93 -14
  47. data/app/views/foreman_acd/app_instances/report.html.erb +12 -4
  48. data/app/views/templates/job/run_acd_ansible_playbook.erb +28 -15
  49. data/app/views/ui_acd/app_definition.json.rabl +1 -1
  50. data/app/views/ui_acd/host_report.json.rabl +4 -0
  51. data/app/views/ui_acd/report_data.json.rabl +10 -0
  52. data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
  53. data/config/routes.rb +12 -3
  54. data/db/migrate/20200917120220_add_ansible_playbook_id.rb +1 -1
  55. data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +3 -0
  56. data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +3 -0
  57. data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
  58. data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
  59. data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
  60. data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
  61. data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
  62. data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
  63. data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
  64. data/db/migrate/20210316151145_add_git_commit_to_ansible_playbooks.rb +8 -0
  65. data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +8 -0
  66. data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
  67. data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
  68. data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
  69. data/db/seeds.d/75-job_templates.rb +6 -1
  70. data/lib/foreman_acd/engine.rb +40 -3
  71. data/lib/foreman_acd/plugin.rb +60 -45
  72. data/lib/foreman_acd/version.rb +1 -1
  73. data/lib/foreman_acd.rb +30 -0
  74. data/lib/tasks/foreman_acd_tasks.rake +0 -12
  75. data/locale/en/foreman_acd.edit.po +326 -0
  76. data/locale/en/foreman_acd.po +232 -2
  77. data/{app/controllers/foreman_acd/api/v2/app_playbooks_controller.rb → locale/en/foreman_acd.po.time_stamp} +0 -0
  78. data/locale/foreman_acd.pot +343 -8
  79. data/package.json +8 -8
  80. data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
  81. data/test/controllers/app_instances_controller_test.rb +8 -3
  82. data/test/controllers/ui_acd_controller_test.rb +22 -6
  83. data/test/factories/foreman_acd_factories.rb +18 -4
  84. data/test/models/acd_provider_test.rb +37 -0
  85. data/test/models/ansible_playbook_test.rb +11 -0
  86. data/test/models/app_definition_test.rb +1 -1
  87. data/test/models/app_instance_test.rb +2 -0
  88. data/test/models/concerns/host_extensions_test.rb +26 -0
  89. data/test/models/foreman_host_test.rb +12 -0
  90. data/webpack/__mocks__/foremanReact/API.js +2 -0
  91. data/webpack/__mocks__/foremanReact/common/I18n.js +3 -0
  92. data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
  93. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  94. data/webpack/__mocks__/foremanReact/components/ForemanModal.js +7 -0
  95. data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
  96. data/webpack/__mocks__/foremanReact/components/common/forms/TextInput.js +2 -0
  97. data/webpack/__mocks__/foremanReact/components/hosts/powerStatus.js +1 -0
  98. data/webpack/__snapshots__/helper.test.js.snap +14 -0
  99. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +55 -21
  100. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +14 -0
  101. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +2 -0
  102. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +48 -1
  103. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
  104. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionConfData_1.fixtures.js +288 -0
  105. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +79 -0
  106. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +26 -0
  107. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
  108. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +41 -0
  109. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +225 -0
  110. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
  111. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +299 -0
  112. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +2 -1
  113. data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +41 -0
  114. data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +121 -0
  115. data/webpack/components/ApplicationDefinition/index.js +8 -0
  116. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
  117. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
  118. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
  119. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
  120. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
  121. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
  122. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
  123. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
  124. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
  125. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
  126. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
  127. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
  128. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
  129. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
  130. data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
  131. data/webpack/components/ApplicationInstance/ApplicationInstance.js +153 -45
  132. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +120 -6
  133. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +5 -0
  134. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
  135. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +77 -22
  136. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
  137. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
  138. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +80 -0
  139. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +24 -0
  140. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +131 -0
  141. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +44 -0
  142. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +299 -0
  143. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2990 -0
  144. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +276 -0
  145. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
  146. data/webpack/components/ApplicationInstance/components/Service.js +1 -1
  147. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
  148. data/webpack/components/ApplicationInstance/helper.js +0 -0
  149. data/webpack/components/ApplicationInstance/index.js +8 -0
  150. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +128 -60
  151. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +17 -0
  152. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +40 -50
  153. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +5 -4
  154. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -14
  155. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -1
  156. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportData_1.fixtures.js +349 -0
  157. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +20 -0
  158. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +47 -0
  159. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportReducer.test.js +41 -0
  160. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +26 -0
  161. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +7 -0
  162. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +718 -0
  163. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +347 -0
  164. data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +1 -1
  165. data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +24 -0
  166. data/webpack/components/ApplicationInstanceReport/components/__tests__/__snapshots__/ReportViewer.test.js.snap +24 -0
  167. data/webpack/components/ApplicationInstanceReport/index.js +8 -3
  168. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
  169. data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
  170. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
  171. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
  172. data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
  173. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
  174. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
  175. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
  176. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
  177. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
  178. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
  179. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
  180. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
  181. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
  182. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
  183. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
  184. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
  185. data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
  186. data/webpack/components/ExistingHostSelection/index.js +26 -0
  187. data/webpack/components/ParameterSelection/ParameterSelection.js +138 -15
  188. data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
  189. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +52 -9
  190. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +3 -0
  191. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +62 -25
  192. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +1 -0
  193. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +116 -84
  194. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +10 -4
  195. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +36 -46
  196. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +33 -25
  197. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
  198. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +84 -112
  199. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1488 -872
  200. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +117 -79
  201. data/webpack/components/ParameterSelection/index.js +2 -1
  202. data/webpack/components/SyncGitRepo/SyncGitRepo.js +202 -0
  203. data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
  204. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +123 -0
  205. data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +8 -0
  206. data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +80 -0
  207. data/webpack/components/SyncGitRepo/SyncGitRepoSelectors.js +6 -0
  208. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +7 -0
  209. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +44 -0
  210. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +27 -0
  211. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoReducer.test.js +95 -0
  212. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +32 -0
  213. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +31 -0
  214. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoReducer.test.js.snap +137 -0
  215. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +13 -0
  216. data/webpack/components/SyncGitRepo/components/FormTextInput.js +42 -0
  217. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +47 -0
  218. data/webpack/components/SyncGitRepo/index.js +28 -0
  219. data/webpack/components/common/DeleteTableEntry.js +18 -4
  220. data/webpack/components/common/EditTableEntry.js +50 -0
  221. data/webpack/components/common/ExtTextInput.js +43 -0
  222. data/webpack/components/common/LockTableEntry.js +60 -0
  223. data/webpack/components/common/__tests__/EditTableEntry.test.js +53 -0
  224. data/webpack/components/common/__tests__/LockTableEntry.test.js +35 -0
  225. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +40 -2
  226. data/webpack/components/common/__tests__/__snapshots__/EditTableEntry.test.js.snap +81 -0
  227. data/webpack/components/common/__tests__/__snapshots__/LockTableEntry.test.js.snap +60 -0
  228. data/webpack/helper.js +20 -1
  229. data/webpack/helper.test.js +37 -0
  230. data/webpack/index.js +7 -0
  231. data/webpack/js-yaml.js +3874 -0
  232. data/webpack/reducer.js +16 -1
  233. metadata +182 -11
  234. data/app/views/foreman_acd/app_instances/deploy.html.erb +0 -19
  235. data/webpack/components/common/EasyHeaderFormatter.js +0 -18
  236. data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
  237. data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
@@ -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,14 @@ 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,
30
+ APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
24
31
  } from './ApplicationInstanceConstants';
25
32
 
26
33
  import {
@@ -40,7 +47,15 @@ const applicationInstanceConf = (state = initialState, action) => {
40
47
  case APPLICATION_INSTANCE_INIT: {
41
48
  return state.merge(payload);
42
49
  }
50
+ case APPLICATION_INSTANCE_CLOSE_ALERT_MODAL: {
51
+ return state.merge({
52
+ showAlertModal: false,
53
+ alertModalTitle: '',
54
+ alertModalText: '',
55
+ });
56
+ }
43
57
  case APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE: {
58
+ console.log("Error while loading application definition data: "+ payload.error);
44
59
  return state.merge({ error: payload.error, loading: false });
45
60
  }
46
61
  case APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST: {
@@ -86,7 +101,7 @@ const applicationInstanceConf = (state = initialState, action) => {
86
101
  index = Math.max(...hosts.map(e => e.id)) + 1;
87
102
  }
88
103
 
89
- 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 };
90
105
  newRow.backup = cloneDeep(newRow)
91
106
  hosts.push(newRow);
92
107
 
@@ -124,38 +139,28 @@ const applicationInstanceConf = (state = initialState, action) => {
124
139
  case APPLICATION_INSTANCE_HOST_EDIT_CONFIRM: {
125
140
  const hosts = cloneDeep(state.hosts);
126
141
  const index = findIndex(hosts, { id: payload.rowData.id });
127
- const services = cloneDeep(state.services);
142
+ let services = cloneDeep(state.services);
128
143
 
129
144
  const thisHost = hosts[index];
130
145
 
131
- if (thisHost.hostname == '') {
132
- window.alert("Every host needs to have a valid name");
133
- return state;
134
- }
135
-
136
- if (thisHost.service == '') {
137
- window.alert("Every host needs to be assigned to a service");
138
- return state;
139
- }
146
+ // hostnames are lower case
147
+ thisHost.hostname = thisHost.hostname.toLowerCase();
140
148
 
141
149
  if (state.hosts.filter(v => v.hostname === thisHost.hostname && v.id != thisHost.id).length > 0) {
142
- window.alert("Host name already used for this Application Instance. Please make sure that every host name is unique");
143
- 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
+ });
144
155
  }
145
156
 
146
157
  // Initialize the new Instance with the parameters of the Application Definition.
147
158
  if (thisHost.newEntry === true) {
148
- 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];
149
161
  hosts[index].foremanParameters = selectedService.foremanParameters;
150
162
  hosts[index].ansibleParameters = selectedService.ansibleParameters;
151
-
152
- const hostServiceId = Number(thisHost.service);
153
- const service = services.find(serv => serv['id'] == hostServiceId);
154
- if ('currentCount' in service) {
155
- service['currentCount'] += 1;
156
- } else {
157
- service['currentCount'] = 1;
158
- }
163
+ services = calculateServiceUsage(hostServiceId, services);
159
164
  }
160
165
 
161
166
  delete hosts[index].backup;
@@ -191,6 +196,13 @@ const applicationInstanceConf = (state = initialState, action) => {
191
196
  hosts: hosts
192
197
  });
193
198
  }
199
+ case APPLICATION_INSTANCE_HOST_EDIT_ERROR: {
200
+ return state.merge({
201
+ showAlertModal: true,
202
+ alertModalTitle: __("Error"),
203
+ alertModalText: payload,
204
+ });
205
+ }
194
206
  case APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN: {
195
207
  let parametersData = {};
196
208
 
@@ -287,6 +299,49 @@ const applicationInstanceConf = (state = initialState, action) => {
287
299
  }
288
300
  return state.merge(newState);
289
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
+ }
342
+ case APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE: {
343
+ return state.merge({ paramEditMode: payload.mode });
344
+ }
290
345
  default:
291
346
  return state;
292
347
  }
@@ -1,5 +1,8 @@
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;
@@ -7,3 +10,4 @@ export const selectColumns = state => applicationInstanceConf(state).columns;
7
10
  export const selectServices = state => applicationInstanceConf(state).services;
8
11
  export const selectParametersData = state => applicationInstanceConf(state).parametersData;
9
12
  export const selectAnsibleVarsAll = state => applicationInstanceConf(state).ansibleVarsAll;
13
+ export const selectParamEditMode = state => applicationInstanceConf(state).paramEditMode;
@@ -0,0 +1,263 @@
1
+ export const applicationInstanceConfData_1 = {
2
+ name: false,
3
+ error: {
4
+ errorMsg: '',
5
+ status: '',
6
+ statusText: ''
7
+ },
8
+ loading: false,
9
+ columns: [
10
+ {
11
+ property: 'hostname',
12
+ header: {
13
+ label: 'Hostname',
14
+ formatters: [
15
+ null
16
+ ],
17
+ props: {
18
+ index: 0,
19
+ style: {
20
+ width: '30%'
21
+ }
22
+ }
23
+ },
24
+ cell: {
25
+ formatters: [
26
+ null
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ property: 'description',
32
+ header: {
33
+ label: 'Description',
34
+ formatters: [
35
+ null
36
+ ],
37
+ props: {
38
+ index: 1,
39
+ style: {
40
+ width: '30%'
41
+ }
42
+ }
43
+ },
44
+ cell: {
45
+ formatters: [
46
+ null
47
+ ]
48
+ }
49
+ },
50
+ {
51
+ property: 'service',
52
+ header: {
53
+ label: 'Service',
54
+ formatters: [
55
+ null
56
+ ],
57
+ props: {
58
+ index: 2,
59
+ style: {
60
+ width: '20%'
61
+ }
62
+ }
63
+ },
64
+ cell: {
65
+ formatters: [
66
+ null
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ property: 'actions',
72
+ header: {
73
+ label: 'Actions',
74
+ formatters: [
75
+ null
76
+ ],
77
+ props: {
78
+ index: 4,
79
+ style: {
80
+ width: '20%'
81
+ }
82
+ }
83
+ },
84
+ cell: {
85
+ formatters: [
86
+ null
87
+ ]
88
+ }
89
+ }
90
+ ],
91
+ appDefinition: {
92
+ id: 1,
93
+ name: 'LAMP',
94
+ description: '',
95
+ services: '[{"id":1,"name":"web","description":"","hostgroup":"1","ansibleGroup":"webservers","minCount":"2","maxCount":"","foremanParameters":[{"id":1,"locked":false,"name":"CP","description":"","type":"computeprofile","value":"1"},{"id":2,"locked":true,"name":"LE","description":"","type":"lifecycleenv","value":"1"}],"ansibleParameters":[{"id":0,"name":"dummy_var","value":"0"}]},{"id":2,"name":"db","description":"","hostgroup":"1","ansibleGroup":"dbservers","minCount":"1","maxCount":"","foremanParameters":[],"ansibleParameters":[{"id":0,"name":"mysqlservice","value":"mysqld"},{"id":1,"name":"mysql_port","value":"3306","locked":true},{"id":2,"name":"dbuser","value":"webapp"},{"id":3,"name":"dbname","value":"ANSAP01"},{"id":4,"name":"upassword","value":"Bond@007"},{"id":5,"name":"masterpassword","value":"MySQL@007"}]}]',
96
+ ansible_vars_all: '[{"id":0,"name":"repository","value":"https://github.com/bennojoy/mywebapp.git"}]',
97
+ location_ids: [
98
+ 2
99
+ ],
100
+ organization_ids: [
101
+ 1
102
+ ],
103
+ created_at: '2021-03-11 12:51:34 +0100',
104
+ updated_at: '2021-03-13 00:06:12 +0100'
105
+ },
106
+ hosts: [
107
+ {
108
+ id: 4,
109
+ hostname: 'great-web-app-db-1',
110
+ service: '2',
111
+ description: '',
112
+ foremanParameters: [],
113
+ ansibleParameters: [
114
+ {
115
+ id: 0,
116
+ name: 'mysqlservice',
117
+ value: 'mysqld'
118
+ },
119
+ {
120
+ id: 1,
121
+ name: 'mysql_port',
122
+ value: '3306'
123
+ },
124
+ {
125
+ id: 2,
126
+ name: 'dbuser',
127
+ value: 'webapp'
128
+ },
129
+ {
130
+ id: 3,
131
+ name: 'dbname',
132
+ value: 'ANSAP01'
133
+ },
134
+ {
135
+ id: 4,
136
+ name: 'upassword',
137
+ value: 'Bond@007'
138
+ },
139
+ {
140
+ id: 5,
141
+ name: 'masterpassword',
142
+ value: 'MySQL@007'
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ id: 1,
148
+ hostname: 'great-web-app-web-1',
149
+ service: '1',
150
+ description: '',
151
+ foremanParameters: [],
152
+ ansibleParameters: [
153
+ {
154
+ id: 0,
155
+ name: 'dummy_var',
156
+ value: '0'
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ id: 2,
162
+ hostname: 'great-web-app-web-2',
163
+ service: '1',
164
+ description: '',
165
+ foremanParameters: [],
166
+ ansibleParameters: [
167
+ {
168
+ id: 0,
169
+ name: 'dummy_var',
170
+ value: '0'
171
+ }
172
+ ]
173
+ }
174
+ ],
175
+ ansibleVarsAll: [
176
+ {
177
+ id: 0,
178
+ name: 'repository',
179
+ value: 'https://github.com/bennojoy/mywebapp.git'
180
+ }
181
+ ],
182
+ services: [
183
+ {
184
+ id: 1,
185
+ name: 'web',
186
+ description: '',
187
+ hostgroup: '1',
188
+ ansibleGroup: 'webservers',
189
+ minCount: '2',
190
+ maxCount: '',
191
+ foremanParameters: [
192
+ {
193
+ id: 1,
194
+ locked: false,
195
+ name: 'CP',
196
+ description: '',
197
+ type: 'computeprofile',
198
+ value: '1'
199
+ },
200
+ {
201
+ id: 2,
202
+ locked: true,
203
+ name: 'LE',
204
+ description: '',
205
+ type: 'lifecycleenv',
206
+ value: '1'
207
+ }
208
+ ],
209
+ ansibleParameters: [
210
+ {
211
+ id: 0,
212
+ name: 'dummy_var',
213
+ value: '0'
214
+ }
215
+ ],
216
+ currentCount: 2
217
+ },
218
+ {
219
+ id: 2,
220
+ name: 'db',
221
+ description: '',
222
+ hostgroup: '1',
223
+ ansibleGroup: 'dbservers',
224
+ minCount: '1',
225
+ maxCount: '',
226
+ foremanParameters: [],
227
+ ansibleParameters: [
228
+ {
229
+ id: 0,
230
+ name: 'mysqlservice',
231
+ value: 'mysqld'
232
+ },
233
+ {
234
+ id: 1,
235
+ name: 'mysql_port',
236
+ value: '3306',
237
+ locked: true
238
+ },
239
+ {
240
+ id: 2,
241
+ name: 'dbuser',
242
+ value: 'webapp'
243
+ },
244
+ {
245
+ id: 3,
246
+ name: 'dbname',
247
+ value: 'ANSAP01'
248
+ },
249
+ {
250
+ id: 4,
251
+ name: 'upassword',
252
+ value: 'Bond@007'
253
+ },
254
+ {
255
+ id: 5,
256
+ name: 'masterpassword',
257
+ value: 'MySQL@007'
258
+ }
259
+ ],
260
+ currentCount: 1
261
+ }
262
+ ]
263
+ }
@@ -0,0 +1,80 @@
1
+ import Immutable from 'seamless-immutable';
2
+ import {
3
+ cloneDeep,
4
+ findIndex,
5
+ findLastIndex,
6
+ } from 'lodash';
7
+
8
+ import {
9
+ applicationInstanceConfData_1,
10
+ } from '../__fixtures__/applicationInstanceConfData_1.fixtures';
11
+
12
+ export const successState = Immutable(applicationInstanceConfData_1);
13
+
14
+ const EDIT_ROW_ID = 2;
15
+
16
+ const editClone = applicationInstanceConfData_1;
17
+ const editIndex = findIndex(editClone.hosts, { id: EDIT_ROW_ID })
18
+ editClone["hosts"][editIndex].backup = cloneDeep(editClone["hosts"][editIndex]);
19
+ export const editState = Immutable(editClone);
20
+
21
+ // Payload Data
22
+ export const initApplicationInstancePayload = applicationInstanceConfData_1;
23
+
24
+ export const closeAlertModalPayload = { };
25
+ export const addHostPayload = { };
26
+ export const deleteHostPayload = {
27
+ rowData: {
28
+ id: EDIT_ROW_ID,
29
+ },
30
+ };
31
+ export const activateEditHostPayload = {
32
+ rowData: {
33
+ id: EDIT_ROW_ID,
34
+ },
35
+ };
36
+ export const confirmEditHostPayload = {
37
+ rowData: {
38
+ id: EDIT_ROW_ID,
39
+ },
40
+ };
41
+ export const cancelEditHostPayload = {
42
+ rowData: {
43
+ id: EDIT_ROW_ID,
44
+ },
45
+ };
46
+ export const changeEditHostPayload = {
47
+ value: "helloworld",
48
+ property: "name",
49
+ rowData: {
50
+ id: EDIT_ROW_ID,
51
+ }
52
+ };
53
+
54
+ export const loadApplicationDefinitionRequestPayload = {
55
+ clearRows: false,
56
+ };
57
+
58
+ export const loadApplicationDefinitionSuccessPayload = {
59
+ app_definition: {
60
+ id: 1,
61
+ name: "LAMP",
62
+ description: "",
63
+ services: "[{\"id\":1,\"name\":\"web\",\"description\":\"\",\"hostgroup\":\"1\",\"ansibleGroup\":\"webservers\",\"minCount\":\"2\",\"maxCount\":\"\",\"foremanParameters\":[{\"id\":1,\"locked\":false,\"name\":\"CP\",\"description\":\"\",\"type\":\"computeprofile\",\"value\":\"1\"},{\"id\":2,\"locked\":true,\"name\":\"LE\",\"description\":\"\",\"type\":\"lifecycleenv\",\"value\":\"1\"}],\"ansibleParameters\":[{\"id\":0,\"name\":\"dummy_var\",\"value\":\"0\"}]},{\"id\":2,\"name\":\"db\",\"description\":\"\",\"hostgroup\":\"1\",\"ansibleGroup\":\"dbservers\",\"minCount\":\"1\",\"maxCount\":\"\",\"foremanParameters\":[],\"ansibleParameters\":[{\"id\":0,\"name\":\"mysqlservice\",\"value\":\"mysqld\"},{\"id\":1,\"name\":\"mysql_port\",\"value\":\"3306\",\"locked\":true},{\"id\":2,\"name\":\"dbuser\",\"value\":\"webapp\"},{\"id\":3,\"name\":\"dbname\",\"value\":\"ANSAP01\"},{\"id\":4,\"name\":\"upassword\",\"value\":\"Bond@007\"},{\"id\":5,\"name\":\"masterpassword\",\"value\":\"MySQL@007\"}]}]",
64
+ "ansible_vars_all": "[{\"id\":0,\"name\":\"repository\",\"value\":\"https://github.com/bennojoy/mywebapp.git\"}]",
65
+ location_ids: [
66
+ 2
67
+ ],
68
+ organization_ids: [
69
+ 1
70
+ ],
71
+ created_at: "2021-03-11 12:51:34 +0100",
72
+ updated_at: "2021-03-13 00:06:12 +0100"
73
+ },
74
+ foreman_data: null,
75
+ ansible_data: null
76
+ };
77
+
78
+ export const loadApplicationDefinitionFailurePayload = {
79
+ error: "Something really bad happend",
80
+ };
@@ -0,0 +1,24 @@
1
+ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import ApplicationInstance from '../ApplicationInstance';
4
+
5
+ const noop = () => {};
6
+
7
+ const fixtures = {
8
+ 'should render application instance': {
9
+ data: {
10
+ location: "Default Location",
11
+ organization: "Default Organization",
12
+ appDefinition: {},
13
+ hosts: [],
14
+ ansibleVarsAll: [],
15
+ },
16
+ closeAlertModal: noop,
17
+ loadApplicationDefinition: noop,
18
+ initApplicationInstance: noop,
19
+ addApplicationInstanceHost: noop,
20
+ },
21
+ };
22
+
23
+ describe('ApplicationInstance', () =>
24
+ testComponentSnapshotsWithFixtures(ApplicationInstance, fixtures));
@@ -0,0 +1,131 @@
1
+ import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import reducer, { initialState } from '../ApplicationInstanceReducer';
3
+
4
+ import {
5
+ successState,
6
+ editState,
7
+ initApplicationInstancePayload,
8
+ closeAlertModalPayload,
9
+ addHostPayload,
10
+ deleteHostPayload,
11
+ activateEditHostPayload,
12
+ confirmEditHostPayload,
13
+ cancelEditHostPayload,
14
+ changeEditHostPayload,
15
+ loadApplicationDefinitionRequestPayload,
16
+ loadApplicationDefinitionSuccessPayload,
17
+ loadApplicationDefinitionFailurePayload,
18
+ } from '../__fixtures__/applicationInstanceReducer.fixtures';
19
+
20
+ import {
21
+ APPLICATION_INSTANCE_INIT,
22
+ APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
23
+ APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST,
24
+ APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS,
25
+ APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE,
26
+ APPLICATION_INSTANCE_HOST_DELETE,
27
+ APPLICATION_INSTANCE_HOST_ADD,
28
+ APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE,
29
+ APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
30
+ APPLICATION_INSTANCE_HOST_EDIT_CHANGE,
31
+ APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
32
+ APPLICATION_INSTANCE_HOST_EDIT_ERROR,
33
+ APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
34
+ APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
35
+ APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
36
+ APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
37
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN,
38
+ APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE,
39
+ APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
40
+ } from '../ApplicationInstanceConstants';
41
+
42
+ const fixtures = {
43
+ 'should return initial state': {
44
+ state: initialState,
45
+ action: {
46
+ type: undefined,
47
+ payload: {},
48
+ },
49
+ },
50
+
51
+ 'should initialize component': {
52
+ state: initialState,
53
+ action: {
54
+ type: APPLICATION_INSTANCE_INIT,
55
+ payload: initApplicationInstancePayload,
56
+ },
57
+ },
58
+ 'should close alert modal': {
59
+ state: successState,
60
+ action: {
61
+ type: APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
62
+ payload: closeAlertModalPayload,
63
+ },
64
+ },
65
+ 'should add a host': {
66
+ state: successState,
67
+ action: {
68
+ type: APPLICATION_INSTANCE_HOST_ADD,
69
+ payload: addHostPayload,
70
+ },
71
+ },
72
+ 'should delete a host': {
73
+ state: successState,
74
+ action: {
75
+ type: APPLICATION_INSTANCE_HOST_DELETE,
76
+ payload: deleteHostPayload,
77
+ },
78
+ },
79
+ 'should activate edit host': {
80
+ state: successState,
81
+ action: {
82
+ type: APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE,
83
+ payload: activateEditHostPayload,
84
+ },
85
+ },
86
+ 'should change edit host': {
87
+ state: editState,
88
+ action: {
89
+ type: APPLICATION_INSTANCE_HOST_EDIT_CHANGE,
90
+ payload: changeEditHostPayload,
91
+ },
92
+ },
93
+ 'should confirm edit host': {
94
+ state: editState,
95
+ action: {
96
+ type: APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
97
+ payload: confirmEditHostPayload,
98
+ },
99
+ },
100
+ 'should cancel edit host': {
101
+ state: editState,
102
+ action: {
103
+ type: APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
104
+ payload: cancelEditHostPayload,
105
+ },
106
+ },
107
+ 'should request load param data': {
108
+ state: successState,
109
+ action: {
110
+ type: APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST,
111
+ payload: loadApplicationDefinitionRequestPayload,
112
+ },
113
+ },
114
+ 'should load param data be successful': {
115
+ state: successState,
116
+ action: {
117
+ type: APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS,
118
+ payload: loadApplicationDefinitionSuccessPayload,
119
+ },
120
+ },
121
+ 'should load param data be erroneous': {
122
+ state: successState,
123
+ action: {
124
+ type: APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE,
125
+ payload: loadApplicationDefinitionFailurePayload,
126
+ },
127
+ },
128
+ };
129
+
130
+ describe('ApplicationInstanceReducer', () =>
131
+ testReducerSnapshotWithFixtures(reducer, fixtures));