foreman_acd 0.9.7 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +5 -3
- 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 +13 -11
- 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
@@ -3,11 +3,16 @@ const parameterState = state => state.foremanAcd.parameterSelectionParameters;
|
|
3
3
|
export const selectLoading = state => parameterState(state).loading;
|
4
4
|
export const selectEditMode = state => parameterState(state).editMode;
|
5
5
|
export const selectParamData = state => parameterState(state).paramData;
|
6
|
-
export const selectAllowedParameterTypes = state =>
|
7
|
-
|
6
|
+
export const selectAllowedParameterTypes = state =>
|
7
|
+
parameterState(state).allowedParameterTypes;
|
8
|
+
export const selectParameterTypes = state =>
|
9
|
+
parameterState(state).parameterTypes;
|
8
10
|
export const selectParameters = state => parameterState(state).parameters;
|
9
|
-
export const selectSortingColumns = state =>
|
11
|
+
export const selectSortingColumns = state =>
|
12
|
+
parameterState(state).sortingColumns;
|
10
13
|
export const selectColumns = state => parameterState(state).columns;
|
11
|
-
export const selectParamDefinition = state =>
|
14
|
+
export const selectParamDefinition = state =>
|
15
|
+
parameterState(state).paramDefinition;
|
12
16
|
export const selectHostgroupId = state => parameterState(state).hostgroupId;
|
13
|
-
export const selectEditParamsRowIndex = state =>
|
17
|
+
export const selectEditParamsRowIndex = state =>
|
18
|
+
parameterState(state).editParamsRowIndex;
|
@@ -1,68 +1,68 @@
|
|
1
|
-
export const
|
1
|
+
export const parameterSelectionData1 = {
|
2
2
|
editMode: false,
|
3
3
|
error: {
|
4
4
|
errorMsg: '',
|
5
5
|
status: '',
|
6
|
-
statusText: ''
|
6
|
+
statusText: '',
|
7
7
|
},
|
8
8
|
paramData: {
|
9
9
|
hostgroup_id: 1,
|
10
10
|
environments: [
|
11
11
|
{
|
12
12
|
id: 1,
|
13
|
-
name: 'production'
|
14
|
-
}
|
13
|
+
name: 'production',
|
14
|
+
},
|
15
15
|
],
|
16
16
|
lifecycle_environments: [
|
17
17
|
{
|
18
18
|
id: 1,
|
19
|
-
name: 'Library'
|
20
|
-
}
|
19
|
+
name: 'Library',
|
20
|
+
},
|
21
21
|
],
|
22
22
|
domains: [
|
23
23
|
{
|
24
24
|
id: 1,
|
25
|
-
name: 'deploy3.dev.atix'
|
26
|
-
}
|
25
|
+
name: 'deploy3.dev.atix',
|
26
|
+
},
|
27
27
|
],
|
28
28
|
computeprofiles: [
|
29
29
|
{
|
30
30
|
id: 1,
|
31
|
-
name: '1-Small'
|
31
|
+
name: '1-Small',
|
32
32
|
},
|
33
33
|
{
|
34
34
|
id: 2,
|
35
|
-
name: '2-Medium'
|
35
|
+
name: '2-Medium',
|
36
36
|
},
|
37
37
|
{
|
38
38
|
id: 3,
|
39
|
-
name: '3-Large'
|
39
|
+
name: '3-Large',
|
40
40
|
},
|
41
41
|
{
|
42
42
|
id: 4,
|
43
|
-
name: 'Orchahosts-VM'
|
44
|
-
}
|
43
|
+
name: 'Orchahosts-VM',
|
44
|
+
},
|
45
45
|
],
|
46
46
|
ptables: [
|
47
47
|
{
|
48
48
|
id: 125,
|
49
|
-
name: 'Kickstart default'
|
50
|
-
}
|
49
|
+
name: 'Kickstart default',
|
50
|
+
},
|
51
51
|
],
|
52
|
-
dataType: 'PARAMETER_SELECTION_PARAM_TYPE_FOREMAN'
|
52
|
+
dataType: 'PARAMETER_SELECTION_PARAM_TYPE_FOREMAN',
|
53
53
|
},
|
54
54
|
hostgroupId: 1,
|
55
55
|
loading: false,
|
56
56
|
sortingColumns: {
|
57
57
|
name: {
|
58
58
|
direction: 'asc',
|
59
|
-
position: 0
|
60
|
-
}
|
59
|
+
position: 0,
|
60
|
+
},
|
61
61
|
},
|
62
62
|
paramDefinition: {
|
63
63
|
id: 1,
|
64
64
|
name: 'web',
|
65
|
-
dataId: '1'
|
65
|
+
dataId: '1',
|
66
66
|
},
|
67
67
|
columns: [
|
68
68
|
{
|
@@ -72,25 +72,17 @@ export const parameterSelectionData_1 = {
|
|
72
72
|
props: {
|
73
73
|
sort: true,
|
74
74
|
style: {
|
75
|
-
width: '25%'
|
75
|
+
width: '25%',
|
76
76
|
},
|
77
|
-
index: 0
|
77
|
+
index: 0,
|
78
78
|
},
|
79
|
-
transforms: [
|
80
|
-
|
81
|
-
],
|
82
|
-
formatters: [
|
83
|
-
null
|
84
|
-
],
|
85
|
-
customFormatters: [
|
86
|
-
null
|
87
|
-
]
|
79
|
+
transforms: [null],
|
80
|
+
formatters: [null],
|
81
|
+
customFormatters: [null],
|
88
82
|
},
|
89
83
|
cell: {
|
90
|
-
formatters: [
|
91
|
-
|
92
|
-
]
|
93
|
-
}
|
84
|
+
formatters: [null],
|
85
|
+
},
|
94
86
|
},
|
95
87
|
{
|
96
88
|
property: 'description',
|
@@ -99,28 +91,20 @@ export const parameterSelectionData_1 = {
|
|
99
91
|
props: {
|
100
92
|
sort: true,
|
101
93
|
style: {
|
102
|
-
width: '25%'
|
94
|
+
width: '25%',
|
103
95
|
},
|
104
|
-
index: 1
|
96
|
+
index: 1,
|
105
97
|
},
|
106
|
-
transforms: [
|
107
|
-
|
108
|
-
],
|
109
|
-
formatters: [
|
110
|
-
null
|
111
|
-
],
|
112
|
-
customFormatters: [
|
113
|
-
null
|
114
|
-
]
|
98
|
+
transforms: [null],
|
99
|
+
formatters: [null],
|
100
|
+
customFormatters: [null],
|
115
101
|
},
|
116
102
|
cell: {
|
117
103
|
props: {
|
118
|
-
index: 1
|
104
|
+
index: 1,
|
119
105
|
},
|
120
|
-
formatters: [
|
121
|
-
|
122
|
-
]
|
123
|
-
}
|
106
|
+
formatters: [null],
|
107
|
+
},
|
124
108
|
},
|
125
109
|
{
|
126
110
|
property: 'type',
|
@@ -129,25 +113,17 @@ export const parameterSelectionData_1 = {
|
|
129
113
|
props: {
|
130
114
|
sort: true,
|
131
115
|
style: {
|
132
|
-
width: '20%'
|
116
|
+
width: '20%',
|
133
117
|
},
|
134
|
-
index: 2
|
118
|
+
index: 2,
|
135
119
|
},
|
136
|
-
transforms: [
|
137
|
-
|
138
|
-
],
|
139
|
-
formatters: [
|
140
|
-
null
|
141
|
-
],
|
142
|
-
customFormatters: [
|
143
|
-
null
|
144
|
-
]
|
120
|
+
transforms: [null],
|
121
|
+
formatters: [null],
|
122
|
+
customFormatters: [null],
|
145
123
|
},
|
146
124
|
cell: {
|
147
|
-
formatters: [
|
148
|
-
|
149
|
-
]
|
150
|
-
}
|
125
|
+
formatters: [null],
|
126
|
+
},
|
151
127
|
},
|
152
128
|
{
|
153
129
|
property: 'value',
|
@@ -156,25 +132,17 @@ export const parameterSelectionData_1 = {
|
|
156
132
|
props: {
|
157
133
|
sort: true,
|
158
134
|
style: {
|
159
|
-
width: '20%'
|
135
|
+
width: '20%',
|
160
136
|
},
|
161
|
-
index: 3
|
137
|
+
index: 3,
|
162
138
|
},
|
163
|
-
transforms: [
|
164
|
-
|
165
|
-
],
|
166
|
-
formatters: [
|
167
|
-
null
|
168
|
-
],
|
169
|
-
customFormatters: [
|
170
|
-
null
|
171
|
-
]
|
139
|
+
transforms: [null],
|
140
|
+
formatters: [null],
|
141
|
+
customFormatters: [null],
|
172
142
|
},
|
173
143
|
cell: {
|
174
|
-
formatters: [
|
175
|
-
|
176
|
-
]
|
177
|
-
}
|
144
|
+
formatters: [null],
|
145
|
+
},
|
178
146
|
},
|
179
147
|
{
|
180
148
|
property: 'actions',
|
@@ -182,20 +150,16 @@ export const parameterSelectionData_1 = {
|
|
182
150
|
label: 'Actions',
|
183
151
|
props: {
|
184
152
|
style: {
|
185
|
-
width: '10%'
|
153
|
+
width: '10%',
|
186
154
|
},
|
187
|
-
index: 4
|
155
|
+
index: 4,
|
188
156
|
},
|
189
|
-
formatters: [
|
190
|
-
null
|
191
|
-
]
|
157
|
+
formatters: [null],
|
192
158
|
},
|
193
159
|
cell: {
|
194
|
-
formatters: [
|
195
|
-
|
196
|
-
|
197
|
-
}
|
198
|
-
}
|
160
|
+
formatters: [null],
|
161
|
+
},
|
162
|
+
},
|
199
163
|
],
|
200
164
|
parameters: [
|
201
165
|
{
|
@@ -204,7 +168,7 @@ export const parameterSelectionData_1 = {
|
|
204
168
|
name: 'CP',
|
205
169
|
description: '',
|
206
170
|
type: 'computeprofile',
|
207
|
-
value: '1'
|
171
|
+
value: '1',
|
208
172
|
},
|
209
173
|
{
|
210
174
|
id: 2,
|
@@ -212,23 +176,22 @@ export const parameterSelectionData_1 = {
|
|
212
176
|
name: 'LE',
|
213
177
|
description: '',
|
214
178
|
type: 'lifecycleenv',
|
215
|
-
value: '1'
|
216
|
-
}
|
217
|
-
],
|
218
|
-
allowedParameterTypes: [
|
219
|
-
'domain',
|
220
|
-
'hostparam',
|
221
|
-
'ip',
|
222
|
-
'ptable',
|
223
|
-
'puppetenv',
|
224
|
-
'password',
|
179
|
+
value: '1',
|
180
|
+
},
|
225
181
|
],
|
182
|
+
allowedParameterTypes: {
|
183
|
+
domain: 'Domain',
|
184
|
+
hostparam: 'Host parameter',
|
185
|
+
ip: 'IP',
|
186
|
+
ptable: 'Partition table',
|
187
|
+
puppetenv: 'Puppet environment',
|
188
|
+
},
|
226
189
|
parameterTypes: {
|
227
190
|
domain: 'Domain',
|
228
191
|
hostparam: 'Host parameter',
|
229
192
|
ip: 'IP',
|
230
193
|
ptable: 'Partition table',
|
231
194
|
puppetenv: 'Puppet environment',
|
232
|
-
password: 'Root password'
|
233
|
-
}
|
234
|
-
}
|
195
|
+
password: 'Root password',
|
196
|
+
},
|
197
|
+
};
|
data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js
CHANGED
@@ -1,26 +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
|
-
parameterSelectionData_1,
|
10
|
-
} from '../__fixtures__/parameterSelectionData_1.fixtures';
|
4
|
+
import { parameterSelectionData1 } from '../__fixtures__/parameterSelectionData1.fixtures';
|
11
5
|
|
12
|
-
export const successState = Immutable(
|
6
|
+
export const successState = Immutable(parameterSelectionData1);
|
13
7
|
|
14
8
|
const EDIT_ROW_ID = 2;
|
15
9
|
|
16
|
-
const editClone =
|
17
|
-
const editIndex = findIndex(editClone.parameters, { id: EDIT_ROW_ID })
|
18
|
-
editClone
|
10
|
+
const editClone = parameterSelectionData1;
|
11
|
+
const editIndex = findIndex(editClone.parameters, { id: EDIT_ROW_ID });
|
12
|
+
editClone.parameters[editIndex].backup = cloneDeep(
|
13
|
+
editClone.parameters[editIndex]
|
14
|
+
);
|
19
15
|
export const editState = Immutable(editClone);
|
20
16
|
|
21
17
|
// Payload Data
|
22
|
-
export const initParameterSelectionPayload =
|
23
|
-
export const addParameterPayload = {
|
18
|
+
export const initParameterSelectionPayload = parameterSelectionData1;
|
19
|
+
export const addParameterPayload = {};
|
24
20
|
export const lockParameterPayload = {
|
25
21
|
rowData: {
|
26
22
|
id: EDIT_ROW_ID,
|
@@ -47,14 +43,14 @@ export const cancelEditParameterPayload = {
|
|
47
43
|
},
|
48
44
|
};
|
49
45
|
export const changeEditParameterPayload = {
|
50
|
-
value:
|
51
|
-
property:
|
46
|
+
value: 'helloworld',
|
47
|
+
property: 'value',
|
52
48
|
rowData: {
|
53
49
|
id: EDIT_ROW_ID,
|
54
|
-
}
|
50
|
+
},
|
55
51
|
};
|
56
52
|
export const sortParameterPayload = {
|
57
|
-
selectedColumn:
|
53
|
+
selectedColumn: 'type',
|
58
54
|
};
|
59
55
|
|
60
56
|
export const loadParamDataRequestPayload = {
|
@@ -65,12 +61,12 @@ export const loadParamDataSuccessPayload = {
|
|
65
61
|
environments: [
|
66
62
|
{
|
67
63
|
id: 1,
|
68
|
-
name:
|
64
|
+
name: 'production',
|
69
65
|
},
|
70
66
|
{
|
71
67
|
id: 2,
|
72
|
-
name:
|
73
|
-
}
|
68
|
+
name: 'test',
|
69
|
+
},
|
74
70
|
],
|
75
71
|
lifecycle_environments: [],
|
76
72
|
domains: [],
|
@@ -78,14 +74,14 @@ export const loadParamDataSuccessPayload = {
|
|
78
74
|
ptables: [
|
79
75
|
{
|
80
76
|
id: 105,
|
81
|
-
name:
|
77
|
+
name: 'Kickstart default',
|
82
78
|
},
|
83
79
|
{
|
84
80
|
id: 104,
|
85
|
-
name:
|
86
|
-
}
|
87
|
-
]
|
81
|
+
name: 'Kickstart default thin',
|
82
|
+
},
|
83
|
+
],
|
88
84
|
};
|
89
85
|
export const loadParamDataFailurePayload = {
|
90
|
-
error:
|
86
|
+
error: 'Something really bad happend',
|
91
87
|
};
|
@@ -9,49 +9,63 @@ import {
|
|
9
9
|
|
10
10
|
const noop = () => {};
|
11
11
|
|
12
|
+
const baseFixtures = {
|
13
|
+
loading: true,
|
14
|
+
location: 'Default Location',
|
15
|
+
organization: 'Default Organization',
|
16
|
+
editMode: false,
|
17
|
+
editModeCallback: noop,
|
18
|
+
paramDataUrl: '/acd/ui_acd_fdata/__id__',
|
19
|
+
paramType: '',
|
20
|
+
data: {},
|
21
|
+
initParameterSelection: noop,
|
22
|
+
addParameter: noop,
|
23
|
+
deleteParameter: noop,
|
24
|
+
lockParameter: noop,
|
25
|
+
activateEditParameter: noop,
|
26
|
+
confirmEditParameter: noop,
|
27
|
+
cancelEditParameter: noop,
|
28
|
+
changeEditParameter: noop,
|
29
|
+
sortParameter: noop,
|
30
|
+
openParameterSelectionDialogBox: noop,
|
31
|
+
closeParameterSelectionDialogBox: noop,
|
32
|
+
loadParamData: noop,
|
33
|
+
};
|
34
|
+
|
12
35
|
const fixtures = {
|
36
|
+
'should render loading': baseFixtures,
|
37
|
+
|
13
38
|
'should render foreman parameter selection': {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
...baseFixtures,
|
40
|
+
...{
|
41
|
+
loading: false,
|
42
|
+
paramType: PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
|
43
|
+
data: {
|
44
|
+
type: PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
|
45
|
+
parameters: [],
|
46
|
+
useDefaultValue: true,
|
47
|
+
allowRowAdjustment: true,
|
48
|
+
allowNameAdjustment: true,
|
49
|
+
allowDescriptionAdjustment: true,
|
50
|
+
},
|
26
51
|
},
|
27
|
-
addParameter: noop,
|
28
|
-
confirmEditParametre: noop,
|
29
|
-
cancelEditParameter: noop,
|
30
|
-
editModeCallback: noop,
|
31
|
-
loadParamData: noop,
|
32
|
-
initParameterSelection: noop,
|
33
52
|
},
|
34
53
|
|
35
54
|
'should render ansible parameter selection': {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
...baseFixtures,
|
56
|
+
...{
|
57
|
+
loading: false,
|
58
|
+
paramType: PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
|
59
|
+
data: {
|
60
|
+
type: PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
|
61
|
+
parameters: [],
|
62
|
+
useDefaultValue: false,
|
63
|
+
allowRowAdjustment: true,
|
64
|
+
allowNameAdjustment: true,
|
65
|
+
allowDescriptionAdjustment: true,
|
66
|
+
},
|
47
67
|
},
|
48
|
-
|
49
|
-
confirmEditParametre: noop,
|
50
|
-
cancelEditParameter: noop,
|
51
|
-
editModeCallback: noop,
|
52
|
-
loadParamData: noop,
|
53
|
-
initParameterSelection: noop,
|
54
|
-
}
|
68
|
+
},
|
55
69
|
};
|
56
70
|
|
57
71
|
describe('ParameterSelection', () =>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
// import {expect, jest, test} from '@jest/globals';
|
2
|
+
import {
|
3
|
+
transformForemanData,
|
4
|
+
filterParameterTypes,
|
5
|
+
} from '../ParameterSelectionHelper';
|
6
|
+
|
7
|
+
describe('transformForemanData', () => {
|
8
|
+
const fdata = [
|
9
|
+
{ id: 1, name: '1-Small' },
|
10
|
+
{ id: 2, name: '2-Medium' },
|
11
|
+
{ id: 3, name: '3-Large' },
|
12
|
+
];
|
13
|
+
|
14
|
+
it('returns empty on undefined', () => {
|
15
|
+
expect(transformForemanData(undefined)).toEqual('');
|
16
|
+
});
|
17
|
+
|
18
|
+
it('returns object with "id" as key and "name" as value', () => {
|
19
|
+
expect(transformForemanData(fdata)).toEqual({
|
20
|
+
1: '1-Small',
|
21
|
+
2: '2-Medium',
|
22
|
+
3: '3-Large',
|
23
|
+
});
|
24
|
+
});
|
25
|
+
});
|
26
|
+
|
27
|
+
describe('filterParameterTypes', () => {
|
28
|
+
const parameters = [
|
29
|
+
{
|
30
|
+
id: 1,
|
31
|
+
locked: false,
|
32
|
+
name: 'Password',
|
33
|
+
description: '',
|
34
|
+
type: 'password',
|
35
|
+
value: '1234',
|
36
|
+
isYaml: false,
|
37
|
+
},
|
38
|
+
{
|
39
|
+
id: 2,
|
40
|
+
locked: false,
|
41
|
+
name: 'NotAllowed',
|
42
|
+
description: '',
|
43
|
+
type: 'not_allowed',
|
44
|
+
value: '1234',
|
45
|
+
isYaml: false,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
id: 3,
|
49
|
+
locked: false,
|
50
|
+
name: 'HostParameter1',
|
51
|
+
description: '',
|
52
|
+
type: 'hostparam',
|
53
|
+
value: '1234',
|
54
|
+
isYaml: false,
|
55
|
+
},
|
56
|
+
{
|
57
|
+
id: 4,
|
58
|
+
locked: false,
|
59
|
+
name: 'HostParameter2',
|
60
|
+
description: '',
|
61
|
+
type: 'hostparam',
|
62
|
+
value: '1234',
|
63
|
+
isYaml: false,
|
64
|
+
},
|
65
|
+
];
|
66
|
+
|
67
|
+
it('removes parameter-types present in parameters', () => {
|
68
|
+
expect(filterParameterTypes({ password: '' }, parameters)).toEqual({});
|
69
|
+
});
|
70
|
+
|
71
|
+
it('keeps "hostparam" in parameter-types', () => {
|
72
|
+
expect(filterParameterTypes({ hostparam: '' }, parameters)).toEqual({
|
73
|
+
hostparam: '',
|
74
|
+
});
|
75
|
+
});
|
76
|
+
});
|
@@ -31,8 +31,6 @@ import {
|
|
31
31
|
PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
|
32
32
|
PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
|
33
33
|
PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
|
34
|
-
PARAMETER_SELECTION_COMPLEX_DATA_MODAL_OPEN,
|
35
|
-
PARAMETER_SELECTION_COMPLEX_DATA_MODAL_CLOSE,
|
36
34
|
} from '../ParameterSelectionConstants';
|
37
35
|
|
38
36
|
const fixtures = {
|
@@ -14,9 +14,7 @@ import {
|
|
14
14
|
selectEditParamsRowIndex,
|
15
15
|
} from '../ParameterSelectionSelectors';
|
16
16
|
|
17
|
-
import {
|
18
|
-
parameterSelectionData_1,
|
19
|
-
} from '../__fixtures__/parameterSelectionData_1.fixtures';
|
17
|
+
import { parameterSelectionData1 } from '../__fixtures__/parameterSelectionData1.fixtures';
|
20
18
|
|
21
19
|
const stateFactory = obj => ({
|
22
20
|
foremanAcd: {
|
@@ -25,28 +23,28 @@ const stateFactory = obj => ({
|
|
25
23
|
});
|
26
24
|
|
27
25
|
const fixtures = {
|
28
|
-
'should return loading from
|
29
|
-
selectLoading(stateFactory(
|
30
|
-
'should return editMode from
|
31
|
-
selectEditMode(stateFactory(
|
32
|
-
'should return paramData from
|
33
|
-
selectParamData(stateFactory(
|
34
|
-
'should return allowedParameterTypes from
|
35
|
-
selectAllowedParameterTypes(stateFactory(
|
36
|
-
'should return parameterTypes from
|
37
|
-
selectParameterTypes(stateFactory(
|
38
|
-
'should return parameters from
|
39
|
-
selectParameters(stateFactory(
|
40
|
-
'should return sortingColumns from
|
41
|
-
selectSortingColumns(stateFactory(
|
42
|
-
'should return columns from
|
43
|
-
selectColumns(stateFactory(
|
44
|
-
'should return ParamDefinition from
|
45
|
-
selectParamDefinition(stateFactory(
|
46
|
-
'should return hostgroupId from
|
47
|
-
selectHostgroupId(stateFactory(
|
48
|
-
'should return editParamsRowIndex from
|
49
|
-
selectEditParamsRowIndex(stateFactory(
|
26
|
+
'should return loading from parameterSelectionData1 fixtures': () =>
|
27
|
+
selectLoading(stateFactory(parameterSelectionData1)),
|
28
|
+
'should return editMode from parameterSelectionData1 fixtures': () =>
|
29
|
+
selectEditMode(stateFactory(parameterSelectionData1)),
|
30
|
+
'should return paramData from parameterSelectionData1 fixtures': () =>
|
31
|
+
selectParamData(stateFactory(parameterSelectionData1)),
|
32
|
+
'should return allowedParameterTypes from parameterSelectionData1 fixtures': () =>
|
33
|
+
selectAllowedParameterTypes(stateFactory(parameterSelectionData1)),
|
34
|
+
'should return parameterTypes from parameterSelectionData1 fixtures': () =>
|
35
|
+
selectParameterTypes(stateFactory(parameterSelectionData1)),
|
36
|
+
'should return parameters from parameterSelectionData1 fixtures': () =>
|
37
|
+
selectParameters(stateFactory(parameterSelectionData1)),
|
38
|
+
'should return sortingColumns from parameterSelectionData1 fixtures': () =>
|
39
|
+
selectSortingColumns(stateFactory(parameterSelectionData1)),
|
40
|
+
'should return columns from parameterSelectionData1 fixtures': () =>
|
41
|
+
selectColumns(stateFactory(parameterSelectionData1)),
|
42
|
+
'should return ParamDefinition from parameterSelectionData1 fixtures': () =>
|
43
|
+
selectParamDefinition(stateFactory(parameterSelectionData1)),
|
44
|
+
'should return hostgroupId from parameterSelectionData1 fixtures': () =>
|
45
|
+
selectHostgroupId(stateFactory(parameterSelectionData1)),
|
46
|
+
'should return editParamsRowIndex from parameterSelectionData1 fixtures': () =>
|
47
|
+
selectEditParamsRowIndex(stateFactory(parameterSelectionData1)),
|
50
48
|
};
|
51
49
|
|
52
50
|
describe('ParameterSelectionSelectors', () =>
|