foreman_acd 0.6.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +90 -0
  4. data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
  5. data/app/controllers/foreman_acd/app_instances_controller.rb +34 -32
  6. data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
  7. data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
  8. data/app/controllers/foreman_acd/remote_execution_controller.rb +37 -21
  9. data/app/controllers/ui_acd_controller.rb +42 -3
  10. data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +12 -7
  11. data/app/lib/actions/foreman_acd/run_configurator.rb +11 -7
  12. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +41 -28
  13. data/app/models/foreman_acd/acd_provider.rb +7 -1
  14. data/app/models/foreman_acd/ansible_playbook.rb +2 -1
  15. data/app/models/foreman_acd/app_instance.rb +48 -3
  16. data/app/models/foreman_acd/foreman_host.rb +8 -0
  17. data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
  18. data/app/services/foreman_acd/app_configurator.rb +59 -15
  19. data/app/services/foreman_acd/app_deployer.rb +27 -4
  20. data/app/services/foreman_acd/inventory_creator.rb +25 -1
  21. data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +41 -7
  22. data/app/views/foreman_acd/app_definitions/_form.html.erb +5 -1
  23. data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
  24. data/app/views/foreman_acd/app_definitions/index.html.erb +3 -6
  25. data/app/views/foreman_acd/app_instances/_form.html.erb +5 -1
  26. data/app/views/foreman_acd/app_instances/index.html.erb +18 -12
  27. data/app/views/foreman_acd/app_instances/report.html.erb +8 -3
  28. data/app/views/templates/job/run_acd_ansible_playbook.erb +1 -1
  29. data/app/views/ui_acd/host_report.json.rabl +4 -0
  30. data/app/views/ui_acd/report_data.json.rabl +10 -0
  31. data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
  32. data/config/routes.rb +6 -0
  33. data/db/migrate/20210316151145_add_git_commit_to_ansible_playbooks.rb +8 -0
  34. data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +8 -0
  35. data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
  36. data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
  37. data/db/seeds.d/75-job_templates.rb +1 -1
  38. data/lib/foreman_acd/engine.rb +26 -4
  39. data/lib/foreman_acd/plugin.rb +9 -18
  40. data/lib/foreman_acd/version.rb +1 -1
  41. data/lib/foreman_acd.rb +30 -0
  42. data/lib/tasks/foreman_acd_tasks.rake +0 -12
  43. data/package.json +8 -22
  44. data/test/controllers/ansible_playbooks_controller_test.rb +1 -1
  45. data/test/controllers/app_instances_controller_test.rb +8 -3
  46. data/test/controllers/ui_acd_controller_test.rb +25 -6
  47. data/test/factories/foreman_acd_factories.rb +18 -4
  48. data/test/models/acd_provider_test.rb +37 -0
  49. data/test/models/ansible_playbook_test.rb +11 -0
  50. data/test/models/app_definition_test.rb +1 -1
  51. data/test/models/app_instance_test.rb +2 -0
  52. data/test/models/concerns/host_extensions_test.rb +26 -0
  53. data/test/models/foreman_host_test.rb +12 -0
  54. data/webpack/__mocks__/foremanReact/API.js +2 -0
  55. data/webpack/__mocks__/foremanReact/common/I18n.js +3 -0
  56. data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
  57. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  58. data/webpack/__mocks__/foremanReact/components/ForemanModal.js +7 -0
  59. data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
  60. data/webpack/__mocks__/foremanReact/components/common/forms/TextInput.js +2 -0
  61. data/webpack/__mocks__/foremanReact/components/hosts/powerStatus.js +1 -0
  62. data/webpack/__snapshots__/helper.test.js.snap +14 -0
  63. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +35 -11
  64. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +12 -0
  65. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
  66. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
  67. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
  68. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionConfData_1.fixtures.js +288 -0
  69. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +79 -0
  70. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +26 -0
  71. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
  72. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +53 -0
  73. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +226 -0
  74. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
  75. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +307 -0
  76. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +2 -1
  77. data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +41 -0
  78. data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +121 -0
  79. data/webpack/components/ApplicationDefinition/index.js +8 -0
  80. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
  81. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
  82. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
  83. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
  84. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
  85. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
  86. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
  87. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
  88. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
  89. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
  90. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
  91. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
  92. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
  93. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
  94. data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
  95. data/webpack/components/ApplicationInstance/ApplicationInstance.js +105 -31
  96. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +118 -6
  97. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -0
  98. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
  99. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +71 -30
  100. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
  101. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
  102. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +80 -0
  103. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +24 -0
  104. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +131 -0
  105. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +56 -0
  106. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +300 -0
  107. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2990 -0
  108. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +284 -0
  109. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
  110. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
  111. data/webpack/components/ApplicationInstance/helper.js +0 -0
  112. data/webpack/components/ApplicationInstance/index.js +8 -0
  113. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +81 -6
  114. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +35 -1
  115. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +3 -0
  116. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -0
  117. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
  118. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportData_1.fixtures.js +349 -0
  119. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +20 -0
  120. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +47 -0
  121. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportReducer.test.js +41 -0
  122. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +26 -0
  123. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +7 -0
  124. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +718 -0
  125. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +347 -0
  126. data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +24 -0
  127. data/webpack/components/ApplicationInstanceReport/components/__tests__/__snapshots__/ReportViewer.test.js.snap +24 -0
  128. data/webpack/components/ApplicationInstanceReport/index.js +8 -1
  129. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
  130. data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
  131. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
  132. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
  133. data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
  134. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
  135. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
  136. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
  137. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
  138. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
  139. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
  140. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
  141. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
  142. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
  143. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
  144. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
  145. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
  146. data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
  147. data/webpack/components/ExistingHostSelection/index.js +26 -0
  148. data/webpack/components/ParameterSelection/ParameterSelection.js +103 -1
  149. data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
  150. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +46 -4
  151. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
  152. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
  153. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +51 -29
  154. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -0
  155. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +124 -84
  156. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +10 -4
  157. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +36 -46
  158. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +33 -25
  159. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +12 -6
  160. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +84 -112
  161. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1589 -878
  162. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +130 -79
  163. data/webpack/components/ParameterSelection/index.js +4 -1
  164. data/webpack/components/SyncGitRepo/SyncGitRepo.js +202 -0
  165. data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
  166. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +123 -0
  167. data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +8 -0
  168. data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +80 -0
  169. data/webpack/components/SyncGitRepo/SyncGitRepoSelectors.js +6 -0
  170. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +7 -0
  171. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +44 -0
  172. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +27 -0
  173. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoReducer.test.js +95 -0
  174. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +32 -0
  175. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +31 -0
  176. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoReducer.test.js.snap +137 -0
  177. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +13 -0
  178. data/webpack/components/SyncGitRepo/components/FormTextInput.js +42 -0
  179. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +47 -0
  180. data/webpack/components/SyncGitRepo/index.js +28 -0
  181. data/webpack/components/common/DeleteTableEntry.js +16 -2
  182. data/webpack/components/common/ExtTextInput.js +43 -0
  183. data/webpack/components/common/__tests__/EditTableEntry.test.js +53 -0
  184. data/webpack/components/common/__tests__/LockTableEntry.test.js +35 -0
  185. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +40 -2
  186. data/webpack/components/common/__tests__/__snapshots__/EditTableEntry.test.js.snap +81 -0
  187. data/webpack/components/common/__tests__/__snapshots__/LockTableEntry.test.js.snap +60 -0
  188. data/webpack/helper.js +35 -1
  189. data/webpack/helper.test.js +56 -0
  190. data/webpack/index.js +7 -0
  191. data/webpack/js-yaml.js +3874 -0
  192. data/webpack/reducer.js +16 -1
  193. data/webpack/test_setup.js +0 -2
  194. metadata +136 -11
  195. data/webpack/components/common/EasyHeaderFormatter.js +0 -18
  196. data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
  197. data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
