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,614 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ExistingHostSelectionReducer should handle changed existiong host selection 1`] = `
4
+ Object {
5
+ "allHosts": Array [
6
+ Object {
7
+ "ansibleParameters": Array [],
8
+ "description": "",
9
+ "foremanParameters": Array [],
10
+ "hostname": "isaac-anselm",
11
+ "id": 5,
12
+ "service": "1",
13
+ },
14
+ ],
15
+ "alreadyUsedHosts": Array [
16
+ Object {
17
+ "disabled": true,
18
+ "label": "isaac-anselm",
19
+ "tooltipText": "Host already used for this application instance",
20
+ "value": "isaac-anselm",
21
+ },
22
+ ],
23
+ "availableHosts": Array [
24
+ Object {
25
+ "label": "lllllll",
26
+ "value": "lllllll",
27
+ },
28
+ ],
29
+ "error": Object {
30
+ "errorMsg": "",
31
+ "status": "",
32
+ "statusText": "",
33
+ },
34
+ "hostsInHostgroup": Object {
35
+ "3": Object {
36
+ "architecture_id": 1,
37
+ "architecture_name": "x86_64",
38
+ "build": true,
39
+ "build_status": 2,
40
+ "build_status_label": "Token expired",
41
+ "capabilities": Array [
42
+ "build",
43
+ ],
44
+ "certname": "isaac-anselm.mylocal",
45
+ "comment": "",
46
+ "compute_profile_id": null,
47
+ "compute_profile_name": null,
48
+ "compute_resource_id": null,
49
+ "compute_resource_name": null,
50
+ "created_at": "2021-08-05 11:16:34 +0200",
51
+ "disk": "",
52
+ "domain_id": 1,
53
+ "domain_name": "mylocal",
54
+ "enabled": true,
55
+ "environment_id": null,
56
+ "environment_name": null,
57
+ "global_status": 0,
58
+ "global_status_label": "Error",
59
+ "hostgroup_id": 1,
60
+ "hostgroup_name": "base",
61
+ "hostgroup_title": "base",
62
+ "id": 3,
63
+ "image_file": "",
64
+ "image_id": null,
65
+ "image_name": null,
66
+ "installed_at": null,
67
+ "ip": null,
68
+ "ip6": "",
69
+ "last_compile": null,
70
+ "last_report": null,
71
+ "location_id": 2,
72
+ "location_name": "Default Location",
73
+ "mac": "00:11:22:33:44:a1",
74
+ "managed": true,
75
+ "medium_id": 1,
76
+ "medium_name": "CentOS 7 mirror",
77
+ "model_id": null,
78
+ "model_name": null,
79
+ "name": "isaac-anselm.mylocal",
80
+ "operatingsystem_id": 1,
81
+ "operatingsystem_name": "centos 7",
82
+ "organization_id": 1,
83
+ "organization_name": "Default Organization",
84
+ "owner_id": 4,
85
+ "owner_name": "Admin User",
86
+ "owner_type": "User",
87
+ "provision_method": "build",
88
+ "ptable_id": 118,
89
+ "ptable_name": "Kickstart default",
90
+ "puppet_ca_proxy": null,
91
+ "puppet_ca_proxy_id": null,
92
+ "puppet_ca_proxy_name": null,
93
+ "puppet_proxy": null,
94
+ "puppet_proxy_id": null,
95
+ "puppet_proxy_name": null,
96
+ "puppet_status": 0,
97
+ "pxe_loader": "PXELinux BIOS",
98
+ "realm_id": null,
99
+ "realm_name": null,
100
+ "sp_ip": null,
101
+ "sp_mac": null,
102
+ "sp_name": null,
103
+ "sp_subnet_id": null,
104
+ "subnet6_id": null,
105
+ "subnet6_name": null,
106
+ "subnet_id": 1,
107
+ "subnet_name": "mylocal",
108
+ "updated_at": "2021-08-05 11:16:34 +0200",
109
+ "uptime_seconds": null,
110
+ "use_image": null,
111
+ "uuid": null,
112
+ },
113
+ "7": Object {
114
+ "architecture_id": 1,
115
+ "architecture_name": "x86_64",
116
+ "build": true,
117
+ "build_status": 2,
118
+ "build_status_label": "Token expired",
119
+ "capabilities": Array [
120
+ "build",
121
+ ],
122
+ "certname": "lllllll.mylocal",
123
+ "comment": null,
124
+ "compute_profile_id": null,
125
+ "compute_profile_name": null,
126
+ "compute_resource_id": null,
127
+ "compute_resource_name": null,
128
+ "created_at": "2021-08-19 14:00:20 +0200",
129
+ "disk": null,
130
+ "domain_id": 1,
131
+ "domain_name": "mylocal",
132
+ "enabled": true,
133
+ "environment_id": null,
134
+ "environment_name": null,
135
+ "global_status": 0,
136
+ "global_status_label": "Error",
137
+ "hostgroup_id": 1,
138
+ "hostgroup_name": "base",
139
+ "hostgroup_title": "base",
140
+ "id": 7,
141
+ "image_file": "",
142
+ "image_id": null,
143
+ "image_name": null,
144
+ "installed_at": null,
145
+ "ip": null,
146
+ "ip6": null,
147
+ "last_compile": null,
148
+ "last_report": null,
149
+ "location_id": 2,
150
+ "location_name": "Default Location",
151
+ "mac": "00:11:22:33:60:15",
152
+ "managed": true,
153
+ "medium_id": 1,
154
+ "medium_name": "CentOS 7 mirror",
155
+ "model_id": null,
156
+ "model_name": null,
157
+ "name": "lllllll.mylocal",
158
+ "operatingsystem_id": 1,
159
+ "operatingsystem_name": "centos 7",
160
+ "organization_id": 1,
161
+ "organization_name": "Default Organization",
162
+ "owner_id": 4,
163
+ "owner_name": "Admin User",
164
+ "owner_type": "User",
165
+ "provision_method": "build",
166
+ "ptable_id": 118,
167
+ "ptable_name": "Kickstart default",
168
+ "puppet_ca_proxy": null,
169
+ "puppet_ca_proxy_id": null,
170
+ "puppet_ca_proxy_name": null,
171
+ "puppet_proxy": null,
172
+ "puppet_proxy_id": null,
173
+ "puppet_proxy_name": null,
174
+ "puppet_status": 0,
175
+ "pxe_loader": "PXELinux BIOS",
176
+ "realm_id": null,
177
+ "realm_name": null,
178
+ "sp_ip": null,
179
+ "sp_mac": null,
180
+ "sp_name": null,
181
+ "sp_subnet_id": null,
182
+ "subnet6_id": null,
183
+ "subnet6_name": null,
184
+ "subnet_id": 1,
185
+ "subnet_name": "mylocal",
186
+ "updated_at": "2021-08-19 14:00:20 +0200",
187
+ "uptime_seconds": null,
188
+ "use_image": null,
189
+ "uuid": null,
190
+ },
191
+ },
192
+ "selectedHosts": Array [
193
+ Object {
194
+ "fqdn": "isaac-anselm.mylocal",
195
+ "hostgroupId": 1,
196
+ "hostname": "isaac-anselm",
197
+ "serviceId": 2,
198
+ },
199
+ ],
200
+ "serviceId": 2,
201
+ }
202
+ `;
203
+
204
+ exports[`ExistingHostSelectionReducer should initialize component 1`] = `
205
+ Object {
206
+ "error": Object {
207
+ "errorMsg": "",
208
+ "status": "",
209
+ "statusText": "",
210
+ },
211
+ "payload": Object {
212
+ "alreadyUsedHosts": Array [
213
+ Object {
214
+ "disabled": true,
215
+ "label": "isaac-anselm",
216
+ "tooltipText": "Host already used for this application instance",
217
+ "value": 5,
218
+ },
219
+ ],
220
+ "hostsInHostgroup": Object {},
221
+ "selectedHosts": Array [],
222
+ "serviceId": 2,
223
+ },
224
+ "serviceId": undefined,
225
+ }
226
+ `;
227
+
228
+ exports[`ExistingHostSelectionReducer should load host data be erroneous 1`] = `
229
+ Object {
230
+ "allHosts": Array [
231
+ Object {
232
+ "ansibleParameters": Array [],
233
+ "description": "",
234
+ "foremanParameters": Array [],
235
+ "hostname": "isaac-anselm",
236
+ "id": 5,
237
+ "service": "1",
238
+ },
239
+ ],
240
+ "alreadyUsedHosts": Array [
241
+ Object {
242
+ "disabled": true,
243
+ "label": "isaac-anselm",
244
+ "tooltipText": "Host already used for this application instance",
245
+ "value": "isaac-anselm",
246
+ },
247
+ ],
248
+ "availableHosts": Array [
249
+ Object {
250
+ "label": "lllllll",
251
+ "value": "lllllll",
252
+ },
253
+ ],
254
+ "error": "Something really bad happend",
255
+ "hostsInHostgroup": Object {
256
+ "3": Object {
257
+ "architecture_id": 1,
258
+ "architecture_name": "x86_64",
259
+ "build": true,
260
+ "build_status": 2,
261
+ "build_status_label": "Token expired",
262
+ "capabilities": Array [
263
+ "build",
264
+ ],
265
+ "certname": "isaac-anselm.mylocal",
266
+ "comment": "",
267
+ "compute_profile_id": null,
268
+ "compute_profile_name": null,
269
+ "compute_resource_id": null,
270
+ "compute_resource_name": null,
271
+ "created_at": "2021-08-05 11:16:34 +0200",
272
+ "disk": "",
273
+ "domain_id": 1,
274
+ "domain_name": "mylocal",
275
+ "enabled": true,
276
+ "environment_id": null,
277
+ "environment_name": null,
278
+ "global_status": 0,
279
+ "global_status_label": "Error",
280
+ "hostgroup_id": 1,
281
+ "hostgroup_name": "base",
282
+ "hostgroup_title": "base",
283
+ "id": 3,
284
+ "image_file": "",
285
+ "image_id": null,
286
+ "image_name": null,
287
+ "installed_at": null,
288
+ "ip": null,
289
+ "ip6": "",
290
+ "last_compile": null,
291
+ "last_report": null,
292
+ "location_id": 2,
293
+ "location_name": "Default Location",
294
+ "mac": "00:11:22:33:44:a1",
295
+ "managed": true,
296
+ "medium_id": 1,
297
+ "medium_name": "CentOS 7 mirror",
298
+ "model_id": null,
299
+ "model_name": null,
300
+ "name": "isaac-anselm.mylocal",
301
+ "operatingsystem_id": 1,
302
+ "operatingsystem_name": "centos 7",
303
+ "organization_id": 1,
304
+ "organization_name": "Default Organization",
305
+ "owner_id": 4,
306
+ "owner_name": "Admin User",
307
+ "owner_type": "User",
308
+ "provision_method": "build",
309
+ "ptable_id": 118,
310
+ "ptable_name": "Kickstart default",
311
+ "puppet_ca_proxy": null,
312
+ "puppet_ca_proxy_id": null,
313
+ "puppet_ca_proxy_name": null,
314
+ "puppet_proxy": null,
315
+ "puppet_proxy_id": null,
316
+ "puppet_proxy_name": null,
317
+ "puppet_status": 0,
318
+ "pxe_loader": "PXELinux BIOS",
319
+ "realm_id": null,
320
+ "realm_name": null,
321
+ "sp_ip": null,
322
+ "sp_mac": null,
323
+ "sp_name": null,
324
+ "sp_subnet_id": null,
325
+ "subnet6_id": null,
326
+ "subnet6_name": null,
327
+ "subnet_id": 1,
328
+ "subnet_name": "mylocal",
329
+ "updated_at": "2021-08-05 11:16:34 +0200",
330
+ "uptime_seconds": null,
331
+ "use_image": null,
332
+ "uuid": null,
333
+ },
334
+ "7": Object {
335
+ "architecture_id": 1,
336
+ "architecture_name": "x86_64",
337
+ "build": true,
338
+ "build_status": 2,
339
+ "build_status_label": "Token expired",
340
+ "capabilities": Array [
341
+ "build",
342
+ ],
343
+ "certname": "lllllll.mylocal",
344
+ "comment": null,
345
+ "compute_profile_id": null,
346
+ "compute_profile_name": null,
347
+ "compute_resource_id": null,
348
+ "compute_resource_name": null,
349
+ "created_at": "2021-08-19 14:00:20 +0200",
350
+ "disk": null,
351
+ "domain_id": 1,
352
+ "domain_name": "mylocal",
353
+ "enabled": true,
354
+ "environment_id": null,
355
+ "environment_name": null,
356
+ "global_status": 0,
357
+ "global_status_label": "Error",
358
+ "hostgroup_id": 1,
359
+ "hostgroup_name": "base",
360
+ "hostgroup_title": "base",
361
+ "id": 7,
362
+ "image_file": "",
363
+ "image_id": null,
364
+ "image_name": null,
365
+ "installed_at": null,
366
+ "ip": null,
367
+ "ip6": null,
368
+ "last_compile": null,
369
+ "last_report": null,
370
+ "location_id": 2,
371
+ "location_name": "Default Location",
372
+ "mac": "00:11:22:33:60:15",
373
+ "managed": true,
374
+ "medium_id": 1,
375
+ "medium_name": "CentOS 7 mirror",
376
+ "model_id": null,
377
+ "model_name": null,
378
+ "name": "lllllll.mylocal",
379
+ "operatingsystem_id": 1,
380
+ "operatingsystem_name": "centos 7",
381
+ "organization_id": 1,
382
+ "organization_name": "Default Organization",
383
+ "owner_id": 4,
384
+ "owner_name": "Admin User",
385
+ "owner_type": "User",
386
+ "provision_method": "build",
387
+ "ptable_id": 118,
388
+ "ptable_name": "Kickstart default",
389
+ "puppet_ca_proxy": null,
390
+ "puppet_ca_proxy_id": null,
391
+ "puppet_ca_proxy_name": null,
392
+ "puppet_proxy": null,
393
+ "puppet_proxy_id": null,
394
+ "puppet_proxy_name": null,
395
+ "puppet_status": 0,
396
+ "pxe_loader": "PXELinux BIOS",
397
+ "realm_id": null,
398
+ "realm_name": null,
399
+ "sp_ip": null,
400
+ "sp_mac": null,
401
+ "sp_name": null,
402
+ "sp_subnet_id": null,
403
+ "subnet6_id": null,
404
+ "subnet6_name": null,
405
+ "subnet_id": 1,
406
+ "subnet_name": "mylocal",
407
+ "updated_at": "2021-08-19 14:00:20 +0200",
408
+ "uptime_seconds": null,
409
+ "use_image": null,
410
+ "uuid": null,
411
+ },
412
+ },
413
+ "selectedHosts": Array [],
414
+ "serviceId": 2,
415
+ }
416
+ `;
417
+
418
+ exports[`ExistingHostSelectionReducer should load host data be successful 1`] = `
419
+ Object {
420
+ "allHosts": Array [
421
+ Object {
422
+ "ansibleParameters": Array [],
423
+ "description": "",
424
+ "foremanParameters": Array [],
425
+ "hostname": "isaac-anselm",
426
+ "id": 5,
427
+ "service": "1",
428
+ },
429
+ ],
430
+ "alreadyUsedHosts": Array [],
431
+ "availableHosts": Array [
432
+ Object {
433
+ "label": "lllllll",
434
+ "value": "lllllll",
435
+ },
436
+ ],
437
+ "error": Object {
438
+ "errorMsg": "",
439
+ "status": "",
440
+ "statusText": "",
441
+ },
442
+ "hostsInHostgroup": Object {
443
+ "isaac-anselm": Object {
444
+ "architecture_id": 1,
445
+ "architecture_name": "x86_64",
446
+ "build": true,
447
+ "build_status": 2,
448
+ "build_status_label": "Token expired",
449
+ "capabilities": Array [
450
+ "build",
451
+ ],
452
+ "certname": "isaac-anselm.mylocal",
453
+ "comment": "",
454
+ "compute_profile_id": null,
455
+ "compute_profile_name": null,
456
+ "compute_resource_id": null,
457
+ "compute_resource_name": null,
458
+ "created_at": "2021-08-05 11:16:34 +0200",
459
+ "disk": "",
460
+ "domain_id": 1,
461
+ "domain_name": "mylocal",
462
+ "enabled": true,
463
+ "environment_id": null,
464
+ "environment_name": null,
465
+ "global_status": 0,
466
+ "global_status_label": "Error",
467
+ "hostgroup_id": 1,
468
+ "hostgroup_name": "base",
469
+ "hostgroup_title": "base",
470
+ "id": 3,
471
+ "image_file": "",
472
+ "image_id": null,
473
+ "image_name": null,
474
+ "installed_at": null,
475
+ "ip": null,
476
+ "ip6": "",
477
+ "last_compile": null,
478
+ "last_report": null,
479
+ "location_id": 2,
480
+ "location_name": "Default Location",
481
+ "mac": "00:11:22:33:44:a1",
482
+ "managed": true,
483
+ "medium_id": 1,
484
+ "medium_name": "CentOS 7 mirror",
485
+ "model_id": null,
486
+ "model_name": null,
487
+ "name": "isaac-anselm.mylocal",
488
+ "operatingsystem_id": 1,
489
+ "operatingsystem_name": "centos 7",
490
+ "organization_id": 1,
491
+ "organization_name": "Default Organization",
492
+ "owner_id": 4,
493
+ "owner_name": "Admin User",
494
+ "owner_type": "User",
495
+ "provision_method": "build",
496
+ "ptable_id": 118,
497
+ "ptable_name": "Kickstart default",
498
+ "puppet_ca_proxy": null,
499
+ "puppet_ca_proxy_id": null,
500
+ "puppet_ca_proxy_name": null,
501
+ "puppet_proxy": null,
502
+ "puppet_proxy_id": null,
503
+ "puppet_proxy_name": null,
504
+ "puppet_status": 0,
505
+ "pxe_loader": "PXELinux BIOS",
506
+ "realm_id": null,
507
+ "realm_name": null,
508
+ "sp_ip": null,
509
+ "sp_mac": null,
510
+ "sp_name": null,
511
+ "sp_subnet_id": null,
512
+ "subnet6_id": null,
513
+ "subnet6_name": null,
514
+ "subnet_id": 1,
515
+ "subnet_name": "mylocal",
516
+ "updated_at": "2021-08-05 11:16:34 +0200",
517
+ "uptime_seconds": null,
518
+ "use_image": null,
519
+ "uuid": null,
520
+ },
521
+ "lllllll": Object {
522
+ "architecture_id": 1,
523
+ "architecture_name": "x86_64",
524
+ "build": true,
525
+ "build_status": 2,
526
+ "build_status_label": "Token expired",
527
+ "capabilities": Array [
528
+ "build",
529
+ ],
530
+ "certname": "lllllll.mylocal",
531
+ "comment": null,
532
+ "compute_profile_id": null,
533
+ "compute_profile_name": null,
534
+ "compute_resource_id": null,
535
+ "compute_resource_name": null,
536
+ "created_at": "2021-08-19 14:00:20 +0200",
537
+ "disk": null,
538
+ "domain_id": 1,
539
+ "domain_name": "mylocal",
540
+ "enabled": true,
541
+ "environment_id": null,
542
+ "environment_name": null,
543
+ "global_status": 0,
544
+ "global_status_label": "Error",
545
+ "hostgroup_id": 1,
546
+ "hostgroup_name": "base",
547
+ "hostgroup_title": "base",
548
+ "id": 7,
549
+ "image_file": "",
550
+ "image_id": null,
551
+ "image_name": null,
552
+ "installed_at": null,
553
+ "ip": null,
554
+ "ip6": null,
555
+ "last_compile": null,
556
+ "last_report": null,
557
+ "location_id": 2,
558
+ "location_name": "Default Location",
559
+ "mac": "00:11:22:33:60:15",
560
+ "managed": true,
561
+ "medium_id": 1,
562
+ "medium_name": "CentOS 7 mirror",
563
+ "model_id": null,
564
+ "model_name": null,
565
+ "name": "lllllll.mylocal",
566
+ "operatingsystem_id": 1,
567
+ "operatingsystem_name": "centos 7",
568
+ "organization_id": 1,
569
+ "organization_name": "Default Organization",
570
+ "owner_id": 4,
571
+ "owner_name": "Admin User",
572
+ "owner_type": "User",
573
+ "provision_method": "build",
574
+ "ptable_id": 118,
575
+ "ptable_name": "Kickstart default",
576
+ "puppet_ca_proxy": null,
577
+ "puppet_ca_proxy_id": null,
578
+ "puppet_ca_proxy_name": null,
579
+ "puppet_proxy": null,
580
+ "puppet_proxy_id": null,
581
+ "puppet_proxy_name": null,
582
+ "puppet_status": 0,
583
+ "pxe_loader": "PXELinux BIOS",
584
+ "realm_id": null,
585
+ "realm_name": null,
586
+ "sp_ip": null,
587
+ "sp_mac": null,
588
+ "sp_name": null,
589
+ "sp_subnet_id": null,
590
+ "subnet6_id": null,
591
+ "subnet6_name": null,
592
+ "subnet_id": 1,
593
+ "subnet_name": "mylocal",
594
+ "updated_at": "2021-08-19 14:00:20 +0200",
595
+ "uptime_seconds": null,
596
+ "use_image": null,
597
+ "uuid": null,
598
+ },
599
+ },
600
+ "selectedHosts": Array [],
601
+ "serviceId": 1,
602
+ }
603
+ `;
604
+
605
+ exports[`ExistingHostSelectionReducer should return initial state 1`] = `
606
+ Object {
607
+ "error": Object {
608
+ "errorMsg": "",
609
+ "status": "",
610
+ "statusText": "",
611
+ },
612
+ "serviceId": undefined,
613
+ }
614
+ `;
@@ -0,0 +1,27 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ExistingHostSelectionSelectors should return alreadyUsedHosts from existingHostSelectionConfData_1 fixtures 1`] = `
4
+ Array [
5
+ Object {
6
+ "disabled": true,
7
+ "label": "isaac-anselm",
8
+ "tooltipText": "Host already used for this application instance",
9
+ "value": "isaac-anselm",
10
+ },
11
+ ]
12
+ `;
13
+
14
+ exports[`ExistingHostSelectionSelectors should return availableHosts from existingHostSelectionConfData_1 fixtures 1`] = `
15
+ Array [
16
+ Object {
17
+ "label": "lllllll",
18
+ "value": "lllllll",
19
+ },
20
+ ]
21
+ `;
22
+
23
+ exports[`ExistingHostSelectionSelectors should return hostsInHostgroup from existingHostSelectionConfData_1 fixtures 1`] = `undefined`;
24
+
25
+ exports[`ExistingHostSelectionSelectors should return selectedHosts from existingHostSelectionConfData_1 fixtures 1`] = `Array []`;
26
+
27
+ exports[`ExistingHostSelectionSelectors should return serviceId from existingHostSelectionConfData_1 fixtures 1`] = `2`;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ExtSelect from '../../common/ExtSelect';
4
+ import RailsData from '../../common/RailsData'
5
+
6
+ const ServiceSelector= ({
7
+ label,
8
+ hidden,
9
+ viewText,
10
+ selectValue,
11
+ onChange,
12
+ options,
13
+ additionalData,
14
+ }) =>{
15
+ return (
16
+ <div className="form-group">
17
+ <label className="col-md-2 control-label">{label}</label>
18
+ <div className="col-md-4">
19
+ <ExtSelect
20
+ hidden={hidden}
21
+ editable={true}
22
+ viewText={viewText}
23
+ selectValue={selectValue}
24
+ onChange={onChange}
25
+ options={options}
26
+ additionalData={additionalData}
27
+ />
28
+ <RailsData
29
+ key='service_id'
30
+ view='existing_host_selection'
31
+ parameter='service_id'
32
+ value={selectValue}
33
+ />
34
+ </div>
35
+ </div>
36
+ );
37
+ };
38
+
39
+ ServiceSelector.propTypes = {
40
+ label: PropTypes.string.isRequired,
41
+ viewText: PropTypes.string,
42
+ selectValue: PropTypes.string,
43
+ onChange: PropTypes.func.isRequired,
44
+ options: PropTypes.object,
45
+ additionalData: PropTypes.object,
46
+ };
47
+
48
+ export default ServiceSelector;