foreman_acd 0.0.6 → 0.6.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 +107 -56
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +124 -0
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +72 -0
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +2 -2
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +46 -9
- data/app/controllers/foreman_acd/app_instances_controller.rb +96 -90
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +23 -0
- data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
- data/app/controllers/foreman_acd/remote_execution_controller.rb +46 -0
- data/app/controllers/ui_acd_controller.rb +20 -4
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +42 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +41 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
- data/app/models/foreman_acd/acd_provider.rb +30 -0
- data/app/models/foreman_acd/ansible_playbook.rb +67 -0
- data/app/models/foreman_acd/app_definition.rb +25 -1
- data/app/models/foreman_acd/app_instance.rb +42 -0
- data/app/models/foreman_acd/foreman_host.rb +23 -0
- data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +54 -0
- data/app/services/foreman_acd/app_deployer.rb +151 -0
- data/app/services/foreman_acd/inventory_creator.rb +54 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +30 -0
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +11 -0
- data/app/views/foreman_acd/ansible_playbooks/index.html.erb +30 -0
- data/app/views/foreman_acd/ansible_playbooks/new.html.erb +3 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +5 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +34 -20
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +10 -6
- data/app/views/foreman_acd/app_instances/_form.html.erb +12 -10
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +87 -9
- data/app/views/foreman_acd/app_instances/report.html.erb +22 -0
- data/app/views/templates/job/run_acd_ansible_playbook.erb +62 -0
- data/app/views/ui_acd/ansible_data.json.rabl +6 -0
- data/app/views/ui_acd/app.json.rabl +6 -2
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/app/views/ui_acd/{fdata.json.rabl → foreman_data.json.rabl} +1 -1
- data/config/routes.rb +35 -1
- data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
- data/db/migrate/20190625140305_create_app_instances.rb +1 -1
- data/db/migrate/20200916091018_create_ansible_playbooks.rb +20 -0
- data/db/migrate/20200917120220_add_ansible_playbook_id.rb +14 -0
- data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +8 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +8 -0
- data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
- data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
- data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
- data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
- data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
- data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
- data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
- data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
- data/db/seeds.d/75-job_templates.rb +13 -0
- data/lib/foreman_acd/engine.rb +21 -3
- data/lib/foreman_acd/plugin.rb +112 -20
- data/lib/foreman_acd/version.rb +1 -1
- data/locale/en/foreman_acd.edit.po +326 -0
- data/locale/en/foreman_acd.po +232 -2
- data/locale/en/foreman_acd.po.time_stamp +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/package.json +1 -1
- data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +391 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +303 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +15 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +269 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +9 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +49 -0
- data/webpack/components/ApplicationDefinition/index.js +35 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +451 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +247 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +15 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +309 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +10 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +49 -0
- data/webpack/components/ApplicationInstance/components/Service.js +30 -0
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +37 -0
- data/webpack/components/ApplicationInstance/index.js +37 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +148 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +44 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +42 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +38 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
- data/webpack/components/ApplicationInstanceReport/index.js +25 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +131 -192
- data/webpack/components/ParameterSelection/ParameterSelection.scss +9 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +87 -110
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +15 -19
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -35
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +116 -84
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +3 -7
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +12 -21
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +1 -1
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +3 -45
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +20 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +22 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +40 -265
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +11 -96
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +3 -9
- data/webpack/components/ParameterSelection/index.js +6 -8
- data/webpack/components/common/AddTableEntry.js +30 -0
- data/webpack/components/common/DeleteTableEntry.js +39 -0
- data/webpack/components/common/EasyHeaderFormatter.js +18 -0
- data/webpack/components/common/EditTableEntry.js +50 -0
- data/webpack/components/common/ExtSelect.js +43 -0
- data/webpack/components/common/LockTableEntry.js +60 -0
- data/webpack/components/common/RailsData.js +27 -0
- data/webpack/components/common/__tests__/AddTableEntry.test.js +26 -0
- data/webpack/components/common/__tests__/DeleteTableEntry.test.js +29 -0
- data/webpack/components/common/__tests__/ExtSelect.test.js +38 -0
- data/webpack/components/common/__tests__/RailsData.test.js +16 -0
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/AddTableEntry.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/ExtSelect.test.js.snap +18 -0
- data/webpack/components/common/__tests__/__snapshots__/RailsData.test.js.snap +10 -0
- data/webpack/helper.js +20 -0
- data/webpack/index.js +6 -0
- data/webpack/reducer.js +43 -3
- metadata +114 -20
@@ -13,23 +13,27 @@ import {
|
|
13
13
|
import * as sort from 'sortabular';
|
14
14
|
|
15
15
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
PARAMETER_SELECTION_INIT,
|
17
|
+
PARAMETER_SELECTION_TYPES,
|
18
|
+
PARAMETER_SELECTION_LOCK,
|
19
|
+
PARAMETER_SELECTION_DELETE,
|
20
|
+
PARAMETER_SELECTION_ADD,
|
21
|
+
PARAMETER_SELECTION_EDIT_ACTIVATE,
|
22
|
+
PARAMETER_SELECTION_EDIT_CONFIRM,
|
23
|
+
PARAMETER_SELECTION_EDIT_CHANGE,
|
24
|
+
PARAMETER_SELECTION_EDIT_CANCEL,
|
25
|
+
PARAMETER_SELECTION_SORT,
|
26
|
+
PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
|
27
|
+
PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
|
28
|
+
PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
|
29
|
+
PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
|
30
|
+
PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
|
31
31
|
} from './ParameterSelectionConstants';
|
32
32
|
|
33
|
+
import {
|
34
|
+
APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE,
|
35
|
+
} from '../ApplicationDefinition/ApplicationDefinitionConstants';
|
36
|
+
|
33
37
|
export const initialState = Immutable({
|
34
38
|
editMode: false,
|
35
39
|
error: { errorMsg: '', status: '', statusText: '' },
|
@@ -39,83 +43,97 @@ const parameterSelectionParameters = (state = initialState, action) => {
|
|
39
43
|
const { payload } = action;
|
40
44
|
|
41
45
|
switch (action.type) {
|
42
|
-
case
|
46
|
+
case PARAMETER_SELECTION_INIT: {
|
43
47
|
return state.merge(payload);
|
44
48
|
}
|
45
|
-
case
|
46
|
-
|
47
|
-
|
49
|
+
case PARAMETER_SELECTION_ADD: {
|
50
|
+
let parameters = [];
|
51
|
+
let index = 1;
|
48
52
|
|
49
|
-
if ('
|
50
|
-
|
51
|
-
index = Math.max(...
|
53
|
+
if ('parameters' in state && state.parameters !== undefined && state.parameters.length > 0) {
|
54
|
+
parameters = cloneDeep(state.parameters);
|
55
|
+
index = Math.max(...parameters.map(e => e.id)) + 1;
|
52
56
|
}
|
53
57
|
|
54
|
-
const newRow = {id: index, name: "", description: '', type: '', value: '', newEntry: true };
|
58
|
+
const newRow = {id: index, locked: false, name: "", description: '', type: '', value: '', newEntry: true };
|
55
59
|
newRow.backup = cloneDeep(newRow)
|
56
|
-
|
60
|
+
parameters.push(newRow);
|
57
61
|
|
58
62
|
return state.merge({
|
59
63
|
editMode: true,
|
60
|
-
|
64
|
+
parameters: parameters
|
61
65
|
});
|
62
66
|
}
|
63
|
-
case
|
64
|
-
|
67
|
+
case PARAMETER_SELECTION_LOCK: {
|
68
|
+
const parameters = cloneDeep(state.parameters);
|
69
|
+
const index = findIndex(parameters, { id: payload.rowData.id });
|
70
|
+
|
71
|
+
if (parameters[index].locked !== undefined) {
|
72
|
+
parameters[index].locked = !parameters[index].locked;
|
73
|
+
} else {
|
74
|
+
parameters[index].locked = true;
|
75
|
+
}
|
76
|
+
|
65
77
|
return state.merge({
|
66
|
-
|
67
|
-
|
78
|
+
parameters: parameters
|
79
|
+
});
|
80
|
+
}
|
81
|
+
case PARAMETER_SELECTION_DELETE: {
|
82
|
+
const parameters = state.parameters.filter(v => v.id !== payload.rowData.id);
|
83
|
+
return state.merge({
|
84
|
+
parameters: parameters,
|
85
|
+
parameterTypes: filterUsedParameterTypes(PARAMETER_SELECTION_TYPES, parameters),
|
68
86
|
})
|
69
87
|
}
|
70
|
-
case
|
71
|
-
const
|
72
|
-
const index = findIndex(
|
88
|
+
case PARAMETER_SELECTION_EDIT_ACTIVATE: {
|
89
|
+
const parameters = cloneDeep(state.parameters);
|
90
|
+
const index = findIndex(parameters, { id: payload.rowData.id });
|
73
91
|
|
74
|
-
|
92
|
+
parameters[index].backup = cloneDeep(parameters[index]);
|
75
93
|
|
76
94
|
return state.merge({
|
77
95
|
editMode: true,
|
78
|
-
|
96
|
+
parameters: parameters
|
79
97
|
});
|
80
98
|
}
|
81
|
-
case
|
82
|
-
const
|
83
|
-
const index = findIndex(
|
99
|
+
case PARAMETER_SELECTION_EDIT_CONFIRM: {
|
100
|
+
const parameters = cloneDeep(state.parameters);
|
101
|
+
const index = findIndex(parameters, { id: payload.rowData.id });
|
84
102
|
|
85
|
-
delete
|
86
|
-
delete
|
103
|
+
delete parameters[index].backup;
|
104
|
+
delete parameters[index].newEntry;
|
87
105
|
|
88
106
|
return state.merge({
|
89
107
|
editMode: false,
|
90
|
-
parameterTypes: filterUsedParameterTypes(
|
91
|
-
|
108
|
+
parameterTypes: filterUsedParameterTypes(PARAMETER_SELECTION_TYPES, parameters),
|
109
|
+
parameters: parameters
|
92
110
|
});
|
93
111
|
}
|
94
|
-
case
|
95
|
-
const
|
96
|
-
const index = findIndex(
|
112
|
+
case PARAMETER_SELECTION_EDIT_CHANGE: {
|
113
|
+
const parameters = cloneDeep(state.parameters);
|
114
|
+
const index = findIndex(parameters, { id: payload.rowData.id });
|
97
115
|
|
98
|
-
|
116
|
+
parameters[index][payload.property] = payload.value;
|
99
117
|
|
100
|
-
return state.set('
|
118
|
+
return state.set('parameters', parameters);
|
101
119
|
}
|
102
|
-
case
|
103
|
-
const
|
104
|
-
const index = findIndex(
|
120
|
+
case PARAMETER_SELECTION_EDIT_CANCEL: {
|
121
|
+
const parameters = cloneDeep(state.parameters);
|
122
|
+
const index = findIndex(parameters, { id: payload.rowData.id });
|
105
123
|
|
106
|
-
|
107
|
-
delete
|
124
|
+
parameters[index] = cloneDeep(parameters[index].backup);
|
125
|
+
delete parameters[index].backup;
|
108
126
|
|
109
|
-
if (
|
110
|
-
|
127
|
+
if (parameters[index].newEntry === true) {
|
128
|
+
parameters.splice(index, 1);
|
111
129
|
}
|
112
130
|
|
113
131
|
return state.merge({
|
114
132
|
editMode: false,
|
115
|
-
|
133
|
+
parameters: parameters
|
116
134
|
});
|
117
135
|
}
|
118
|
-
case
|
136
|
+
case PARAMETER_SELECTION_SORT: {
|
119
137
|
const selectedColumn = payload.selectedColumn;
|
120
138
|
return state.set(
|
121
139
|
'sortingColumns',
|
@@ -126,45 +144,59 @@ const parameterSelectionParameters = (state = initialState, action) => {
|
|
126
144
|
})
|
127
145
|
);
|
128
146
|
}
|
129
|
-
case
|
130
|
-
return state.merge({ error: payload.error, loading: false });
|
131
|
-
}
|
132
|
-
case LOAD_PARAMETER_SELECTION_REQUEST: {
|
133
|
-
return state.set('loading', true);
|
134
|
-
}
|
135
|
-
case LOAD_PARAMETER_SELECTION_SUCCESS: {
|
136
|
-
return state.merge({
|
137
|
-
appDefinition: payload.app_definition,
|
138
|
-
loading: false,
|
139
|
-
rows: JSON.parse(payload.app_definition.parameters),
|
140
|
-
hostgroupId: payload.app_definition.hostgroup_id,
|
141
|
-
foremanData: payload.fdata,
|
142
|
-
});
|
143
|
-
}
|
144
|
-
case LOAD_FOREMAN_DATA_FAILURE: {
|
147
|
+
case PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE: {
|
145
148
|
return state.merge({
|
146
149
|
error: payload.error,
|
147
150
|
loading: false
|
148
151
|
});
|
149
152
|
}
|
150
|
-
case
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
153
|
+
case PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST: {
|
154
|
+
let newState = {};
|
155
|
+
|
156
|
+
if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
|
157
|
+
newState = {
|
158
|
+
paramData: {},
|
159
|
+
hostgroupId: -1,
|
160
|
+
loading: true
|
161
|
+
};
|
162
|
+
} else if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE) {
|
163
|
+
newState = {
|
164
|
+
loading: true
|
165
|
+
};
|
166
|
+
}
|
167
|
+
|
168
|
+
if (payload.clearParameters === true) {
|
169
|
+
Object.assign(newState, { parameters: [] });
|
170
|
+
}
|
171
|
+
|
172
|
+
return state.merge(newState);
|
173
|
+
}
|
174
|
+
case PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS: {
|
175
|
+
let newState = {};
|
176
|
+
|
177
|
+
if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
|
178
|
+
newState = {
|
179
|
+
loading: false,
|
180
|
+
paramData: payload,
|
181
|
+
hostgroupId: payload.hostgroup_id,
|
182
|
+
};
|
159
183
|
}
|
160
184
|
|
161
185
|
return state.merge(newState);
|
162
186
|
}
|
163
|
-
case
|
187
|
+
case APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE: {
|
188
|
+
const parameters = cloneDeep(state.parameters);
|
189
|
+
|
190
|
+
parameters.forEach((param, index) => {
|
191
|
+
delete parameters[index].backup;
|
192
|
+
if (parameters[index].newEntry === true) {
|
193
|
+
parameters.splice(index, 1);
|
194
|
+
}
|
195
|
+
});
|
196
|
+
|
164
197
|
return state.merge({
|
165
|
-
|
166
|
-
|
167
|
-
hostgroupId: payload.hostgroup_id,
|
198
|
+
editMode: false,
|
199
|
+
parameters: parameters
|
168
200
|
});
|
169
201
|
}
|
170
202
|
default:
|
@@ -1,15 +1,11 @@
|
|
1
|
-
import { differenceBy, slice, includes, uniq } from 'lodash';
|
2
|
-
import Immutable from 'seamless-immutable';
|
3
|
-
import { createSelector } from 'reselect';
|
4
|
-
|
5
1
|
const parameterState = state => state.foremanAcd.parameterSelectionParameters;
|
6
2
|
|
7
3
|
export const selectLoading = state => parameterState(state).loading;
|
8
4
|
export const selectEditMode = state => parameterState(state).editMode;
|
9
|
-
export const
|
5
|
+
export const selectParamData = state => parameterState(state).paramData;
|
10
6
|
export const selectParameterTypes = state => parameterState(state).parameterTypes;
|
11
|
-
export const
|
7
|
+
export const selectParameters = state => parameterState(state).parameters;
|
12
8
|
export const selectSortingColumns = state => parameterState(state).sortingColumns;
|
13
9
|
export const selectColumns = state => parameterState(state).columns;
|
14
|
-
export const
|
10
|
+
export const selectParamDefinition = state => parameterState(state).paramDefinition;
|
15
11
|
export const selectHostgroupId = state => parameterState(state).hostgroupId;
|
@@ -1,21 +1,14 @@
|
|
1
1
|
export const newDefinition = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
mode: "newDefinition",
|
3
|
+
serviceDefinition: {
|
4
|
+
id: 1,
|
5
|
+
name: "Test123",
|
6
|
+
hostgroup_id: 1
|
6
7
|
},
|
7
|
-
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
8
|
-
mode: "newDefinition"
|
9
8
|
};
|
10
9
|
export const editDefinition = {
|
11
|
-
organization: "Default Organization",
|
12
|
-
location: "Default Location",
|
13
|
-
hostgroups: {
|
14
|
-
"1": "centos7"
|
15
|
-
},
|
16
|
-
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
17
10
|
mode: "editDefinition",
|
18
|
-
|
11
|
+
serviceDefinition: {
|
19
12
|
id: 1,
|
20
13
|
name: "Test123",
|
21
14
|
hostgroup_id: 1
|
@@ -82,21 +75,19 @@ export const editDefinition = {
|
|
82
75
|
|
83
76
|
export const newInstance = {
|
84
77
|
mode: "newInstance",
|
85
|
-
organization: "Default Organization",
|
86
|
-
location: "Default Location",
|
87
78
|
applications: {
|
88
79
|
"1": "Test123",
|
89
80
|
"2": "sowasvonneu"
|
90
81
|
},
|
91
|
-
|
92
|
-
|
82
|
+
serviceDefinition: {
|
83
|
+
id: 1,
|
84
|
+
name: "Test123",
|
85
|
+
hostgroup_id: 1
|
86
|
+
},
|
93
87
|
};
|
94
88
|
export const editInstance = {
|
95
89
|
mode: "editInstance",
|
96
|
-
|
97
|
-
location: "Default Location",
|
98
|
-
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
99
|
-
appDefinition: {
|
90
|
+
serviceDefinition: {
|
100
91
|
id: 1,
|
101
92
|
name: "Test123",
|
102
93
|
hostgroup_id: 1
|
data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js
CHANGED
@@ -13,9 +13,9 @@ export const successState = Immutable(parameterSelectionData_1);
|
|
13
13
|
|
14
14
|
const EDIT_ROW_ID = 5;
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
editClone["
|
16
|
+
const editClone = parameterSelectionData_1;
|
17
|
+
const editIndex = findIndex(editClone.parameters, { id: EDIT_ROW_ID })
|
18
|
+
editClone["parameters"][editIndex].backup = cloneDeep(editClone["parameters"][editIndex]);
|
19
19
|
export const editState = Immutable(editClone);
|
20
20
|
|
21
21
|
export const initParameterSelectionPayload = parameterSelectionData_1;
|
@@ -83,45 +83,3 @@ export const loadForemanDataSuccessPayload = {
|
|
83
83
|
export const loadForemanDataFailurePayload = {
|
84
84
|
error: "Something really bad happend",
|
85
85
|
};
|
86
|
-
|
87
|
-
export const loadParameterSelectionRequestPayload = { };
|
88
|
-
export const loadParameterSelectionSuccessPayload = {
|
89
|
-
app_definition: {
|
90
|
-
id: 2,
|
91
|
-
name: "sowasvonneu",
|
92
|
-
description: "",
|
93
|
-
hostgroup_id: 1,
|
94
|
-
parameters: "[{\"id\":0,\"name\":\"richtigneu\",\"description\":\"\",\"type\":\"puppetenv\",\"value\":\"1\"},{\"id\":1,\"name\":\"ganzgut\",\"description\":\"\",\"type\":\"ip\",\"value\":\"1.1.1.2\"}]",
|
95
|
-
created_at: "2019-11-13 17:47:27 +0100",
|
96
|
-
updated_at: "2019-11-13 17:47:27 +0100"
|
97
|
-
},
|
98
|
-
fdata: {
|
99
|
-
hostgroup_id: 1,
|
100
|
-
environments: [
|
101
|
-
{
|
102
|
-
id: 1,
|
103
|
-
name: "production"
|
104
|
-
},
|
105
|
-
{
|
106
|
-
id: 2,
|
107
|
-
name: "test"
|
108
|
-
}
|
109
|
-
],
|
110
|
-
lifecycle_environments: [],
|
111
|
-
domains: [],
|
112
|
-
computeprofiles: [],
|
113
|
-
ptables: [
|
114
|
-
{
|
115
|
-
id: 105,
|
116
|
-
name: "Kickstart default"
|
117
|
-
},
|
118
|
-
{
|
119
|
-
id: 104,
|
120
|
-
name: "Kickstart default thin"
|
121
|
-
}
|
122
|
-
]
|
123
|
-
}
|
124
|
-
};
|
125
|
-
export const loadParameterSelectionFailurePayload = {
|
126
|
-
error: "Something really bad happend",
|
127
|
-
};
|
@@ -15,32 +15,52 @@ const noop = () => {};
|
|
15
15
|
|
16
16
|
const fixtures = {
|
17
17
|
'should render newDefinition': {
|
18
|
+
location: "Default Location",
|
19
|
+
organization: "Default Organization",
|
20
|
+
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
18
21
|
loading: false,
|
19
22
|
data: newDefinition,
|
20
23
|
error: { statusText: '', errorMsg: '' },
|
21
24
|
initParameterSelection: noop,
|
22
25
|
loadForemanData: noop,
|
26
|
+
addParameter: noop,
|
27
|
+
deleteParameter: noop,
|
23
28
|
},
|
24
29
|
'should render editDefinition': {
|
30
|
+
location: "Default Location",
|
31
|
+
organization: "Default Organization",
|
32
|
+
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
25
33
|
loading: false,
|
26
34
|
data: editDefinition,
|
27
35
|
error: { statusText: '', errorMsg: '' },
|
28
36
|
initParameterSelection: noop,
|
29
37
|
loadForemanData: noop,
|
38
|
+
addParameter: noop,
|
39
|
+
deleteParameter: noop,
|
30
40
|
},
|
31
41
|
'should render newInstance': {
|
42
|
+
location: "Default Location",
|
43
|
+
organization: "Default Organization",
|
32
44
|
loading: false,
|
45
|
+
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
33
46
|
data: newInstance,
|
34
47
|
error: { statusText: '', errorMsg: '' },
|
35
48
|
initParameterSelection: noop,
|
36
49
|
loadForemanData: noop,
|
50
|
+
addParameter: noop,
|
51
|
+
deleteParameter: noop,
|
37
52
|
},
|
38
53
|
'should render editInstance': {
|
54
|
+
location: "Default Location",
|
55
|
+
organization: "Default Organization",
|
39
56
|
loading: false,
|
57
|
+
loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
|
40
58
|
data: editInstance,
|
41
59
|
error: { statusText: '', errorMsg: '' },
|
42
60
|
initParameterSelection: noop,
|
43
61
|
loadForemanData: noop,
|
62
|
+
addParameter: noop,
|
63
|
+
deleteParameter: noop,
|
44
64
|
},
|
45
65
|
};
|
46
66
|
|