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,19 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import { actionHeaderCellFormatter } from 'patternfly-react';
|
2
2
|
import api from 'foremanReact/API';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
3
4
|
import {
|
4
5
|
setModalOpen,
|
5
6
|
setModalClosed,
|
6
7
|
} from 'foremanReact/components/ForemanModal/ForemanModalActions';
|
7
8
|
|
8
|
-
import {
|
9
|
-
actionHeaderCellFormatter,
|
10
|
-
} from 'patternfly-react';
|
11
|
-
|
12
|
-
import {
|
13
|
-
propsToSnakeCase,
|
14
|
-
propsToCamelCase,
|
15
|
-
} from 'foremanReact/common/helpers';
|
16
|
-
|
17
9
|
import {
|
18
10
|
APPLICATION_INSTANCE_INIT,
|
19
11
|
APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
|
@@ -36,9 +28,7 @@ import {
|
|
36
28
|
APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
|
37
29
|
} from './ApplicationInstanceConstants';
|
38
30
|
|
39
|
-
import {
|
40
|
-
supportedPluginsToHiddenParameterTypes,
|
41
|
-
} from '../../helper';
|
31
|
+
import { supportedPluginsToHiddenParameterTypes } from '../../helper';
|
42
32
|
|
43
33
|
export const initApplicationInstance = (
|
44
34
|
appDefinition,
|
@@ -47,7 +37,7 @@ export const initApplicationInstance = (
|
|
47
37
|
supportedPlugins,
|
48
38
|
headerFormatter,
|
49
39
|
inlineEditFormatter,
|
50
|
-
inlineEditButtonsFormatter
|
40
|
+
inlineEditButtonsFormatter
|
51
41
|
) => dispatch => {
|
52
42
|
const initialState = {};
|
53
43
|
|
@@ -60,13 +50,13 @@ export const initApplicationInstance = (
|
|
60
50
|
props: {
|
61
51
|
index: 0,
|
62
52
|
style: {
|
63
|
-
width: '30%'
|
64
|
-
}
|
53
|
+
width: '30%',
|
54
|
+
},
|
65
55
|
},
|
66
56
|
},
|
67
57
|
cell: {
|
68
|
-
formatters: [inlineEditFormatter]
|
69
|
-
}
|
58
|
+
formatters: [inlineEditFormatter],
|
59
|
+
},
|
70
60
|
},
|
71
61
|
{
|
72
62
|
property: 'description',
|
@@ -76,13 +66,13 @@ export const initApplicationInstance = (
|
|
76
66
|
props: {
|
77
67
|
index: 1,
|
78
68
|
style: {
|
79
|
-
width: '30%'
|
80
|
-
}
|
69
|
+
width: '30%',
|
70
|
+
},
|
81
71
|
},
|
82
72
|
},
|
83
73
|
cell: {
|
84
|
-
formatters: [inlineEditFormatter]
|
85
|
-
}
|
74
|
+
formatters: [inlineEditFormatter],
|
75
|
+
},
|
86
76
|
},
|
87
77
|
{
|
88
78
|
property: 'service',
|
@@ -92,13 +82,13 @@ export const initApplicationInstance = (
|
|
92
82
|
props: {
|
93
83
|
index: 2,
|
94
84
|
style: {
|
95
|
-
width: '20%'
|
96
|
-
}
|
85
|
+
width: '20%',
|
86
|
+
},
|
97
87
|
},
|
98
88
|
},
|
99
89
|
cell: {
|
100
|
-
formatters: [inlineEditFormatter]
|
101
|
-
}
|
90
|
+
formatters: [inlineEditFormatter],
|
91
|
+
},
|
102
92
|
},
|
103
93
|
{
|
104
94
|
property: 'actions',
|
@@ -108,20 +98,22 @@ export const initApplicationInstance = (
|
|
108
98
|
props: {
|
109
99
|
index: 4,
|
110
100
|
style: {
|
111
|
-
width: '20%'
|
112
|
-
}
|
101
|
+
width: '20%',
|
102
|
+
},
|
113
103
|
},
|
114
104
|
},
|
115
105
|
cell: {
|
116
|
-
formatters: [inlineEditButtonsFormatter]
|
117
|
-
}
|
118
|
-
}
|
106
|
+
formatters: [inlineEditButtonsFormatter],
|
107
|
+
},
|
108
|
+
},
|
119
109
|
];
|
120
110
|
|
121
111
|
initialState.appDefinition = appDefinition;
|
122
112
|
initialState.hosts = hosts;
|
123
113
|
initialState.ansibleVarsAll = ansibleVarsAll;
|
124
|
-
initialState.hiddenForemanParameterTypes = supportedPluginsToHiddenParameterTypes(
|
114
|
+
initialState.hiddenForemanParameterTypes = supportedPluginsToHiddenParameterTypes(
|
115
|
+
supportedPlugins
|
116
|
+
);
|
125
117
|
|
126
118
|
dispatch({
|
127
119
|
type: APPLICATION_INSTANCE_INIT,
|
@@ -139,59 +131,62 @@ const errorHandler = (msg, err) => {
|
|
139
131
|
|
140
132
|
export const closeAlertModal = () => ({
|
141
133
|
type: APPLICATION_INSTANCE_CLOSE_ALERT_MODAL,
|
142
|
-
payload: {}
|
134
|
+
payload: {},
|
143
135
|
});
|
144
136
|
|
145
137
|
export const loadApplicationDefinition = (
|
146
138
|
applicationDefinitionId,
|
147
|
-
additionalData
|
148
|
-
) => dispatch => {
|
139
|
+
additionalData
|
140
|
+
) => async dispatch => {
|
149
141
|
dispatch({ type: APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST });
|
150
142
|
|
151
|
-
const realUrl = additionalData.url.replace(
|
143
|
+
const realUrl = additionalData.url.replace('__id__', applicationDefinitionId);
|
152
144
|
|
153
|
-
|
154
|
-
.get(realUrl, {}, {})
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
145
|
+
try {
|
146
|
+
const { data } = await api.get(realUrl, {}, {});
|
147
|
+
|
148
|
+
dispatch({
|
149
|
+
type: APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS,
|
150
|
+
payload: data,
|
151
|
+
});
|
152
|
+
} catch (error) {
|
153
|
+
dispatch(
|
154
|
+
errorHandler(
|
155
|
+
APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE,
|
156
|
+
error
|
157
|
+
)
|
158
|
+
);
|
159
|
+
}
|
162
160
|
};
|
163
161
|
|
164
|
-
export const addApplicationInstanceHost =
|
162
|
+
export const addApplicationInstanceHost = additionalData => ({
|
165
163
|
type: APPLICATION_INSTANCE_HOST_ADD,
|
166
164
|
payload: {
|
167
165
|
...additionalData,
|
168
166
|
},
|
169
167
|
});
|
170
168
|
|
171
|
-
export const deleteApplicationInstanceHost =
|
169
|
+
export const deleteApplicationInstanceHost = additionalData => ({
|
172
170
|
type: APPLICATION_INSTANCE_HOST_DELETE,
|
173
171
|
payload: {
|
174
172
|
...additionalData,
|
175
173
|
},
|
176
174
|
});
|
177
175
|
|
178
|
-
export const activateEditApplicationInstanceHost =
|
176
|
+
export const activateEditApplicationInstanceHost = additionalData => ({
|
179
177
|
type: APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE,
|
180
178
|
payload: {
|
181
179
|
...additionalData,
|
182
180
|
},
|
183
181
|
});
|
184
182
|
|
185
|
-
export const confirmEditApplicationInstanceHost =
|
186
|
-
allData
|
187
|
-
) => async(dispatch) => {
|
188
|
-
|
183
|
+
export const confirmEditApplicationInstanceHost = allData => async dispatch => {
|
189
184
|
// Host name can not be empty
|
190
185
|
|
191
|
-
if (allData.rowData.hostname
|
186
|
+
if (allData.rowData.hostname === '') {
|
192
187
|
dispatch({
|
193
188
|
type: APPLICATION_INSTANCE_HOST_EDIT_ERROR,
|
194
|
-
payload: __(
|
189
|
+
payload: __('Every host needs to have a valid name'),
|
195
190
|
});
|
196
191
|
return;
|
197
192
|
}
|
@@ -199,34 +194,36 @@ export const confirmEditApplicationInstanceHost = (
|
|
199
194
|
// Host name can only have specific characters
|
200
195
|
|
201
196
|
const hostname = allData.rowData.hostname.toLowerCase();
|
202
|
-
const hostnameRegex = /^[0-9a-z]([0-9a-z
|
197
|
+
const hostnameRegex = /^[0-9a-z]([0-9a-z-]{0,61}[0-9a-z])$/;
|
203
198
|
|
204
|
-
if (hostname.match(hostnameRegex)
|
199
|
+
if (hostname.match(hostnameRegex) === undefined) {
|
205
200
|
dispatch({
|
206
201
|
type: APPLICATION_INSTANCE_HOST_EDIT_ERROR,
|
207
|
-
payload: __(
|
202
|
+
payload: __(
|
203
|
+
'The hostname uses not allowed characters. See https://en.wikipedia.org/wiki/Hostname#Syntax for more details.'
|
204
|
+
),
|
208
205
|
});
|
209
206
|
return;
|
210
207
|
}
|
211
208
|
|
212
209
|
// Service can not be empty
|
213
210
|
|
214
|
-
if (allData.rowData.service
|
211
|
+
if (allData.rowData.service === '') {
|
215
212
|
dispatch({
|
216
213
|
type: APPLICATION_INSTANCE_HOST_EDIT_ERROR,
|
217
|
-
payload: __(
|
214
|
+
payload: __('Every host needs to be assigned to a service.'),
|
218
215
|
});
|
219
216
|
return;
|
220
217
|
}
|
221
218
|
|
222
219
|
// Validation if host name is already used (only for new host entrys)
|
223
220
|
|
224
|
-
const url = '/acd/ui_acd_validate_hostname'
|
221
|
+
const url = '/acd/ui_acd_validate_hostname';
|
225
222
|
const validationData = {};
|
226
223
|
|
227
|
-
validationData
|
228
|
-
validationData
|
229
|
-
validationData
|
224
|
+
validationData.appDefId = allData.appDefinition.id;
|
225
|
+
validationData.serviceId = allData.rowData.service;
|
226
|
+
validationData.hostname = allData.rowData.hostname;
|
230
227
|
|
231
228
|
if (allData.rowData.newEntry === true) {
|
232
229
|
try {
|
@@ -237,12 +234,14 @@ export const confirmEditApplicationInstanceHost = (
|
|
237
234
|
type: APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
|
238
235
|
payload: {
|
239
236
|
...allData,
|
240
|
-
}
|
237
|
+
},
|
241
238
|
});
|
242
239
|
} else {
|
243
240
|
dispatch({
|
244
241
|
type: APPLICATION_INSTANCE_HOST_EDIT_ERROR,
|
245
|
-
payload: __(
|
242
|
+
payload: __(
|
243
|
+
`Hostname '${allData.rowData.hostname}' is already used. This check also includes hosts outside this application instance.`
|
244
|
+
),
|
246
245
|
});
|
247
246
|
}
|
248
247
|
} catch (error) {
|
@@ -256,12 +255,12 @@ export const confirmEditApplicationInstanceHost = (
|
|
256
255
|
type: APPLICATION_INSTANCE_HOST_EDIT_CONFIRM,
|
257
256
|
payload: {
|
258
257
|
...allData,
|
259
|
-
}
|
258
|
+
},
|
260
259
|
});
|
261
260
|
}
|
262
261
|
};
|
263
262
|
|
264
|
-
export const cancelEditApplicationInstanceHost =
|
263
|
+
export const cancelEditApplicationInstanceHost = rowData => ({
|
265
264
|
type: APPLICATION_INSTANCE_HOST_EDIT_CANCEL,
|
266
265
|
payload: {
|
267
266
|
...rowData,
|
@@ -276,84 +275,72 @@ export const changeEditApplicationInstanceHost = (value, additionalData) => ({
|
|
276
275
|
},
|
277
276
|
});
|
278
277
|
|
279
|
-
export const openForemanParameterSelectionModal =
|
278
|
+
export const openForemanParameterSelectionModal = additionalData => dispatch => {
|
280
279
|
dispatch({
|
281
280
|
type: APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
|
282
281
|
payload: {
|
283
282
|
...additionalData,
|
284
|
-
}
|
283
|
+
},
|
285
284
|
});
|
286
|
-
dispatch(
|
287
|
-
|
288
|
-
);
|
289
|
-
}
|
285
|
+
dispatch(setModalOpen({ id: 'AppInstanceForemanParamSelection' }));
|
286
|
+
};
|
290
287
|
|
291
|
-
export const closeForemanParameterSelectionModal =
|
288
|
+
export const closeForemanParameterSelectionModal = additionalData => dispatch => {
|
292
289
|
dispatch({
|
293
290
|
type: APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
|
294
291
|
payload: {
|
295
292
|
...additionalData,
|
296
|
-
}
|
293
|
+
},
|
297
294
|
});
|
298
295
|
|
299
|
-
dispatch(
|
300
|
-
|
301
|
-
);
|
302
|
-
}
|
296
|
+
dispatch(setModalClosed({ id: 'AppInstanceForemanParamSelection' }));
|
297
|
+
};
|
303
298
|
|
304
|
-
export const openAnsibleParameterSelectionModal =
|
299
|
+
export const openAnsibleParameterSelectionModal = additionalData => dispatch => {
|
305
300
|
dispatch({
|
306
301
|
type: APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
|
307
302
|
payload: {
|
308
303
|
...additionalData,
|
309
|
-
}
|
304
|
+
},
|
310
305
|
});
|
311
|
-
dispatch(
|
312
|
-
|
313
|
-
);
|
314
|
-
}
|
306
|
+
dispatch(setModalOpen({ id: 'AppInstanceAnsibleParamSelection' }));
|
307
|
+
};
|
315
308
|
|
316
|
-
export const closeAnsibleParameterSelectionModal =
|
309
|
+
export const closeAnsibleParameterSelectionModal = additionalData => dispatch => {
|
317
310
|
dispatch({
|
318
311
|
type: APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
|
319
312
|
payload: {
|
320
313
|
...additionalData,
|
321
|
-
}
|
314
|
+
},
|
322
315
|
});
|
323
316
|
|
324
|
-
dispatch(
|
325
|
-
|
326
|
-
);
|
327
|
-
}
|
317
|
+
dispatch(setModalClosed({ id: 'AppInstanceAnsibleParamSelection' }));
|
318
|
+
};
|
328
319
|
|
329
|
-
export const openAddExistingHostsModal =
|
320
|
+
export const openAddExistingHostsModal = additionalData => dispatch => {
|
330
321
|
dispatch({
|
331
322
|
type: APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN,
|
332
323
|
payload: {
|
333
324
|
...additionalData,
|
334
|
-
}
|
325
|
+
},
|
335
326
|
});
|
336
|
-
dispatch(
|
337
|
-
|
338
|
-
);
|
339
|
-
}
|
327
|
+
dispatch(setModalOpen({ id: 'AppInstanceAddExistingHosts' }));
|
328
|
+
};
|
340
329
|
|
341
|
-
export const closeAddExistingHostsModal =
|
330
|
+
export const closeAddExistingHostsModal = additionalData => dispatch => {
|
342
331
|
dispatch({
|
343
332
|
type: APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE,
|
344
333
|
payload: {
|
345
334
|
...additionalData,
|
346
|
-
}
|
335
|
+
},
|
347
336
|
});
|
348
337
|
|
349
|
-
dispatch(
|
350
|
-
|
351
|
-
);
|
352
|
-
}
|
338
|
+
dispatch(setModalClosed({ id: 'AppInstanceAddExistingHosts' }));
|
339
|
+
};
|
353
340
|
|
354
|
-
export const changeParameterSelectionMode =
|
341
|
+
export const changeParameterSelectionMode = additionalData => ({
|
355
342
|
type: APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
|
356
343
|
payload: {
|
357
344
|
...additionalData,
|
358
345
|
},
|
359
|
-
})
|
346
|
+
});
|
@@ -1,19 +1,36 @@
|
|
1
1
|
export const APPLICATION_INSTANCE_INIT = 'APPLICATION_INSTANCE_INIT';
|
2
|
-
export const APPLICATION_INSTANCE_CLOSE_ALERT_MODAL =
|
3
|
-
|
4
|
-
export const
|
5
|
-
|
6
|
-
export const
|
2
|
+
export const APPLICATION_INSTANCE_CLOSE_ALERT_MODAL =
|
3
|
+
'APPLICATION_INSTANCE_CLOSE_ALERT_MODAL';
|
4
|
+
export const APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST =
|
5
|
+
'APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_REQUEST';
|
6
|
+
export const APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS =
|
7
|
+
'APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_SUCCESS';
|
8
|
+
export const APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE =
|
9
|
+
'APPLICATION_INSTANCE_LOAD_APPLICATION_DEFINITION_FAILURE';
|
10
|
+
export const APPLICATION_INSTANCE_HOST_DELETE =
|
11
|
+
'APPLICATION_INSTANCE_HOST_DELETE';
|
7
12
|
export const APPLICATION_INSTANCE_HOST_ADD = 'APPLICATION_INSTANCE_HOST_ADD';
|
8
|
-
export const APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE =
|
9
|
-
|
10
|
-
export const
|
11
|
-
|
12
|
-
export const
|
13
|
-
|
14
|
-
export const
|
15
|
-
|
16
|
-
export const
|
17
|
-
|
18
|
-
export const
|
19
|
-
|
13
|
+
export const APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE =
|
14
|
+
'APPLICATION_INSTANCE_HOST_EDIT_ACTIVATE';
|
15
|
+
export const APPLICATION_INSTANCE_HOST_EDIT_CONFIRM =
|
16
|
+
'APPLICATION_INSTANCE_HOST_EDIT_CONFIRM';
|
17
|
+
export const APPLICATION_INSTANCE_HOST_EDIT_CHANGE =
|
18
|
+
'APPLICATION_INSTANCE_HOST_EDIT_CHANGE';
|
19
|
+
export const APPLICATION_INSTANCE_HOST_EDIT_CANCEL =
|
20
|
+
'APPLICATION_INSTANCE_HOST_EDIT_CANCEL';
|
21
|
+
export const APPLICATION_INSTANCE_HOST_EDIT_ERROR =
|
22
|
+
'APPLICATION_INSTANCE_HOST_EDIT_ERROR';
|
23
|
+
export const APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN =
|
24
|
+
'APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN';
|
25
|
+
export const APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE =
|
26
|
+
'APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE';
|
27
|
+
export const APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN =
|
28
|
+
'APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN';
|
29
|
+
export const APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE =
|
30
|
+
'APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE';
|
31
|
+
export const APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN =
|
32
|
+
'APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_OPEN';
|
33
|
+
export const APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE =
|
34
|
+
'APPLICATION_INSTANCE_ADD_EXISTING_HOSTS_MODAL_CLOSE';
|
35
|
+
export const APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE =
|
36
|
+
'APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE';
|
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
1
|
function calculateServiceUsage(hostServiceId, services) {
|
3
|
-
const service = services.find(serv => serv
|
2
|
+
const service = services.find(serv => serv.id === hostServiceId);
|
4
3
|
if ('currentCount' in service) {
|
5
|
-
service
|
4
|
+
service.currentCount += 1;
|
6
5
|
} else {
|
7
|
-
service
|
6
|
+
service.currentCount = 1;
|
8
7
|
}
|
9
8
|
|
10
9
|
return services;
|
11
10
|
}
|
12
11
|
|
13
|
-
export {
|
14
|
-
calculateServiceUsage,
|
15
|
-
};
|
12
|
+
export { calculateServiceUsage };
|