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
@@ -0,0 +1,276 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ApplicationInstanceSelectors should return ParamEditMode from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
4
+
5
+ exports[`ApplicationInstanceSelectors should return ansibleVarsAll from applicationInstanceConfData_1 fixtures 1`] = `
6
+ Array [
7
+ Object {
8
+ "id": 0,
9
+ "name": "repository",
10
+ "value": "https://github.com/bennojoy/mywebapp.git",
11
+ },
12
+ ]
13
+ `;
14
+
15
+ exports[`ApplicationInstanceSelectors should return appDefinition from applicationInstanceConfData_1 fixtures 1`] = `
16
+ Object {
17
+ "ansible_vars_all": "[{\\"id\\":0,\\"name\\":\\"repository\\",\\"value\\":\\"https://github.com/bennojoy/mywebapp.git\\"}]",
18
+ "created_at": "2021-03-11 12:51:34 +0100",
19
+ "description": "",
20
+ "id": 1,
21
+ "location_ids": Array [
22
+ 2,
23
+ ],
24
+ "name": "LAMP",
25
+ "organization_ids": Array [
26
+ 1,
27
+ ],
28
+ "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\\"}]}]",
29
+ "updated_at": "2021-03-13 00:06:12 +0100",
30
+ }
31
+ `;
32
+
33
+ exports[`ApplicationInstanceSelectors should return columns from applicationInstanceConfData_1 fixtures 1`] = `
34
+ Array [
35
+ Object {
36
+ "cell": Object {
37
+ "formatters": Array [
38
+ null,
39
+ ],
40
+ },
41
+ "header": Object {
42
+ "formatters": Array [
43
+ null,
44
+ ],
45
+ "label": "Hostname",
46
+ "props": Object {
47
+ "index": 0,
48
+ "style": Object {
49
+ "width": "30%",
50
+ },
51
+ },
52
+ },
53
+ "property": "hostname",
54
+ },
55
+ Object {
56
+ "cell": Object {
57
+ "formatters": Array [
58
+ null,
59
+ ],
60
+ },
61
+ "header": Object {
62
+ "formatters": Array [
63
+ null,
64
+ ],
65
+ "label": "Description",
66
+ "props": Object {
67
+ "index": 1,
68
+ "style": Object {
69
+ "width": "30%",
70
+ },
71
+ },
72
+ },
73
+ "property": "description",
74
+ },
75
+ Object {
76
+ "cell": Object {
77
+ "formatters": Array [
78
+ null,
79
+ ],
80
+ },
81
+ "header": Object {
82
+ "formatters": Array [
83
+ null,
84
+ ],
85
+ "label": "Service",
86
+ "props": Object {
87
+ "index": 2,
88
+ "style": Object {
89
+ "width": "20%",
90
+ },
91
+ },
92
+ },
93
+ "property": "service",
94
+ },
95
+ Object {
96
+ "cell": Object {
97
+ "formatters": Array [
98
+ null,
99
+ ],
100
+ },
101
+ "header": Object {
102
+ "formatters": Array [
103
+ null,
104
+ ],
105
+ "label": "Actions",
106
+ "props": Object {
107
+ "index": 4,
108
+ "style": Object {
109
+ "width": "20%",
110
+ },
111
+ },
112
+ },
113
+ "property": "actions",
114
+ },
115
+ ]
116
+ `;
117
+
118
+ exports[`ApplicationInstanceSelectors should return editMode from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
119
+
120
+ exports[`ApplicationInstanceSelectors should return hosts from applicationInstanceConfData_1 fixtures 1`] = `
121
+ Array [
122
+ Object {
123
+ "ansibleParameters": Array [
124
+ Object {
125
+ "id": 0,
126
+ "name": "mysqlservice",
127
+ "value": "mysqld",
128
+ },
129
+ Object {
130
+ "id": 1,
131
+ "name": "mysql_port",
132
+ "value": "3306",
133
+ },
134
+ Object {
135
+ "id": 2,
136
+ "name": "dbuser",
137
+ "value": "webapp",
138
+ },
139
+ Object {
140
+ "id": 3,
141
+ "name": "dbname",
142
+ "value": "ANSAP01",
143
+ },
144
+ Object {
145
+ "id": 4,
146
+ "name": "upassword",
147
+ "value": "Bond@007",
148
+ },
149
+ Object {
150
+ "id": 5,
151
+ "name": "masterpassword",
152
+ "value": "MySQL@007",
153
+ },
154
+ ],
155
+ "description": "",
156
+ "foremanParameters": Array [],
157
+ "hostname": "great-web-app-db-1",
158
+ "id": 4,
159
+ "service": "2",
160
+ },
161
+ Object {
162
+ "ansibleParameters": Array [
163
+ Object {
164
+ "id": 0,
165
+ "name": "dummy_var",
166
+ "value": "0",
167
+ },
168
+ ],
169
+ "description": "",
170
+ "foremanParameters": Array [],
171
+ "hostname": "great-web-app-web-1",
172
+ "id": 1,
173
+ "service": "1",
174
+ },
175
+ Object {
176
+ "ansibleParameters": Array [
177
+ Object {
178
+ "id": 0,
179
+ "name": "dummy_var",
180
+ "value": "0",
181
+ },
182
+ ],
183
+ "description": "",
184
+ "foremanParameters": Array [],
185
+ "hostname": "great-web-app-web-2",
186
+ "id": 2,
187
+ "service": "1",
188
+ },
189
+ ]
190
+ `;
191
+
192
+ exports[`ApplicationInstanceSelectors should return parametersData from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
193
+
194
+ exports[`ApplicationInstanceSelectors should return services from applicationInstanceConfData_1 fixtures 1`] = `
195
+ Array [
196
+ Object {
197
+ "ansibleGroup": "webservers",
198
+ "ansibleParameters": Array [
199
+ Object {
200
+ "id": 0,
201
+ "name": "dummy_var",
202
+ "value": "0",
203
+ },
204
+ ],
205
+ "currentCount": 2,
206
+ "description": "",
207
+ "foremanParameters": Array [
208
+ Object {
209
+ "description": "",
210
+ "id": 1,
211
+ "locked": false,
212
+ "name": "CP",
213
+ "type": "computeprofile",
214
+ "value": "1",
215
+ },
216
+ Object {
217
+ "description": "",
218
+ "id": 2,
219
+ "locked": true,
220
+ "name": "LE",
221
+ "type": "lifecycleenv",
222
+ "value": "1",
223
+ },
224
+ ],
225
+ "hostgroup": "1",
226
+ "id": 1,
227
+ "maxCount": "",
228
+ "minCount": "2",
229
+ "name": "web",
230
+ },
231
+ Object {
232
+ "ansibleGroup": "dbservers",
233
+ "ansibleParameters": Array [
234
+ Object {
235
+ "id": 0,
236
+ "name": "mysqlservice",
237
+ "value": "mysqld",
238
+ },
239
+ Object {
240
+ "id": 1,
241
+ "locked": true,
242
+ "name": "mysql_port",
243
+ "value": "3306",
244
+ },
245
+ Object {
246
+ "id": 2,
247
+ "name": "dbuser",
248
+ "value": "webapp",
249
+ },
250
+ Object {
251
+ "id": 3,
252
+ "name": "dbname",
253
+ "value": "ANSAP01",
254
+ },
255
+ Object {
256
+ "id": 4,
257
+ "name": "upassword",
258
+ "value": "Bond@007",
259
+ },
260
+ Object {
261
+ "id": 5,
262
+ "name": "masterpassword",
263
+ "value": "MySQL@007",
264
+ },
265
+ ],
266
+ "currentCount": 1,
267
+ "description": "",
268
+ "foremanParameters": Array [],
269
+ "hostgroup": "1",
270
+ "id": 2,
271
+ "maxCount": "",
272
+ "minCount": "1",
273
+ "name": "db",
274
+ },
275
+ ]
276
+ `;
@@ -18,6 +18,7 @@ const AppDefinitionSelector= ({
18
18
  <label className="col-md-2 control-label">{label}</label>
19
19
  <div className="col-md-4">
20
20
  <ExtSelect
21
+ hidden={hidden}
21
22
  editable={editable}
22
23
  viewText={viewText}
23
24
  selectValue={selectValue}
@@ -9,7 +9,7 @@ const Service= ({
9
9
  }) =>{
10
10
  return (
11
11
  <div>
12
- <label>{name}:</label> {currentCount} (Min/Max: {minCount}/{maxCount})
12
+ <label>{name}:</label> {currentCount} ({__("Min/Max")}: {minCount}/{maxCount})
13
13
  </div>
14
14
  );
15
15
  };
@@ -15,7 +15,7 @@ const ServiceCounter= ({
15
15
 
16
16
  return (
17
17
  <div>
18
- <label class="service-counter-title">{title}</label>
18
+ <label className="service-counter-title">{title}</label>
19
19
  {Object.keys(services).map(key => (
20
20
  <Service
21
21
  key={services[key].id}
File without changes
@@ -6,6 +6,9 @@ import ApplicationInstance from './ApplicationInstance';
6
6
  import * as ApplicationInstanceActions from './ApplicationInstanceActions';
7
7
 
8
8
  import {
9
+ selectShowAlertModal,
10
+ selectAlertModalText,
11
+ selectAlertModalTitle,
9
12
  selectEditMode,
10
13
  selectAppDefinition,
11
14
  selectHosts,
@@ -13,9 +16,13 @@ import {
13
16
  selectColumns,
14
17
  selectParametersData,
15
18
  selectAnsibleVarsAll,
19
+ selectParamEditMode,
16
20
  } from './ApplicationInstanceSelectors';
17
21
 
18
22
  const mapStateToProps = state => ({
23
+ showAlertModal: selectShowAlertModal(state),
24
+ alertModalText: selectAlertModalText(state),
25
+ alertModalTitle: selectAlertModalTitle(state),
19
26
  editMode: selectEditMode(state),
20
27
  appDefinition: selectAppDefinition(state),
21
28
  hosts: selectHosts(state),
@@ -23,6 +30,7 @@ const mapStateToProps = state => ({
23
30
  columns: selectColumns(state),
24
31
  parametersData: selectParametersData(state),
25
32
  ansibleVarsAll: selectAnsibleVarsAll(state),
33
+ paramEditMode: selectParamEditMode(state),
26
34
  });
27
35
 
28
36
  const mapDispatchToProps = dispatch =>
@@ -1,10 +1,19 @@
1
1
  import React, { useState } from 'react'
2
2
  import PropTypes from 'prop-types';
3
3
 
4
+ import {
5
+ Icon,
6
+ Spinner,
7
+ } from 'patternfly-react';
8
+
4
9
  import {
5
10
  VerticalTabs,
6
11
  } from 'patternfly-react-extensions';
7
12
 
13
+ import {
14
+ translate as __
15
+ } from 'foremanReact/common/I18n';
16
+
8
17
  import PowerStatus from 'foremanReact/components/hosts/powerStatus';
9
18
  import ReportViewer from './components/ReportViewer';
10
19
 
@@ -16,56 +25,50 @@ class ApplicationInstanceReport extends React.Component {
16
25
 
17
26
  componentDidMount() {
18
27
  const {
19
- data: { hosts, mode },
28
+ data: { hosts, deploymentState, initialConfigureState, initialConfigureJobUrl },
20
29
  initApplicationInstanceReport,
21
- setActiveAndLoadLiveReport,
30
+ setActiveHost,
22
31
  } = this.props;
23
32
 
24
- initApplicationInstanceReport(hosts);
25
-
26
- if (mode == 'liveReport') {
27
- if (hosts.length > 0) {
28
- const index = 0;
29
- const url = `/api/v2/orchestration/${hosts[index].progress_report_id}/tasks`;
30
- setActiveAndLoadLiveReport(index, url);
31
- }
32
- }
33
+ initApplicationInstanceReport(hosts, deploymentState, initialConfigureState, initialConfigureJobUrl);
34
+ this.reloadReportData();
33
35
  };
34
36
 
35
- isActive(id) {
36
- return (this.props.activeHostId === id);
37
- }
38
-
39
- collectLiveData(hosts) {
37
+ reloadReportData() {
40
38
  const {
41
- setActiveAndLoadLiveReport,
39
+ data: { appInstanceId, reportDataUrl },
40
+ deploymentState, initialConfigureState,
41
+ loadReportData,
42
42
  } = this.props;
43
- const tabs = []
44
43
 
45
- for (const [index, value] of hosts.entries()) {
46
- const url = `/api/v2/orchestration/${hosts[index].progress_report_id}/tasks`
44
+ // if both states are unknown, it means, that the component was just loaded. try again after a short timeout.
45
+ if (deploymentState == 'unknown' && initialConfigureState == 'unknown') {
46
+ setTimeout(() => {
47
+ this.reloadReportData();
48
+ }, 1000);
47
49
 
48
- tabs.push(
49
- <VerticalTabs.Tab
50
- id={index}
51
- key={"vt_tab_"+index}
52
- title={ value.name }
53
- wrapStyle='nowrap'
54
- onActivate={() => setActiveAndLoadLiveReport(index, url)}
55
- active={this.isActive(index)}
56
- />
57
- );
50
+ return;
58
51
  }
59
52
 
60
- return tabs;
53
+ if ((deploymentState != 'new' && deploymentState != 'finished' && deploymentState != 'failed') ||
54
+ (initialConfigureState == 'unconfigured' || initialConfigureState == 'scheduled' || initialConfigureState == 'pending')) {
55
+
56
+ loadReportData(reportDataUrl, appInstanceId);
57
+
58
+ setTimeout(() => {
59
+ this.reloadReportData();
60
+ }, 5000);
61
+ }
62
+ }
63
+
64
+ isActive(id) {
65
+ return (this.props.activeHostId === id);
61
66
  }
62
67
 
63
68
  collectLastReportData(hosts) {
64
69
  const {
65
- setActiveAndLoadLastReport,
70
+ setActiveHost,
66
71
  } = this.props;
67
- // FIXME
68
- const url = undefined;
69
72
 
70
73
  const tabs = []
71
74
  for (const [index, value] of hosts.entries()) {
@@ -75,7 +78,7 @@ class ApplicationInstanceReport extends React.Component {
75
78
  key={"vt_tab_"+index}
76
79
  title={ value.name }
77
80
  wrapStyle='nowrap'
78
- onActivate={() => setActiveAndLoadLastReport(index, url)}
81
+ onActivate={() => setActiveHost(index)}
79
82
  active={this.isActive(index)}
80
83
  />
81
84
  );
@@ -84,43 +87,94 @@ class ApplicationInstanceReport extends React.Component {
84
87
  return tabs;
85
88
  }
86
89
 
87
- liveReportStatus(host) {
88
- return (
89
- <span>Host: <a href={ host['hostUrl'] }>{ host['hostname'] }</a></span>
90
- );
91
- }
92
-
93
90
  lastReportStatus(host) {
94
- return (
95
- <div>
96
- <span>Host: <a href={ host['hostUrl'] }>{ host['hostname'] }</a></span>
97
- <span>&nbsp;|&nbsp;</span>
98
- <span>Power Status: <PowerStatus data={{ id: host['id'], url: host['powerStatusUrl'] }} /></span>
99
- </div>
100
- )
91
+ if (!host['id']) {
92
+ return (
93
+ <div>
94
+ <span>Host: { host['name'] }</span>
95
+ <span>&nbsp;|&nbsp;</span>
96
+ <span>State: { __('not build') }</span>
97
+ <span>&nbsp;|&nbsp;</span>
98
+ <span>Power Status: { __('unknown') }</span>
99
+ </div>
100
+ )
101
+ } else {
102
+ const already_deployed_msg = __("Already existing host which was added to the application instance");
103
+ return (
104
+ <div>
105
+ <span>Host: <a href={ host['hostUrl'] }>{ host['name'] }</a></span>
106
+ <span>&nbsp;|&nbsp;</span>
107
+ <span>State: { host['build'] == true ? "in Build" : "Deployed" }</span>
108
+ <span>&nbsp;|&nbsp;</span>
109
+ <span>Power Status: <PowerStatus key={ "power_status_"+ host['id'] } id={ host['id'] } url={ host['powerStatusUrl'] } data={{ id: host['id'], url: host['powerStatusUrl'] }} /></span>
110
+ {host['isExistingHost'] ? (
111
+ <span>
112
+ &nbsp;|&nbsp; Existing host &nbsp;
113
+ <Icon style={{marginRight: 8, marginLeft: 2}} type="pf" name="info" title={already_deployed_msg} />
114
+ </span>
115
+ ) : (<span></span>)}
116
+ </div>
117
+ )
118
+ }
101
119
  }
102
120
 
103
121
  render() {
104
122
  const {
105
- data: { hosts, mode },
106
- report,
107
- activeHostId,
123
+ data: { appInstanceId, appInstanceName, deployTaskUrl, configureJobUrl, reportDataUrl },
124
+ activeHostId, hosts,
125
+ deploymentState,
126
+ initialConfigureState, initialConfigureJobUrl, showInitialConfigureJob,
127
+ loadReportData,
108
128
  } = this.props;
109
129
 
110
130
  let tabs = [];
111
131
  let reportStatus = undefined;
132
+ let report = undefined;
112
133
 
113
- if (mode == 'liveReport') {
114
- tabs = this.collectLiveData(hosts);
115
- reportStatus = this.liveReportStatus(hosts[activeHostId])
116
- } else if (mode == 'lastReport') {
117
- tabs = this.collectLastReportData(hosts);
118
- reportStatus = this.lastReportStatus(hosts[activeHostId])
134
+ // This handles the first call to render() in which the state hosts is always empty
135
+ if (hosts.length == 0) {
136
+ return (<span>No host</span>);
137
+ }
138
+
139
+ tabs = this.collectLastReportData(hosts);
140
+ reportStatus = this.lastReportStatus(hosts[activeHostId]);
141
+
142
+ if (hosts[activeHostId]['progress_report']) {
143
+ report = hosts[activeHostId]['progress_report'];
119
144
  }
120
145
 
121
146
  return (
122
147
  <span>
148
+ <div className="deploy_status">
149
+ <div>
150
+ <div className="deploy_status_head">Host deployment state</div>
151
+ <div className="deploy_status_content">
152
+ { (deploymentState != 'new' && deploymentState != 'finished' && deploymentState != 'failed') ? (<span><Spinner loading size='sm' /> &nbsp;</span>) : (<span></span>) }
153
+ { deploymentState }
154
+ </div>
155
+ </div>
156
+ <div>
157
+ <div className="deploy_status_head">Deployment task</div>
158
+ <div className="deploy_status_content"><a href={ deployTaskUrl } >Last deployment task</a></div>
159
+ </div>
160
+ { (showInitialConfigureJob == true) ? (
161
+ <div>
162
+ <div className="deploy_status_head">Configuration job</div>
163
+ <div className="deploy_status_content">
164
+ { (initialConfigureState == 'scheduled' || initialConfigureState == 'pending') ? (<span><Spinner loading size='sm' /> &nbsp;</span>) : (<span></span>) }
165
+ { (initialConfigureState != 'unconfigured' && initialConfigureState != 'scheduled') ? (<a href={ initialConfigureJobUrl }>Configuration job</a>) : (<span></span>) }
166
+ { (initialConfigureState != 'unconfigured') ? (<span>&nbsp; State: { initialConfigureState }</span>) : (<span></span>) }
167
+ </div>
168
+ </div>
169
+ ) : (
170
+ <div>
171
+ <div className="deploy_status_head">Configuration job</div>
172
+ <div className="deploy_status_content"><a href={ configureJobUrl }>Configuration jobs</a></div>
173
+ </div>
174
+ ) }
175
+ </div>
123
176
  <div className="deploy_report_hosts">
177
+ Hosts
124
178
  <VerticalTabs id="vertical_tabs">
125
179
  {tabs}
126
180
  </VerticalTabs>
@@ -137,19 +191,33 @@ class ApplicationInstanceReport extends React.Component {
137
191
 
138
192
  ApplicationInstanceReport.defaultProps = {
139
193
  error: {},
194
+ appInstanceName: '',
195
+ deployTaskUrl: '',
196
+ configureJobUrl: '',
140
197
  hosts: [],
141
198
  report: [],
142
199
  activeHostId: 0,
200
+ deploymentState: 'unknown',
201
+ initialConfigureState: 'unknown',
202
+ initialConfigureJobUrl: '',
203
+ showInitialConfigureJob: false,
143
204
  }
144
205
 
145
206
  ApplicationInstanceReport.propTypes = {
146
207
  initApplicationInstanceReport: PropTypes.func,
208
+ appInstanceName: PropTypes.string,
209
+ deployTaskUrl: PropTypes.string,
210
+ configureJobUrl: PropTypes.string,
211
+ deploymentState: PropTypes.string,
212
+ initialConfigureState: PropTypes.string,
213
+ initialConfigureJobUrl: PropTypes.string,
214
+ showInitialConfigureJob: PropTypes.bool,
147
215
  hosts: PropTypes.array,
216
+ deploymentState: PropTypes.string,
148
217
  report: PropTypes.array,
149
- setActiveAndLoadLiveReport: PropTypes.func,
150
- setActiveAndLoadLastReport: PropTypes.func,
218
+ setActiveHost: PropTypes.func,
219
+ loadReportData: PropTypes.func,
151
220
  activeHostId: PropTypes.number,
152
-
153
221
  };
154
222
 
155
223
  export default ApplicationInstanceReport;
@@ -1,5 +1,21 @@
1
1
  @import '~@theforeman/vendor/scss/variables';
2
2
 
3
+ .deploy_status {
4
+ padding-bottom: 80px;
5
+ }
6
+
7
+ .deploy_status_head {
8
+ float:left;
9
+ width:25%;
10
+ height:10%;
11
+ }
12
+
13
+ .deploy_status_content {
14
+ float:left;
15
+ width:75%;
16
+ height:10%;
17
+ }
18
+
3
19
  .deploy_report_hosts {
4
20
  float:left;
5
21
  width:25%;
@@ -11,6 +27,7 @@
11
27
  width:75%;
12
28
  min-height: 300px;
13
29
  background-color: #ecf9fe;
30
+ padding: 10px;
14
31
  border: 1px solid #3dbff3;
15
32
  }
16
33