@@ -5,31 +5,51 @@ export const parameterSelectionData_1 = {
5
5
  status: '',
6
6
  statusText: ''
7
7
  },
8
- foremanData: {
8
+ paramData: {
9
9
  hostgroup_id: 1,
10
10
  environments: [
11
11
  {
12
12
  id: 1,
13
13
  name: 'production'
14
+ }
15
+ ],
16
+ lifecycle_environments: [
17
+ {
18
+ id: 1,
19
+ name: 'Library'
20
+ }
21
+ ],
22
+ domains: [
23
+ {
24
+ id: 1,
25
+ name: 'deploy3.dev.atix'
26
+ }
27
+ ],
28
+ computeprofiles: [
29
+ {
30
+ id: 1,
31
+ name: '1-Small'
14
32
  },
15
33
  {
16
34
  id: 2,
17
- name: 'test'
35
+ name: '2-Medium'
36
+ },
37
+ {
38
+ id: 3,
39
+ name: '3-Large'
40
+ },
41
+ {
42
+ id: 4,
43
+ name: 'Orchahosts-VM'
18
44
  }
19
45
  ],
20
- lifecycle_environments: [],
21
- domains: [],
22
- computeprofiles: [],
23
46
  ptables: [
24
47
  {
25
- id: 105,
48
+ id: 125,
26
49
  name: 'Kickstart default'
27
- },
28
- {
29
- id: 104,
30
- name: 'Kickstart default thin'
31
50
  }
32
- ]
51
+ ],
52
+ dataType: 'PARAMETER_SELECTION_PARAM_TYPE_FOREMAN'
33
53
  },
