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
@@ -0,0 +1,288 @@
|
|
1
|
+
export const applicationDefinitionConfData_1 = {
|
2
|
+
name: false,
|
3
|
+
error: {
|
4
|
+
errorMsg: '',
|
5
|
+
status: '',
|
6
|
+
statusText: ''
|
7
|
+
},
|
8
|
+
columns: [
|
9
|
+
{
|
10
|
+
property: 'name',
|
11
|
+
header: {
|
12
|
+
label: 'Name',
|
13
|
+
formatters: [
|
14
|
+
null
|
15
|
+
],
|
16
|
+
props: {
|
17
|
+
index: 0,
|
18
|
+
style: {
|
19
|
+
width: '15%'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
cell: {
|
24
|
+
formatters: [
|
25
|
+
null
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
property: 'description',
|
31
|
+
header: {
|
32
|
+
label: 'Description',
|
33
|
+
formatters: [
|
34
|
+
null
|
35
|
+
],
|
36
|
+
props: {
|
37
|
+
index: 1,
|
38
|
+
style: {
|
39
|
+
width: '10%'
|
40
|
+
}
|
41
|
+
}
|
42
|
+
},
|
43
|
+
cell: {
|
44
|
+
formatters: [
|
45
|
+
null
|
46
|
+
]
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
property: 'hostgroup',
|
51
|
+
header: {
|
52
|
+
label: 'Hostgroup',
|
53
|
+
formatters: [
|
54
|
+
null
|
55
|
+
],
|
56
|
+
props: {
|
57
|
+
index: 2,
|
58
|
+
style: {
|
59
|
+
width: '20%'
|
60
|
+
}
|
61
|
+
}
|
62
|
+
},
|
63
|
+
cell: {
|
64
|
+
formatters: [
|
65
|
+
null
|
66
|
+
]
|
67
|
+
}
|
68
|
+
},
|
69
|
+
{
|
70
|
+
property: 'ansibleGroup',
|
71
|
+
header: {
|
72
|
+
label: 'Ansible Group',
|
73
|
+
formatters: [
|
74
|
+
null
|
75
|
+
],
|
76
|
+
props: {
|
77
|
+
index: 3,
|
78
|
+
style: {
|
79
|
+
width: '20%'
|
80
|
+
}
|
81
|
+
}
|
82
|
+
},
|
83
|
+
cell: {
|
84
|
+
formatters: [
|
85
|
+
null
|
86
|
+
]
|
87
|
+
}
|
88
|
+
},
|
89
|
+
{
|
90
|
+
property: 'minCount',
|
91
|
+
header: {
|
92
|
+
label: 'min count',
|
93
|
+
formatters: [
|
94
|
+
null
|
95
|
+
],
|
96
|
+
props: {
|
97
|
+
index: 4,
|
98
|
+
style: {
|
99
|
+
width: '10%'
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
cell: {
|
104
|
+
formatters: [
|
105
|
+
null
|
106
|
+
]
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
property: 'maxCount',
|
111
|
+
header: {
|
112
|
+
label: 'max count',
|
113
|
+
formatters: [
|
114
|
+
null
|
115
|
+
],
|
116
|
+
props: {
|
117
|
+
index: 5,
|
118
|
+
style: {
|
119
|
+
width: '10%'
|
120
|
+
}
|
121
|
+
}
|
122
|
+
},
|
123
|
+
cell: {
|
124
|
+
formatters: [
|
125
|
+
null
|
126
|
+
]
|
127
|
+
}
|
128
|
+
},
|
129
|
+
{
|
130
|
+
property: 'actions',
|
131
|
+
header: {
|
132
|
+
label: 'Actions',
|
133
|
+
formatters: [
|
134
|
+
null
|
135
|
+
],
|
136
|
+
props: {
|
137
|
+
index: 6,
|
138
|
+
style: {
|
139
|
+
width: '15%'
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
143
|
+
cell: {
|
144
|
+
formatters: [
|
145
|
+
null
|
146
|
+
]
|
147
|
+
}
|
148
|
+
}
|
149
|
+
],
|
150
|
+
ansiblePlaybook: {
|
151
|
+
id: 2,
|
152
|
+
name: 'LAMP',
|
153
|
+
groups: {
|
154
|
+
webservers: [
|
155
|
+
{
|
156
|
+
id: 0,
|
157
|
+
name: 'dummy_var',
|
158
|
+
value: '0'
|
159
|
+
}
|
160
|
+
],
|
161
|
+
dbservers: [
|
162
|
+
{
|
163
|
+
id: 0,
|
164
|
+
name: 'mysqlservice',
|
165
|
+
value: 'mysqld'
|
166
|
+
},
|
167
|
+
{
|
168
|
+
id: 1,
|
169
|
+
name: 'mysql_port',
|
170
|
+
value: '3306'
|
171
|
+
},
|
172
|
+
{
|
173
|
+
id: 2,
|
174
|
+
name: 'dbuser',
|
175
|
+
value: 'webapp'
|
176
|
+
},
|
177
|
+
{
|
178
|
+
id: 3,
|
179
|
+
name: 'dbname',
|
180
|
+
value: 'ANSAP01'
|
181
|
+
},
|
182
|
+
{
|
183
|
+
id: 4,
|
184
|
+
name: 'upassword',
|
185
|
+
value: 'Bond@007'
|
186
|
+
},
|
187
|
+
{
|
188
|
+
id: 5,
|
189
|
+
name: 'masterpassword',
|
190
|
+
value: 'MySQL@007'
|
191
|
+
}
|
192
|
+
],
|
193
|
+
all: [
|
194
|
+
{
|
195
|
+
id: 0,
|
196
|
+
name: 'repository',
|
197
|
+
value: 'https://github.com/bennojoy/mywebapp.git'
|
198
|
+
}
|
199
|
+
]
|
200
|
+
}
|
201
|
+
},
|
202
|
+
services: [
|
203
|
+
{
|
204
|
+
id: 1,
|
205
|
+
name: 'web',
|
206
|
+
description: '',
|
207
|
+
hostgroup: '1',
|
208
|
+
ansibleGroup: 'webservers',
|
209
|
+
minCount: '2',
|
210
|
+
maxCount: '',
|
211
|
+
foremanParameters: [
|
212
|
+
{
|
213
|
+
id: 1,
|
214
|
+
locked: false,
|
215
|
+
name: 'CP',
|
216
|
+
description: '',
|
217
|
+
type: 'computeprofile',
|
218
|
+
value: '1'
|
219
|
+
},
|
220
|
+
{
|
221
|
+
id: 2,
|
222
|
+
locked: true,
|
223
|
+
name: 'LE',
|
224
|
+
description: '',
|
225
|
+
type: 'lifecycleenv',
|
226
|
+
value: '1'
|
227
|
+
}
|
228
|
+
],
|
229
|
+
ansibleParameters: [
|
230
|
+
{
|
231
|
+
id: 0,
|
232
|
+
name: 'dummy_var',
|
233
|
+
value: '0'
|
234
|
+
}
|
235
|
+
]
|
236
|
+
},
|
237
|
+
{
|
238
|
+
id: 2,
|
239
|
+
name: 'db',
|
240
|
+
description: '',
|
241
|
+
hostgroup: '1',
|
242
|
+
ansibleGroup: 'dbservers',
|
243
|
+
minCount: '1',
|
244
|
+
maxCount: '',
|
245
|
+
foremanParameters: [],
|
246
|
+
ansibleParameters: [
|
247
|
+
{
|
248
|
+
id: 0,
|
249
|
+
name: 'mysqlservice',
|
250
|
+
value: 'mysqld'
|
251
|
+
},
|
252
|
+
{
|
253
|
+
id: 1,
|
254
|
+
name: 'mysql_port',
|
255
|
+
value: '3306',
|
256
|
+
locked: true
|
257
|
+
},
|
258
|
+
{
|
259
|
+
id: 2,
|
260
|
+
name: 'dbuser',
|
261
|
+
value: 'webapp'
|
262
|
+
},
|
263
|
+
{
|
264
|
+
id: 3,
|
265
|
+
name: 'dbname',
|
266
|
+
value: 'ANSAP01'
|
267
|
+
},
|
268
|
+
{
|
269
|
+
id: 4,
|
270
|
+
name: 'upassword',
|
271
|
+
value: 'Bond@007'
|
272
|
+
},
|
273
|
+
{
|
274
|
+
id: 5,
|
275
|
+
name: 'masterpassword',
|
276
|
+
value: 'MySQL@007'
|
277
|
+
}
|
278
|
+
]
|
279
|
+
}
|
280
|
+
],
|
281
|
+
ansibleVarsAll: [
|
282
|
+
{
|
283
|
+
id: 0,
|
284
|
+
name: 'repository',
|
285
|
+
value: 'https://github.com/bennojoy/mywebapp.git'
|
286
|
+
}
|
287
|
+
]
|
288
|
+
}
|
data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
import Immutable from 'seamless-immutable';
|
2
|
+
import {
|
3
|
+
cloneDeep,
|
4
|
+
findIndex,
|
5
|
+
findLastIndex,
|
6
|
+
} from 'lodash';
|
7
|
+
|
8
|
+
import {
|
9
|
+
applicationDefinitionConfData_1,
|
10
|
+
} from '../__fixtures__/applicationDefinitionConfData_1.fixtures';
|
11
|
+
|
12
|
+
export const successState = Immutable(applicationDefinitionConfData_1);
|
13
|
+
|
14
|
+
const EDIT_ROW_ID = 2;
|
15
|
+
|
16
|
+
const editClone = applicationDefinitionConfData_1;
|
17
|
+
const editIndex = findIndex(editClone.services, { id: EDIT_ROW_ID })
|
18
|
+
editClone["services"][editIndex].backup = cloneDeep(editClone["services"][editIndex]);
|
19
|
+
export const editState = Immutable(editClone);
|
20
|
+
|
21
|
+
// Payload Data
|
22
|
+
export const initApplicationDefinitionPayload = applicationDefinitionConfData_1;
|
23
|
+
export const addServicePayload = { };
|
24
|
+
export const deleteServicePayload = {
|
25
|
+
rowData: {
|
26
|
+
id: EDIT_ROW_ID,
|
27
|
+
},
|
28
|
+
};
|
29
|
+
export const activateEditServicePayload = {
|
30
|
+
rowData: {
|
31
|
+
id: EDIT_ROW_ID,
|
32
|
+
},
|
33
|
+
};
|
34
|
+
export const confirmEditServicePayload = {
|
35
|
+
rowData: {
|
36
|
+
id: EDIT_ROW_ID,
|
37
|
+
},
|
38
|
+
};
|
39
|
+
export const cancelEditServicePayload = {
|
40
|
+
rowData: {
|
41
|
+
id: EDIT_ROW_ID,
|
42
|
+
},
|
43
|
+
};
|
44
|
+
export const changeEditServicePayload = {
|
45
|
+
value: "helloworld",
|
46
|
+
property: "name",
|
47
|
+
rowData: {
|
48
|
+
id: EDIT_ROW_ID,
|
49
|
+
}
|
50
|
+
};
|
51
|
+
|
52
|
+
export const loadAnsibleDataRequestPayload = {
|
53
|
+
clearRows: false,
|
54
|
+
};
|
55
|
+
|
56
|
+
export const loadAnsibleDataSuccessPayload = {
|
57
|
+
id: 2,
|
58
|
+
name: "LAMP",
|
59
|
+
groups: {
|
60
|
+
webservers: {
|
61
|
+
dummy_var: "0"
|
62
|
+
},
|
63
|
+
dbservers: {
|
64
|
+
mysqlservice: "mysqld",
|
65
|
+
mysql_port: "3306",
|
66
|
+
dbuser: "webapp",
|
67
|
+
dbname: "ANSAP01",
|
68
|
+
upassword: "Bond@007",
|
69
|
+
masterpassword: "MySQL@007"
|
70
|
+
},
|
71
|
+
all: {
|
72
|
+
repository: "https://github.com/bennojoy/mywebapp.git"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
export const loadAnsibleDataFailurePayload = {
|
78
|
+
error: "Something really bad happend",
|
79
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import ApplicationDefinition from '../ApplicationDefinition';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render application definition': {
|
9
|
+
data: {
|
10
|
+
location: "Default Location",
|
11
|
+
organization: "Default Organization",
|
12
|
+
hostgroups: [],
|
13
|
+
foremanDataUrl: "url/does/not/exist",
|
14
|
+
ansibleDataUrl: "url/does/not/exist",
|
15
|
+
services: [],
|
16
|
+
ansibleVarsAll: [],
|
17
|
+
},
|
18
|
+
closeAlertModal: noop,
|
19
|
+
loadAnsibleData: noop,
|
20
|
+
initApplicationDefinition: noop,
|
21
|
+
addApplicationDefinitionService: noop,
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
describe('ApplicationDefinition', () =>
|
26
|
+
testComponentSnapshotsWithFixtures(ApplicationDefinition, fixtures));
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
|
+
import reducer, { initialState } from '../ApplicationDefinitionReducer';
|
3
|
+
|
4
|
+
import {
|
5
|
+
successState,
|
6
|
+
editState,
|
7
|
+
initApplicationDefinitionPayload,
|
8
|
+
addServicePayload,
|
9
|
+
deleteServicePayload,
|
10
|
+
activateEditServicePayload,
|
11
|
+
confirmEditServicePayload,
|
12
|
+
cancelEditServicePayload,
|
13
|
+
changeEditServicePayload,
|
14
|
+
loadAnsibleDataRequestPayload,
|
15
|
+
loadAnsibleDataSuccessPayload,
|
16
|
+
loadAnsibleDataFailurePayload,
|
17
|
+
} from '../__fixtures__/applicationDefinitionReducer.fixtures';
|
18
|
+
|
19
|
+
import {
|
20
|
+
APPLICATION_DEFINITION_INIT,
|
21
|
+
APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_REQUEST,
|
22
|
+
APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_SUCCESS,
|
23
|
+
APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_FAILURE,
|
24
|
+
APPLICATION_DEFINITION_SERVICE_DELETE,
|
25
|
+
APPLICATION_DEFINITION_SERVICE_ADD,
|
26
|
+
APPLICATION_DEFINITION_SERVICE_EDIT_ACTIVATE,
|
27
|
+
APPLICATION_DEFINITION_SERVICE_EDIT_CONFIRM,
|
28
|
+
APPLICATION_DEFINITION_SERVICE_EDIT_CHANGE,
|
29
|
+
APPLICATION_DEFINITION_SERVICE_EDIT_CANCEL,
|
30
|
+
APPLICATION_DEFINITION_FOREMAN_PARAMETER_SELECTION_MODAL_OPEN,
|
31
|
+
APPLICATION_DEFINITION_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
|
32
|
+
APPLICATION_DEFINITION_ANSIBLE_PARAMETER_SELECTION_MODAL_OPEN,
|
33
|
+
APPLICATION_DEFINITION_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
|
34
|
+
APPLICATION_DEFINITION_CHANGE_PARAMETER_SELECTION_MODE,
|
35
|
+
} from '../ApplicationDefinitionConstants';
|
36
|
+
|
37
|
+
const fixtures = {
|
38
|
+
'should return initial state': {
|
39
|
+
state: initialState,
|
40
|
+
action: {
|
41
|
+
type: undefined,
|
42
|
+
payload: {},
|
43
|
+
},
|
44
|
+
},
|
45
|
+
|
46
|
+
'should initialize component': {
|
47
|
+
state: initialState,
|
48
|
+
action: {
|
49
|
+
type: APPLICATION_DEFINITION_INIT,
|
50
|
+
payload: initApplicationDefinitionPayload,
|
51
|
+
},
|
52
|
+
},
|
53
|
+
'should add a service': {
|
54
|
+
state: successState,
|
55
|
+
action: {
|
56
|
+
type: APPLICATION_DEFINITION_SERVICE_ADD,
|
57
|
+
payload: addServicePayload,
|
58
|
+
},
|
59
|
+
},
|
60
|
+
'should delete a service': {
|
61
|
+
state: successState,
|
62
|
+
action: {
|
63
|
+
type: APPLICATION_DEFINITION_SERVICE_DELETE,
|
64
|
+
payload: deleteServicePayload,
|
65
|
+
},
|
66
|
+
},
|
67
|
+
'should activate edit service': {
|
68
|
+
state: successState,
|
69
|
+
action: {
|
70
|
+
type: APPLICATION_DEFINITION_SERVICE_EDIT_ACTIVATE,
|
71
|
+
payload: activateEditServicePayload,
|
72
|
+
},
|
73
|
+
},
|
74
|
+
'should change edit service': {
|
75
|
+
state: editState,
|
76
|
+
action: {
|
77
|
+
type: APPLICATION_DEFINITION_SERVICE_EDIT_CHANGE,
|
78
|
+
payload: changeEditServicePayload,
|
79
|
+
},
|
80
|
+
},
|
81
|
+
'should confirm edit service': {
|
82
|
+
state: editState,
|
83
|
+
action: {
|
84
|
+
type: APPLICATION_DEFINITION_SERVICE_EDIT_CONFIRM,
|
85
|
+
payload: confirmEditServicePayload,
|
86
|
+
},
|
87
|
+
},
|
88
|
+
'should cancel edit service': {
|
89
|
+
state: editState,
|
90
|
+
action: {
|
91
|
+
type: APPLICATION_DEFINITION_SERVICE_EDIT_CANCEL,
|
92
|
+
payload: cancelEditServicePayload,
|
93
|
+
},
|
94
|
+
},
|
95
|
+
'should request load param data': {
|
96
|
+
state: successState,
|
97
|
+
action: {
|
98
|
+
type: APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_REQUEST,
|
99
|
+
payload: loadAnsibleDataRequestPayload,
|
100
|
+
},
|
101
|
+
},
|
102
|
+
'should load param data be successful': {
|
103
|
+
state: successState,
|
104
|
+
action: {
|
105
|
+
type: APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_SUCCESS,
|
106
|
+
payload: loadAnsibleDataSuccessPayload,
|
107
|
+
},
|
108
|
+
},
|
109
|
+
'should load param data be erroneous': {
|
110
|
+
state: successState,
|
111
|
+
action: {
|
112
|
+
type: APPLICATION_DEFINITION_LOAD_ANSIBLE_DATA_FAILURE,
|
113
|
+
payload: loadAnsibleDataFailurePayload,
|
114
|
+
},
|
115
|
+
},
|
116
|
+
};
|
117
|
+
|
118
|
+
describe('ApplicationDefintionReducer', () =>
|
119
|
+
testReducerSnapshotWithFixtures(reducer, fixtures));
|
data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import {
|
4
|
+
selectEditMode,
|
5
|
+
selectAnsiblePlaybook,
|
6
|
+
selectServices,
|
7
|
+
selectColumns,
|
8
|
+
selectParametersData,
|
9
|
+
selectAnsibleVarsAll,
|
10
|
+
selectParamEditMode,
|
11
|
+
} from '../ApplicationDefinitionSelectors';
|
12
|
+
|
13
|
+
import {
|
14
|
+
applicationDefinitionConfData_1,
|
15
|
+
} from '../__fixtures__/applicationDefinitionConfData_1.fixtures';
|
16
|
+
|
17
|
+
const stateFactory = obj => ({
|
18
|
+
foremanAcd: {
|
19
|
+
applicationDefinitionConf: obj,
|
20
|
+
},
|
21
|
+
});
|
22
|
+
|
23
|
+
const fixtures = {
|
24
|
+
'should return editMode from applicationDefinitionConfData_1 fixtures': () =>
|
25
|
+
selectEditMode(stateFactory(applicationDefinitionConfData_1)),
|
26
|
+
'should return ansiblePlaybook from applicationDefinitionConfData_1 fixtures': () =>
|
27
|
+
selectAnsiblePlaybook(stateFactory(applicationDefinitionConfData_1)),
|
28
|
+
'should return services from applicationDefinitionConfData_1 fixtures': () =>
|
29
|
+
selectServices(stateFactory(applicationDefinitionConfData_1)),
|
30
|
+
'should return parametersData from applicationDefinitionConfData_1 fixtures': () =>
|
31
|
+
selectParametersData(stateFactory(applicationDefinitionConfData_1)),
|
32
|
+
'should return columns from applicationDefinitionConfData_1 fixtures': () =>
|
33
|
+
selectColumns(stateFactory(applicationDefinitionConfData_1)),
|
34
|
+
'should return ansibleVarsAll from applicationDefinitionConfData_1 fixtures': () =>
|
35
|
+
selectAnsibleVarsAll(stateFactory(applicationDefinitionConfData_1)),
|
36
|
+
'should return ParamEditMode from applicationDefinitionConfData_1 fixtures': () =>
|
37
|
+
selectParamEditMode(stateFactory(applicationDefinitionConfData_1)),
|
38
|
+
};
|
39
|
+
|
40
|
+
describe('ApplicationDefinitionSelectors', () =>
|
41
|
+
testSelectorsSnapshotWithFixtures(fixtures));
|