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