34
54
  hostgroupId: 1,
35
55
  loading: false,
@@ -39,10 +59,10 @@ export const parameterSelectionData_1 = {
39
59
  position: 0
40
60
  }
41
61
  },
42
- appDefinition: {
62
+ paramDefinition: {
43
63
  id: 1,
44
- name: 'Test123',
45
- hostgroup_id: 1
64
+ name: 'web',
65
+ dataId: '1'
46
66
  },
47
67
  columns: [
48
68
  {
@@ -50,30 +70,56 @@ export const parameterSelectionData_1 = {
50
70
  header: {
51
71
  label: 'Name',
52
72
  props: {
53
- index: 0,
54
73
  sort: true,
55
74
  style: {
56
- width: '20%'
57
- }
75
+ width: '25%'
76
+ },
77
+ index: 0
58
78
  },
79
+ transforms: [
80
+ null
81
+ ],
82
+ formatters: [
83
+ null
84
+ ],
85
+ customFormatters: [
86
+ null
87
+ ]
59
88
  },
89
+ cell: {
90
+ formatters: [
91
+ null
92
+ ]
93
+ }
60
94
  },
61
95
  {
62
96
  property: 'description',
63
97
  header: {
64
98
  label: 'Description',
65
99
  props: {
66
- index: 1,
67
100
  sort: true,
68
101
  style: {
69
102
  width: '25%'
70
- }
103
+ },
104
+ index: 1
71
105
  },
106
+ transforms: [
107
+ null
108
+ ],
109
+ formatters: [
110
+ null
111
+ ],
112
+ customFormatters: [
113
+ null
114
+ ]
72
115
  },
73
116
  cell: {
74
117
  props: {
75
118
  index: 1
76
119
  },
120
+ formatters: [
121
+ null
122
+ ]
77
123
  }
78
124
  },
79
125
  {
@@ -81,17 +127,26 @@ export const parameterSelectionData_1 = {
81
127
  header: {
82
128
  label: 'Type',
83
129
  props: {
84
- index: 2,
85
130
  sort: true,
86
131
  style: {
87
132
  width: '20%'
88
- }
133
+ },
134
+ index: 2
89
135
  },
136
+ transforms: [
137
+ null
138
+ ],
139
+ formatters: [
140
+ null
141
+ ],
142
+ customFormatters: [
143
+ null
144
+ ]
90
145
  },
91
146
  cell: {
92
- props: {
93
- index: 2
94
- },
147
+ formatters: [
148
+ null
149
+ ]
95
150
  }
96
151
  },
97
152
  {
@@ -99,17 +154,26 @@ export const parameterSelectionData_1 = {
99
154
  header: {
100
155
  label: 'Default value',
101
156
  props: {
102
- index: 3,
103
157
  sort: true,
104
158
  style: {
105
- width: '25%'
106
- }
159
+ width: '20%'
160
+ },
161
+ index: 3
107
162
  },
163
+ transforms: [
164
+ null
165
+ ],
166
+ formatters: [
167
+ null
168
+ ],
169
+ customFormatters: [
170
+ null
171
+ ]
108
172
  },
109
173
  cell: {
110
- props: {
111
- index: 3
112
- },
174
+ formatters: [
175
+ null
176
+ ]
113
177
  }
114
178
  },
115
179
  {
@@ -117,78 +181,54 @@ export const parameterSelectionData_1 = {
117
181
  header: {
118
182
  label: 'Actions',
119
183
  props: {
184
+ style: {
185
+ width: '10%'
186
+ },
120
187
  index: 4
121
188
  },
189
+ formatters: [
190
+ null
191
+ ]
122
192
  },
123
193
  cell: {
124
- props: {
125
- index: 4
126
- },
194
+ formatters: [
195
+ null
196
+ ]
127
197
  }
128
198
  }
129
199
  ],
130
200
  parameters: [
131
201
  {
132
202
  id: 1,
133
- name: 'PuppetEnv',
203
+ locked: false,
204
+ name: 'CP',
134
205
  description: '',
135
- type: 'puppetenv',
136
- value: '2'
206
+ type: 'computeprofile',
207
+ value: '1'
137
208
  },
138
209
  {
139
210
  id: 2,
140
- name: 'PW',
141
- description: '',
142
- type: 'password',
143
- value: 'rooot'
144
- },
145
- {
146
- id: 3,
147
- name: 'Blub',
148
- description: '',
149
- type: 'hostparam',
150
- value: 'awesome'
151
- },
152
- {
153
- id: 4,
154
- name: '111allo',
155
- description: '',
156
- type: 'ip',
157
- value: '1.1.1.1'
158
- },
159
- {
160
- id: 5,
161
- name: '1111aasdfasf',
162
- description: '',
163
- type: 'hostname',
164
- value: 'dername'
165
- },
166
- {
167
- id: 6,
168
- name: '222nocheiner',
211
+ locked: true,
212
+ name: 'LE',
169
213
  description: '',
170
- type: 'hostparam',
171
- value: ''
172
- },
173
- {
174
- id: 7,
175
- name: 'aaaaa',
176
- description: 'aa',
177
- type: 'ptable',
178
- value: ''
179
- },
180
- {
181
- id: 8,
182
- name: 'aaa',
183
- description: '',
184
- type: 'hostparam',
185
- value: '2134234'
214
+ type: 'lifecycleenv',
215
+ value: '1'
186
216
  }
187
217
  ],
218
+ allowedParameterTypes: [
219
+ 'domain',
220
+ 'hostparam',
221
+ 'ip',
222
+ 'ptable',
223
+ 'puppetenv',
224
+ 'password',
225
+ ],
188
226
  parameterTypes: {
189
- computeprofile: 'Compute profile',
190
227
  domain: 'Domain',
191
228
  hostparam: 'Host parameter',
192
- lifecycleenv: 'Lifecycle environment'
229
+ ip: 'IP',
230
+ ptable: 'Partition table',
231
+ puppetenv: 'Puppet environment',
232
+ password: 'Root password'
193
233
  }
194
- };
234
+ }
@@ -11,15 +11,21 @@ import {
11
11
 
12
12
  export const successState = Immutable(parameterSelectionData_1);
13
13
 
14
- const EDIT_ROW_ID = 5;
14
+ const EDIT_ROW_ID = 2;
15
15
 
16
16
  const editClone = parameterSelectionData_1;
17
17
  const editIndex = findIndex(editClone.parameters, { id: EDIT_ROW_ID })
18
18
  editClone["parameters"][editIndex].backup = cloneDeep(editClone["parameters"][editIndex]);
19
19
  export const editState = Immutable(editClone);
20
20
 
21
+ // Payload Data
21
22
  export const initParameterSelectionPayload = parameterSelectionData_1;
22
23
  export const addParameterPayload = { };
24
+ export const lockParameterPayload = {
25
+ rowData: {
26
+ id: EDIT_ROW_ID,
27
+ },
28
+ };
23
29
  export const deleteParameterPayload = {
24
30
  rowData: {
25
31
  id: EDIT_ROW_ID,
@@ -51,10 +57,10 @@ export const sortParameterPayload = {
51
57
  selectedColumn: "type",
52
58
  };
53
59
 
54
- export const loadForemanDataRequestPayload = {
60
+ export const loadParamDataRequestPayload = {
55
61
  clearRows: false,
56
62
  };
57
- export const loadForemanDataSuccessPayload = {
63
+ export const loadParamDataSuccessPayload = {
58
64
  hostgroup_id: 1,
59
65
  environments: [
60
66
  {
@@ -80,6 +86,6 @@ export const loadForemanDataSuccessPayload = {
80
86
  }
81
87
  ]
82
88
  };
83
- export const loadForemanDataFailurePayload = {
89
+ export const loadParamDataFailurePayload = {
84
90
  error: "Something really bad happend",
85
91
  };
@@ -3,65 +3,55 @@ import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
3
3
  import ParameterSelection from '../ParameterSelection';
4
4
 
5
5
  import {
6
- newDefinition,
7
- editDefinition,
8
- newInstance,
9
- editInstance,
10
- } from '../__fixtures__/parameterSelection.fixtures'
11
-
12
- jest.mock('foremanReact/components/common/forms/Select');
6
+ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
7
+ PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
8
+ } from '../ParameterSelectionConstants';
13
9
 
14
10
  const noop = () => {};
15
11
 
16
12
  const fixtures = {
17
- 'should render newDefinition': {
13
+ 'should render foreman parameter selection': {
18
14
  location: "Default Location",
19
15
  organization: "Default Organization",
20
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
21
- loading: false,
22
- data: newDefinition,
23
- error: { statusText: '', errorMsg: '' },
24
- initParameterSelection: noop,
25
- loadForemanData: noop,
16
+ editModeCallback: noop,
17
+ paramDataUrl: "/acd/ui_acd_fdata/__id__",
18
+ paramType: PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
19
+ data: {
20
+ type: PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
21
+ parameters: [],
22
+ useDefaultValue: true,
23
+ allowRowAdjustment: true,
24
+ allowNameAdjustment: true,
25
+ allowDescriptionAdjustment: true,
26
+ },
26
27
  addParameter: noop,
27
- deleteParameter: noop,
28
- },
29
- 'should render editDefinition': {
30
- location: "Default Location",
31
- organization: "Default Organization",
32
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
33
- loading: false,
34
- data: editDefinition,
35
- error: { statusText: '', errorMsg: '' },
28
+ confirmEditParametre: noop,
29
+ cancelEditParameter: noop,
30
+ editModeCallback: noop,
31
+ loadParamData: noop,
36
32
  initParameterSelection: noop,
37
- loadForemanData: noop,
38
- addParameter: noop,
39
- deleteParameter: noop,
40
33
  },
41
- 'should render newInstance': {
34
+
35
+ 'should render ansible parameter selection': {
42
36
  location: "Default Location",
43
37
  organization: "Default Organization",
44
- loading: false,
45
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
46
- data: newInstance,
47
- error: { statusText: '', errorMsg: '' },
48
- initParameterSelection: noop,
49
- loadForemanData: noop,
38
+ editModeCallback: noop,
39
+ paramType: PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
40
+ data: {
41
+ type: PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
42
+ parameters: [],
43
+ useDefaultValue: false,
44
+ allowRowAdjustment: true,
45
+ allowNameAdjustment: true,
46
+ allowDescriptionAdjustment: true,
47
+ },
50
48
  addParameter: noop,
51
- deleteParameter: noop,
52
- },
53
- 'should render editInstance': {
54
- location: "Default Location",
55
- organization: "Default Organization",
56
- loading: false,
57
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
58
- data: editInstance,
59
- error: { statusText: '', errorMsg: '' },
49
+ confirmEditParametre: noop,
50
+ cancelEditParameter: noop,
51
+ editModeCallback: noop,
52
+ loadParamData: noop,
60
53
  initParameterSelection: noop,
61
- loadForemanData: noop,
62
- addParameter: noop,
63
- deleteParameter: noop,
64
- },
54
+ }
65
55
  };
66
56
 
67
57
  describe('ParameterSelection', () =>
@@ -6,22 +6,21 @@ import {
6
6
  editState,
7
7
  initParameterSelectionPayload,
8
8
  addParameterPayload,
9
+ lockParameterPayload,
9
10
  deleteParameterPayload,
10
11
  activateEditParameterPayload,
11
12
  confirmEditParameterPayload,
12
13
  cancelEditParameterPayload,
13
14
  changeEditParameterPayload,
14
15
  sortParameterPayload,
15
- loadForemanDataRequestPayload,
16
- loadForemanDataSuccessPayload,
17
- loadForemanDataFailurePayload,
18
- loadParameterSelectionRequestPayload,
19
- loadParameterSelectionSuccessPayload,
20
- loadParameterSelectionFailurePayload,
16
+ loadParamDataRequestPayload,
17
+ loadParamDataSuccessPayload,
18
+ loadParamDataFailurePayload,
21
19
  } from '../__fixtures__/parameterSelectionReducer.fixtures';
22
20
 
23
21
  import {
24
22
  PARAMETER_SELECTION_INIT,
23
+ PARAMETER_SELECTION_LOCK,
25
24
  PARAMETER_SELECTION_DELETE,
26
25
  PARAMETER_SELECTION_ADD,
27
26
  PARAMETER_SELECTION_EDIT_ACTIVATE,
@@ -29,9 +28,11 @@ import {
29
28
  PARAMETER_SELECTION_EDIT_CHANGE,
30
29
  PARAMETER_SELECTION_EDIT_CANCEL,
31
30
  PARAMETER_SELECTION_SORT,
32
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_REQUEST,
33
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_SUCCESS,
34
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_FAILURE,
31
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
32
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
33
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
34
+ PARAMETER_SELECTION_COMPLEX_DATA_MODAL_OPEN,
35
+ PARAMETER_SELECTION_COMPLEX_DATA_MODAL_CLOSE,
35
36
  } from '../ParameterSelectionConstants';
36
37
 
37
38
  const fixtures = {
@@ -57,6 +58,13 @@ const fixtures = {
57
58
  payload: addParameterPayload,
58
59
  },
59
60
  },
61
+ 'should lock a parameter': {
62
+ state: successState,
63
+ action: {
64
+ type: PARAMETER_SELECTION_LOCK,
65
+ payload: lockParameterPayload,
66
+ },
67
+ },
60
68
  'should delete a parameter': {
61
69
  state: successState,
62
70
  action: {
@@ -71,6 +79,13 @@ const fixtures = {
71
79
  payload: activateEditParameterPayload,
72
80
  },
73
81
  },
82
+ 'should change edit parameter': {
83
+ state: editState,
84
+ action: {
85
+ type: PARAMETER_SELECTION_EDIT_CHANGE,
86
+ payload: changeEditParameterPayload,
87
+ },
88
+ },
74
89
  'should confirm edit parameter': {
75
90
  state: editState,
76
91
  action: {
@@ -85,13 +100,6 @@ const fixtures = {
85
100
  payload: cancelEditParameterPayload,
86
101
  },
87
102
  },
88
- 'should change edit parameter': {
89
- state: editState,
90
- action: {
91
- type: PARAMETER_SELECTION_EDIT_CHANGE,
92
- payload: changeEditParameterPayload,
93
- },
94
- },
95
103
  'should sort parameter': {
96
104
  state: successState,
97
105
  action: {
@@ -99,25 +107,25 @@ const fixtures = {
99
107
  payload: sortParameterPayload,
100
108
  },
101
109
  },
102
- 'should request load foreman data': {
110
+ 'should request load param data': {
103
111
  state: successState,
104
112
  action: {
105
- type: PARAMETER_SELECTION_LOAD_FOREMAN_DATA_REQUEST,
106
- payload: loadForemanDataRequestPayload,
113
+ type: PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
114
+ payload: loadParamDataRequestPayload,
107
115
  },
108
116
  },
109
- 'should load foreman data be successful': {
117
+ 'should load param data be successful': {
110
118
  state: successState,
111
119
  action: {
112
- type: PARAMETER_SELECTION_LOAD_FOREMAN_DATA_SUCCESS,
113
- payload: loadForemanDataSuccessPayload,
120
+ type: PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
121
+ payload: loadParamDataSuccessPayload,
114
122
  },
115
123
  },
116
- 'should load foreman data be erroneous': {
124
+ 'should load param data be erroneous': {
117
125
  state: successState,
118
126
  action: {
119
- type: PARAMETER_SELECTION_LOAD_FOREMAN_DATA_FAILURE,
120
- payload: loadForemanDataFailurePayload,
127
+ type: PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
128
+ payload: loadParamDataFailurePayload,
121
129
  },
122
130
  },
123
131
  };
@@ -3,13 +3,15 @@ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
3
3
  import {
4
4
  selectLoading,
5
5
  selectEditMode,
6
- selectForemanData,
6
+ selectParamData,
7
+ selectAllowedParameterTypes,
7
8
  selectParameterTypes,
8
9
  selectParameters,
9
10
  selectSortingColumns,
10
11
  selectColumns,
11
- selectServiceDefinition,
12
+ selectParamDefinition,
12
13
  selectHostgroupId,
14
+ selectEditParamsRowIndex,
13
15
  } from '../ParameterSelectionSelectors';
14
16
 
15
17
  import {
@@ -27,8 +29,10 @@ const fixtures = {
27
29
  selectLoading(stateFactory(parameterSelectionData_1)),
28
30
  'should return editMode from parameterSelectionData_1 fixtures': () =>
29
31
  selectEditMode(stateFactory(parameterSelectionData_1)),
30
- 'should return foremanData from parameterSelectionData_1 fixtures': () =>
31
- selectForemanData(stateFactory(parameterSelectionData_1)),
32
+ 'should return paramData from parameterSelectionData_1 fixtures': () =>
33
+ selectParamData(stateFactory(parameterSelectionData_1)),
34
+ 'should return allowedParameterTypes from parameterSelectionData_1 fixtures': () =>
35
+ selectAllowedParameterTypes(stateFactory(parameterSelectionData_1)),
32
36
  'should return parameterTypes from parameterSelectionData_1 fixtures': () =>
33
37
  selectParameterTypes(stateFactory(parameterSelectionData_1)),
34
38
  'should return parameters from parameterSelectionData_1 fixtures': () =>
@@ -37,10 +41,12 @@ const fixtures = {
37
41
  selectSortingColumns(stateFactory(parameterSelectionData_1)),
38
42
  'should return columns from parameterSelectionData_1 fixtures': () =>
39
43
  selectColumns(stateFactory(parameterSelectionData_1)),
40
- 'should return serviceDefinition from parameterSelectionData_1 fixtures': () =>
41
- selectServiceDefinition(stateFactory(parameterSelectionData_1)),
44
+ 'should return ParamDefinition from parameterSelectionData_1 fixtures': () =>
45
+ selectParamDefinition(stateFactory(parameterSelectionData_1)),
42
46
  'should return hostgroupId from parameterSelectionData_1 fixtures': () =>
43
47
  selectHostgroupId(stateFactory(parameterSelectionData_1)),
48
+ 'should return editParamsRowIndex from parameterSelectionData_1 fixtures': () =>
49
+ selectEditParamsRowIndex(stateFactory(parameterSelectionData_1)),
44
50
  };
45
51
 
46
52
  describe('ParameterSelectionSelectors', () =>