foreman_acd 0.9.7 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -19
- data/app/controllers/ui_acd_controller.rb +1 -1
- data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +1 -1
- data/lib/foreman_acd/engine.rb +4 -10
- data/lib/foreman_acd/plugin.rb +1 -1
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +5 -3
- data/test/controllers/ui_acd_controller_test.rb +1 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +210 -121
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +79 -91
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +30 -15
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +15 -15
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +96 -63
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +22 -11
- data/webpack/components/ApplicationDefinition/__fixtures__/{applicationDefinitionConfData_1.fixtures.js → applicationDefinitionConfData1.fixtures.js} +77 -105
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +49 -29
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +4 -4
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionHelper.test.js +16 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +0 -5
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +25 -25
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +9 -1
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +11 -11
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +30 -25
- data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +3 -3
- data/webpack/components/ApplicationDefinition/index.js +0 -1
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +91 -105
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +59 -84
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +12 -6
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +21 -27
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +14 -7
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/{applicationDefinitionImportConfData_1.fixtures.js → applicationDefinitionImportConfData1.fixtures.js} +32 -40
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +14 -16
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +38 -8
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +0 -2
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +9 -9
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +116 -2
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +3 -3
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +344 -193
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +92 -105
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +34 -17
- data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +4 -7
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -74
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +18 -9
- data/webpack/components/ApplicationInstance/__fixtures__/{applicationInstanceConfData_1.fixtures.js → applicationInstanceConfData1.fixtures.js} +68 -86
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +24 -32
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +75 -10
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +0 -8
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +27 -27
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +606 -2
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +12 -12
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +32 -25
- data/webpack/components/ApplicationInstance/components/Service.js +7 -18
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +25 -18
- data/webpack/components/ApplicationInstance/index.js +0 -1
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +167 -110
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +20 -25
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +10 -5
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +9 -12
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +12 -6
- data/webpack/components/ApplicationInstanceReport/__fixtures__/{applicationInstanceReportData_1.fixtures.js → applicationInstanceReportData1.fixtures.js} +154 -101
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +3 -10
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +28 -22
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +5 -7
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +0 -1
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +2 -2
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +9 -5
- data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +1 -3
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +35 -56
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +21 -28
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +6 -3
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +16 -19
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -4
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData1.fixtures.js +187 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +13 -24
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +3 -2
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +11 -14
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +5 -5
- data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +31 -25
- data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +3 -9
- data/webpack/components/ParameterSelection/ParameterSelection.js +258 -174
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +110 -100
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +22 -11
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +13 -11
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +63 -49
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +10 -5
- data/webpack/components/ParameterSelection/__fixtures__/{parameterSelectionData_1.fixtures.js → parameterSelectionData1.fixtures.js} +67 -104
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +22 -26
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +50 -36
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionHelper.test.js +76 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +0 -2
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +23 -25
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +100 -0
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +99 -112
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +18 -19
- data/webpack/components/ParameterSelection/index.js +1 -4
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +124 -117
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +64 -74
- data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +17 -17
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData1.fixtures.js +7 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +10 -18
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +80 -6
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +9 -11
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +192 -1
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +4 -4
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +26 -21
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +29 -24
- data/webpack/components/SyncGitRepo/index.js +2 -5
- data/webpack/components/common/AddTableEntry.js +3 -10
- data/webpack/components/common/DeleteTableEntry.js +7 -15
- data/webpack/components/common/EditTableEntry.js +7 -7
- data/webpack/components/common/ExtSelect.js +12 -8
- data/webpack/components/common/ExtTextInput.js +12 -7
- data/webpack/components/common/LockTableEntry.js +6 -6
- data/webpack/components/common/RailsData.js +6 -16
- data/webpack/components/common/__tests__/ExtSelect.test.js +2 -2
- data/webpack/components/common/__tests__/RailsData.test.js +0 -2
- data/webpack/global_test_setup.js +11 -0
- data/webpack/helper.js +10 -21
- data/webpack/helper.test.js +17 -29
- data/webpack/index.js +25 -7
- data/webpack/js-yaml.js +1563 -1135
- data/webpack/reducer.js +52 -27
- metadata +16 -14
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +0 -191
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +0 -153
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +0 -7
@@ -1,9 +1,9 @@
|
|
1
|
-
export const
|
1
|
+
export const applicationInstanceConfData1 = {
|
2
2
|
name: false,
|
3
3
|
error: {
|
4
4
|
errorMsg: '',
|
5
5
|
status: '',
|
6
|
-
statusText: ''
|
6
|
+
statusText: '',
|
7
7
|
},
|
8
8
|
loading: false,
|
9
9
|
columns: [
|
@@ -11,97 +11,79 @@ export const applicationInstanceConfData_1 = {
|
|
11
11
|
property: 'hostname',
|
12
12
|
header: {
|
13
13
|
label: 'Hostname',
|
14
|
-
formatters: [
|
15
|
-
null
|
16
|
-
],
|
14
|
+
formatters: [null],
|
17
15
|
props: {
|
18
16
|
index: 0,
|
19
17
|
style: {
|
20
|
-
width: '30%'
|
21
|
-
}
|
22
|
-
}
|
18
|
+
width: '30%',
|
19
|
+
},
|
20
|
+
},
|
23
21
|
},
|
24
22
|
cell: {
|
25
|
-
formatters: [
|
26
|
-
|
27
|
-
]
|
28
|
-
}
|
23
|
+
formatters: [null],
|
24
|
+
},
|
29
25
|
},
|
30
26
|
{
|
31
27
|
property: 'description',
|
32
28
|
header: {
|
33
29
|
label: 'Description',
|
34
|
-
formatters: [
|
35
|
-
null
|
36
|
-
],
|
30
|
+
formatters: [null],
|
37
31
|
props: {
|
38
32
|
index: 1,
|
39
33
|
style: {
|
40
|
-
width: '30%'
|
41
|
-
}
|
42
|
-
}
|
34
|
+
width: '30%',
|
35
|
+
},
|
36
|
+
},
|
43
37
|
},
|
44
38
|
cell: {
|
45
|
-
formatters: [
|
46
|
-
|
47
|
-
]
|
48
|
-
}
|
39
|
+
formatters: [null],
|
40
|
+
},
|
49
41
|
},
|
50
42
|
{
|
51
43
|
property: 'service',
|
52
44
|
header: {
|
53
45
|
label: 'Service',
|
54
|
-
formatters: [
|
55
|
-
null
|
56
|
-
],
|
46
|
+
formatters: [null],
|
57
47
|
props: {
|
58
48
|
index: 2,
|
59
49
|
style: {
|
60
|
-
width: '20%'
|
61
|
-
}
|
62
|
-
}
|
50
|
+
width: '20%',
|
51
|
+
},
|
52
|
+
},
|
63
53
|
},
|
64
54
|
cell: {
|
65
|
-
formatters: [
|
66
|
-
|
67
|
-
]
|
68
|
-
}
|
55
|
+
formatters: [null],
|
56
|
+
},
|
69
57
|
},
|
70
58
|
{
|
71
59
|
property: 'actions',
|
72
60
|
header: {
|
73
61
|
label: 'Actions',
|
74
|
-
formatters: [
|
75
|
-
null
|
76
|
-
],
|
62
|
+
formatters: [null],
|
77
63
|
props: {
|
78
64
|
index: 4,
|
79
65
|
style: {
|
80
|
-
width: '20%'
|
81
|
-
}
|
82
|
-
}
|
66
|
+
width: '20%',
|
67
|
+
},
|
68
|
+
},
|
83
69
|
},
|
84
70
|
cell: {
|
85
|
-
formatters: [
|
86
|
-
|
87
|
-
|
88
|
-
}
|
89
|
-
}
|
71
|
+
formatters: [null],
|
72
|
+
},
|
73
|
+
},
|
90
74
|
],
|
91
75
|
appDefinition: {
|
92
76
|
id: 1,
|
93
77
|
name: 'LAMP',
|
94
78
|
description: '',
|
95
|
-
services:
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
],
|
100
|
-
organization_ids: [
|
101
|
-
1
|
102
|
-
],
|
79
|
+
services:
|
80
|
+
'[{"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"}]}]',
|
81
|
+
ansible_vars_all:
|
82
|
+
'[{"id":0,"name":"repository","value":"https://github.com/bennojoy/mywebapp.git"}]',
|
83
|
+
location_ids: [2],
|
84
|
+
organization_ids: [1],
|
103
85
|
created_at: '2021-03-11 12:51:34 +0100',
|
104
|
-
updated_at: '2021-03-13 00:06:12 +0100'
|
86
|
+
updated_at: '2021-03-13 00:06:12 +0100',
|
105
87
|
},
|
106
88
|
hosts: [
|
107
89
|
{
|
@@ -114,34 +96,34 @@ export const applicationInstanceConfData_1 = {
|
|
114
96
|
{
|
115
97
|
id: 0,
|
116
98
|
name: 'mysqlservice',
|
117
|
-
value: 'mysqld'
|
99
|
+
value: 'mysqld',
|
118
100
|
},
|
119
101
|
{
|
120
102
|
id: 1,
|
121
103
|
name: 'mysql_port',
|
122
|
-
value: '3306'
|
104
|
+
value: '3306',
|
123
105
|
},
|
124
106
|
{
|
125
107
|
id: 2,
|
126
108
|
name: 'dbuser',
|
127
|
-
value: 'webapp'
|
109
|
+
value: 'webapp',
|
128
110
|
},
|
129
111
|
{
|
130
112
|
id: 3,
|
131
113
|
name: 'dbname',
|
132
|
-
value: 'ANSAP01'
|
114
|
+
value: 'ANSAP01',
|
133
115
|
},
|
134
116
|
{
|
135
117
|
id: 4,
|
136
118
|
name: 'upassword',
|
137
|
-
value: 'Bond@007'
|
119
|
+
value: 'Bond@007',
|
138
120
|
},
|
139
121
|
{
|
140
122
|
id: 5,
|
141
123
|
name: 'masterpassword',
|
142
|
-
value: 'MySQL@007'
|
143
|
-
}
|
144
|
-
]
|
124
|
+
value: 'MySQL@007',
|
125
|
+
},
|
126
|
+
],
|
145
127
|
},
|
146
128
|
{
|
147
129
|
id: 1,
|
@@ -153,9 +135,9 @@ export const applicationInstanceConfData_1 = {
|
|
153
135
|
{
|
154
136
|
id: 0,
|
155
137
|
name: 'dummy_var',
|
156
|
-
value: '0'
|
157
|
-
}
|
158
|
-
]
|
138
|
+
value: '0',
|
139
|
+
},
|
140
|
+
],
|
159
141
|
},
|
160
142
|
{
|
161
143
|
id: 2,
|
@@ -167,17 +149,17 @@ export const applicationInstanceConfData_1 = {
|
|
167
149
|
{
|
168
150
|
id: 0,
|
169
151
|
name: 'dummy_var',
|
170
|
-
value: '0'
|
171
|
-
}
|
172
|
-
]
|
173
|
-
}
|
152
|
+
value: '0',
|
153
|
+
},
|
154
|
+
],
|
155
|
+
},
|
174
156
|
],
|
175
157
|
ansibleVarsAll: [
|
176
158
|
{
|
177
159
|
id: 0,
|
178
160
|
name: 'repository',
|
179
|
-
value: 'https://github.com/bennojoy/mywebapp.git'
|
180
|
-
}
|
161
|
+
value: 'https://github.com/bennojoy/mywebapp.git',
|
162
|
+
},
|
181
163
|
],
|
182
164
|
services: [
|
183
165
|
{
|
@@ -195,7 +177,7 @@ export const applicationInstanceConfData_1 = {
|
|
195
177
|
name: 'CP',
|
196
178
|
description: '',
|
197
179
|
type: 'computeprofile',
|
198
|
-
value: '1'
|
180
|
+
value: '1',
|
199
181
|
},
|
200
182
|
{
|
201
183
|
id: 2,
|
@@ -203,17 +185,17 @@ export const applicationInstanceConfData_1 = {
|
|
203
185
|
name: 'LE',
|
204
186
|
description: '',
|
205
187
|
type: 'lifecycleenv',
|
206
|
-
value: '1'
|
207
|
-
}
|
188
|
+
value: '1',
|
189
|
+
},
|
208
190
|
],
|
209
191
|
ansibleParameters: [
|
210
192
|
{
|
211
193
|
id: 0,
|
212
194
|
name: 'dummy_var',
|
213
|
-
value: '0'
|
214
|
-
}
|
195
|
+
value: '0',
|
196
|
+
},
|
215
197
|
],
|
216
|
-
currentCount: 2
|
198
|
+
currentCount: 2,
|
217
199
|
},
|
218
200
|
{
|
219
201
|
id: 2,
|
@@ -228,36 +210,36 @@ export const applicationInstanceConfData_1 = {
|
|
228
210
|
{
|
229
211
|
id: 0,
|
230
212
|
name: 'mysqlservice',
|
231
|
-
value: 'mysqld'
|
213
|
+
value: 'mysqld',
|
232
214
|
},
|
233
215
|
{
|
234
216
|
id: 1,
|
235
217
|
name: 'mysql_port',
|
236
218
|
value: '3306',
|
237
|
-
locked: true
|
219
|
+
locked: true,
|
238
220
|
},
|
239
221
|
{
|
240
222
|
id: 2,
|
241
223
|
name: 'dbuser',
|
242
|
-
value: 'webapp'
|
224
|
+
value: 'webapp',
|
243
225
|
},
|
244
226
|
{
|
245
227
|
id: 3,
|
246
228
|
name: 'dbname',
|
247
|
-
value: 'ANSAP01'
|
229
|
+
value: 'ANSAP01',
|
248
230
|
},
|
249
231
|
{
|
250
232
|
id: 4,
|
251
233
|
name: 'upassword',
|
252
|
-
value: 'Bond@007'
|
234
|
+
value: 'Bond@007',
|
253
235
|
},
|
254
236
|
{
|
255
237
|
id: 5,
|
256
238
|
name: 'masterpassword',
|
257
|
-
value: 'MySQL@007'
|
258
|
-
}
|
239
|
+
value: 'MySQL@007',
|
240
|
+
},
|
259
241
|
],
|
260
|
-
currentCount: 1
|
261
|
-
}
|
262
|
-
]
|
263
|
-
}
|
242
|
+
currentCount: 1,
|
243
|
+
},
|
244
|
+
],
|
245
|
+
};
|
data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js
CHANGED
@@ -1,28 +1,22 @@
|
|
1
1
|
import Immutable from 'seamless-immutable';
|
2
|
-
import {
|
3
|
-
cloneDeep,
|
4
|
-
findIndex,
|
5
|
-
findLastIndex,
|
6
|
-
} from 'lodash';
|
2
|
+
import { cloneDeep, findIndex } from 'lodash';
|
7
3
|
|
8
|
-
import {
|
9
|
-
applicationInstanceConfData_1,
|
10
|
-
} from '../__fixtures__/applicationInstanceConfData_1.fixtures';
|
4
|
+
import { applicationInstanceConfData1 } from '../__fixtures__/applicationInstanceConfData1.fixtures';
|
11
5
|
|
12
|
-
export const successState = Immutable(
|
6
|
+
export const successState = Immutable(applicationInstanceConfData1);
|
13
7
|
|
14
8
|
const EDIT_ROW_ID = 2;
|
15
9
|
|
16
|
-
const editClone =
|
17
|
-
const editIndex = findIndex(editClone.hosts, { id: EDIT_ROW_ID })
|
18
|
-
editClone
|
10
|
+
const editClone = applicationInstanceConfData1;
|
11
|
+
const editIndex = findIndex(editClone.hosts, { id: EDIT_ROW_ID });
|
12
|
+
editClone.hosts[editIndex].backup = cloneDeep(editClone.hosts[editIndex]);
|
19
13
|
export const editState = Immutable(editClone);
|
20
14
|
|
21
15
|
// Payload Data
|
22
|
-
export const initApplicationInstancePayload =
|
16
|
+
export const initApplicationInstancePayload = applicationInstanceConfData1;
|
23
17
|
|
24
|
-
export const closeAlertModalPayload = {
|
25
|
-
export const addHostPayload = {
|
18
|
+
export const closeAlertModalPayload = {};
|
19
|
+
export const addHostPayload = {};
|
26
20
|
export const deleteHostPayload = {
|
27
21
|
rowData: {
|
28
22
|
id: EDIT_ROW_ID,
|
@@ -44,11 +38,11 @@ export const cancelEditHostPayload = {
|
|
44
38
|
},
|
45
39
|
};
|
46
40
|
export const changeEditHostPayload = {
|
47
|
-
value:
|
48
|
-
property:
|
41
|
+
value: 'helloworld',
|
42
|
+
property: 'name',
|
49
43
|
rowData: {
|
50
44
|
id: EDIT_ROW_ID,
|
51
|
-
}
|
45
|
+
},
|
52
46
|
};
|
53
47
|
|
54
48
|
export const loadApplicationDefinitionRequestPayload = {
|
@@ -58,23 +52,21 @@ export const loadApplicationDefinitionRequestPayload = {
|
|
58
52
|
export const loadApplicationDefinitionSuccessPayload = {
|
59
53
|
app_definition: {
|
60
54
|
id: 1,
|
61
|
-
name:
|
62
|
-
description:
|
63
|
-
services:
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
],
|
68
|
-
organization_ids: [
|
69
|
-
|
70
|
-
|
71
|
-
created_at: "2021-03-11 12:51:34 +0100",
|
72
|
-
updated_at: "2021-03-13 00:06:12 +0100"
|
55
|
+
name: 'LAMP',
|
56
|
+
description: '',
|
57
|
+
services:
|
58
|
+
'[{"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"}]}]',
|
59
|
+
ansible_vars_all:
|
60
|
+
'[{"id":0,"name":"repository","value":"https://github.com/bennojoy/mywebapp.git"}]',
|
61
|
+
location_ids: [2],
|
62
|
+
organization_ids: [1],
|
63
|
+
created_at: '2021-03-11 12:51:34 +0100',
|
64
|
+
updated_at: '2021-03-13 00:06:12 +0100',
|
73
65
|
},
|
74
66
|
foreman_data: null,
|
75
|
-
ansible_data: null
|
67
|
+
ansible_data: null,
|
76
68
|
};
|
77
69
|
|
78
70
|
export const loadApplicationDefinitionFailurePayload = {
|
79
|
-
error:
|
71
|
+
error: 'Something really bad happend',
|
80
72
|
};
|
@@ -4,19 +4,84 @@ import ApplicationInstance from '../ApplicationInstance';
|
|
4
4
|
|
5
5
|
const noop = () => {};
|
6
6
|
|
7
|
+
const baseFixtures = {
|
8
|
+
data: {
|
9
|
+
mode: '',
|
10
|
+
location: 'Default Location',
|
11
|
+
organization: 'Default Organization',
|
12
|
+
appDefinition: {},
|
13
|
+
hosts: [],
|
14
|
+
ansibleVarsAll: [],
|
15
|
+
},
|
16
|
+
activateEditApplicationInstanceHost: noop,
|
17
|
+
addApplicationInstanceHost: noop,
|
18
|
+
cancelEditApplicationInstanceHost: noop,
|
19
|
+
changeEditApplicationInstanceHost: noop,
|
20
|
+
changeParameterSelectionMode: noop,
|
21
|
+
closeAddExistingHostsModal: noop,
|
22
|
+
closeAlertModal: noop,
|
23
|
+
closeAnsibleParameterSelectionModal: noop,
|
24
|
+
closeForemanParameterSelectionModal: noop,
|
25
|
+
confirmEditApplicationInstanceHost: noop,
|
26
|
+
deleteApplicationInstanceHost: noop,
|
27
|
+
initApplicationInstance: noop,
|
28
|
+
loadApplicationDefinition: noop,
|
29
|
+
openForemanParameterSelectionModal: noop,
|
30
|
+
openAnsibleParameterSelectionModal: noop,
|
31
|
+
openAddExistingHostsModal: noop,
|
32
|
+
};
|
33
|
+
|
7
34
|
const fixtures = {
|
8
|
-
'should render
|
35
|
+
'should render without optional-values': baseFixtures,
|
36
|
+
'should render newInstance': {
|
37
|
+
...baseFixtures,
|
38
|
+
data: {
|
39
|
+
...baseFixtures.data,
|
40
|
+
mode: 'newInstance',
|
41
|
+
applications: {
|
42
|
+
'1': 'dummy-definition',
|
43
|
+
'2': 'test-definition',
|
44
|
+
},
|
45
|
+
supportedPlugins: {
|
46
|
+
puppet: false,
|
47
|
+
katello: true,
|
48
|
+
},
|
49
|
+
},
|
50
|
+
},
|
51
|
+
'should render editInstance': {
|
52
|
+
...baseFixtures,
|
9
53
|
data: {
|
10
|
-
|
11
|
-
|
12
|
-
appDefinition: {
|
13
|
-
|
14
|
-
|
54
|
+
...baseFixtures.data,
|
55
|
+
mode: 'editInstance',
|
56
|
+
appDefinition: {
|
57
|
+
id: 2,
|
58
|
+
name: 'test-definition',
|
59
|
+
},
|
60
|
+
hosts: [
|
61
|
+
{
|
62
|
+
id: 1,
|
63
|
+
hostname: 'grafana-host',
|
64
|
+
service: '1',
|
65
|
+
description: '',
|
66
|
+
isExistingHost: false,
|
67
|
+
foremanParameters: [],
|
68
|
+
ansibleParameters: [],
|
69
|
+
},
|
70
|
+
{
|
71
|
+
id: 2,
|
72
|
+
hostname: 'prometheus-host',
|
73
|
+
service: '2',
|
74
|
+
description: '',
|
75
|
+
isExistingHost: false,
|
76
|
+
foremanParameters: [],
|
77
|
+
ansibleParameters: [],
|
78
|
+
},
|
79
|
+
],
|
80
|
+
supportedPlugins: {
|
81
|
+
puppet: false,
|
82
|
+
katello: true,
|
83
|
+
},
|
15
84
|
},
|
16
|
-
closeAlertModal: noop,
|
17
|
-
loadApplicationDefinition: noop,
|
18
|
-
initApplicationInstance: noop,
|
19
|
-
addApplicationInstanceHost: noop,
|
20
85
|
},
|
21
86
|
};
|
22
87
|
|
@@ -29,14 +29,6 @@ import {
|
|
29
29
|
APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
|
30
30
|
APPLICATION_INSTANCE_HOST_EDIT_CHANGE,
|
31
31
|
APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
|
32
|
-
APPLICATION_INSTANCE_HOST_EDIT_ERROR,
|
33
|
-
APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
|
34
|
-
APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
|
35
|
-
APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
|
36
|
-
APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
|
37
|
-
APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN,
|
38
|
-
APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE,
|
39
|
-
APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
|
40
32
|
} from '../ApplicationInstanceConstants';
|
41
33
|
|
42
34
|
const fixtures = {
|
@@ -15,9 +15,7 @@ import {
|
|
15
15
|
selectParamEditMode,
|
16
16
|
} from '../ApplicationInstanceSelectors';
|
17
17
|
|
18
|
-
import {
|
19
|
-
applicationInstanceConfData_1,
|
20
|
-
} from '../__fixtures__/applicationInstanceConfData_1.fixtures';
|
18
|
+
import { applicationInstanceConfData1 } from '../__fixtures__/applicationInstanceConfData1.fixtures';
|
21
19
|
|
22
20
|
const stateFactory = obj => ({
|
23
21
|
foremanAcd: {
|
@@ -26,30 +24,32 @@ const stateFactory = obj => ({
|
|
26
24
|
});
|
27
25
|
|
28
26
|
const fixtures = {
|
29
|
-
'should return showAlertModal from
|
30
|
-
selectShowAlertModal(stateFactory(
|
31
|
-
'should return alertModalText from
|
32
|
-
selectAlertModalText(stateFactory(
|
33
|
-
'should return alertModalTitle from
|
34
|
-
selectAlertModalTitle(stateFactory(
|
35
|
-
'should return editMode from
|
36
|
-
selectEditMode(stateFactory(
|
37
|
-
'should return appDefinition from
|
38
|
-
selectAppDefinition(stateFactory(
|
39
|
-
'should return hosts from
|
40
|
-
selectHosts(stateFactory(
|
41
|
-
'should return columns from
|
42
|
-
selectColumns(stateFactory(
|
43
|
-
'should return hiddenForemanParameterTypes from
|
44
|
-
selectHiddenForemanParameterTypes(
|
45
|
-
|
46
|
-
|
47
|
-
'should return
|
48
|
-
|
49
|
-
'should return
|
50
|
-
|
51
|
-
'should return
|
52
|
-
|
27
|
+
'should return showAlertModal from applicationInstanceConfData1 fixtures': () =>
|
28
|
+
selectShowAlertModal(stateFactory(applicationInstanceConfData1)),
|
29
|
+
'should return alertModalText from applicationInstanceConfData1 fixtures': () =>
|
30
|
+
selectAlertModalText(stateFactory(applicationInstanceConfData1)),
|
31
|
+
'should return alertModalTitle from applicationInstanceConfData1 fixtures': () =>
|
32
|
+
selectAlertModalTitle(stateFactory(applicationInstanceConfData1)),
|
33
|
+
'should return editMode from applicationInstanceConfData1 fixtures': () =>
|
34
|
+
selectEditMode(stateFactory(applicationInstanceConfData1)),
|
35
|
+
'should return appDefinition from applicationInstanceConfData1 fixtures': () =>
|
36
|
+
selectAppDefinition(stateFactory(applicationInstanceConfData1)),
|
37
|
+
'should return hosts from applicationInstanceConfData1 fixtures': () =>
|
38
|
+
selectHosts(stateFactory(applicationInstanceConfData1)),
|
39
|
+
'should return columns from applicationInstanceConfData1 fixtures': () =>
|
40
|
+
selectColumns(stateFactory(applicationInstanceConfData1)),
|
41
|
+
'should return hiddenForemanParameterTypes from applicationInstanceConfData1 fixtures': () =>
|
42
|
+
selectHiddenForemanParameterTypes(
|
43
|
+
stateFactory(applicationInstanceConfData1)
|
44
|
+
),
|
45
|
+
'should return services from applicationInstanceConfData1 fixtures': () =>
|
46
|
+
selectServices(stateFactory(applicationInstanceConfData1)),
|
47
|
+
'should return parametersData from applicationInstanceConfData1 fixtures': () =>
|
48
|
+
selectParametersData(stateFactory(applicationInstanceConfData1)),
|
49
|
+
'should return ansibleVarsAll from applicationInstanceConfData1 fixtures': () =>
|
50
|
+
selectAnsibleVarsAll(stateFactory(applicationInstanceConfData1)),
|
51
|
+
'should return ParamEditMode from applicationInstanceConfData1 fixtures': () =>
|
52
|
+
selectParamEditMode(stateFactory(applicationInstanceConfData1)),
|
53
53
|
};
|
54
54
|
|
55
55
|
describe('ApplicationInstanceSelectors', () =>
|