foreman_acd 0.2.1 → 0.7.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 +199 -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 +1 -0
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +19 -10
- data/app/controllers/foreman_acd/app_instances_controller.rb +111 -137
- 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 +62 -0
- data/app/controllers/ui_acd_controller.rb +20 -3
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +47 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +44 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
- data/app/models/foreman_acd/acd_provider.rb +36 -0
- data/app/models/foreman_acd/ansible_playbook.rb +68 -0
- data/app/models/foreman_acd/app_definition.rb +25 -0
- 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/acd_proxy_proxy_selector.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +98 -0
- data/app/services/foreman_acd/app_deployer.rb +157 -0
- data/app/services/foreman_acd/inventory_creator.rb +68 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +64 -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 -12
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +4 -4
- data/app/views/foreman_acd/app_instances/_form.html.erb +11 -9
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +89 -10
- data/app/views/foreman_acd/app_instances/report.html.erb +6 -3
- 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 +32 -2
- 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/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/seeds.d/62_acd_proxy_feature.rb +4 -0
- data/db/seeds.d/75-job_templates.rb +13 -0
- data/lib/foreman_acd.rb +12 -0
- data/lib/foreman_acd/engine.rb +43 -3
- data/lib/foreman_acd/plugin.rb +88 -22
- data/lib/foreman_acd/version.rb +1 -1
- 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/locale/en/foreman_acd.po.time_stamp +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/package.json +9 -9
- 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.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 +159 -29
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +106 -14
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +8 -2
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +143 -21
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +3 -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 +25 -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 +200 -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 +50 -0
- 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 +6 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +151 -44
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +47 -10
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +5 -2
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -28
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +3 -1
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +78 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +23 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +119 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +44 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +209 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2719 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +276 -0
- data/webpack/components/ApplicationInstance/components/Service.js +1 -1
- data/webpack/components/ApplicationInstance/index.js +4 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +53 -60
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +17 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +7 -51
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -4
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +4 -18
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +0 -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 +130 -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 +0 -2
- data/webpack/components/ParameterSelection/ParameterSelection.js +85 -50
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +68 -62
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +6 -3
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +0 -32
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +47 -35
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -2
- 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 +31 -25
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +2 -126
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1483 -872
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +117 -79
- data/webpack/components/ParameterSelection/index.js +4 -4
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +210 -0
- data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +124 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +9 -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 +30 -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 +46 -0
- data/webpack/components/SyncGitRepo/index.js +28 -0
- data/webpack/components/common/DeleteTableEntry.js +3 -3
- 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 +2 -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 +15 -1
- data/webpack/helper.test.js +37 -0
- data/webpack/index.js +2 -0
- data/webpack/reducer.js +18 -11
- metadata +184 -10
- data/app/views/foreman_acd/app_instances/deploy.html.erb +0 -19
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
@@ -1,27 +1,58 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
+
exports[`ParameterSelectionSelectors should return ParamDefinition from parameterSelectionData_1 fixtures 1`] = `
|
4
|
+
Object {
|
5
|
+
"dataId": "1",
|
6
|
+
"id": 1,
|
7
|
+
"name": "web",
|
8
|
+
}
|
9
|
+
`;
|
10
|
+
|
3
11
|
exports[`ParameterSelectionSelectors should return columns from parameterSelectionData_1 fixtures 1`] = `
|
4
12
|
Array [
|
5
13
|
Object {
|
14
|
+
"cell": Object {
|
15
|
+
"formatters": Array [
|
16
|
+
null,
|
17
|
+
],
|
18
|
+
},
|
6
19
|
"header": Object {
|
20
|
+
"customFormatters": Array [
|
21
|
+
null,
|
22
|
+
],
|
23
|
+
"formatters": Array [
|
24
|
+
null,
|
25
|
+
],
|
7
26
|
"label": "Name",
|
8
27
|
"props": Object {
|
9
28
|
"index": 0,
|
10
29
|
"sort": true,
|
11
30
|
"style": Object {
|
12
|
-
"width": "
|
31
|
+
"width": "25%",
|
13
32
|
},
|
14
33
|
},
|
34
|
+
"transforms": Array [
|
35
|
+
null,
|
36
|
+
],
|
15
37
|
},
|
16
38
|
"property": "name",
|
17
39
|
},
|
18
40
|
Object {
|
19
41
|
"cell": Object {
|
42
|
+
"formatters": Array [
|
43
|
+
null,
|
44
|
+
],
|
20
45
|
"props": Object {
|
21
46
|
"index": 1,
|
22
47
|
},
|
23
48
|
},
|
24
49
|
"header": Object {
|
50
|
+
"customFormatters": Array [
|
51
|
+
null,
|
52
|
+
],
|
53
|
+
"formatters": Array [
|
54
|
+
null,
|
55
|
+
],
|
25
56
|
"label": "Description",
|
26
57
|
"props": Object {
|
27
58
|
"index": 1,
|
@@ -30,16 +61,25 @@ Array [
|
|
30
61
|
"width": "25%",
|
31
62
|
},
|
32
63
|
},
|
64
|
+
"transforms": Array [
|
65
|
+
null,
|
66
|
+
],
|
33
67
|
},
|
34
68
|
"property": "description",
|
35
69
|
},
|
36
70
|
Object {
|
37
71
|
"cell": Object {
|
38
|
-
"
|
39
|
-
|
40
|
-
|
72
|
+
"formatters": Array [
|
73
|
+
null,
|
74
|
+
],
|
41
75
|
},
|
42
76
|
"header": Object {
|
77
|
+
"customFormatters": Array [
|
78
|
+
null,
|
79
|
+
],
|
80
|
+
"formatters": Array [
|
81
|
+
null,
|
82
|
+
],
|
43
83
|
"label": "Type",
|
44
84
|
"props": Object {
|
45
85
|
"index": 2,
|
@@ -48,37 +88,55 @@ Array [
|
|
48
88
|
"width": "20%",
|
49
89
|
},
|
50
90
|
},
|
91
|
+
"transforms": Array [
|
92
|
+
null,
|
93
|
+
],
|
51
94
|
},
|
52
95
|
"property": "type",
|
53
96
|
},
|
54
97
|
Object {
|
55
98
|
"cell": Object {
|
56
|
-
"
|
57
|
-
|
58
|
-
|
99
|
+
"formatters": Array [
|
100
|
+
null,
|
101
|
+
],
|
59
102
|
},
|
60
103
|
"header": Object {
|
104
|
+
"customFormatters": Array [
|
105
|
+
null,
|
106
|
+
],
|
107
|
+
"formatters": Array [
|
108
|
+
null,
|
109
|
+
],
|
61
110
|
"label": "Default value",
|
62
111
|
"props": Object {
|
63
112
|
"index": 3,
|
64
113
|
"sort": true,
|
65
114
|
"style": Object {
|
66
|
-
"width": "
|
115
|
+
"width": "20%",
|
67
116
|
},
|
68
117
|
},
|
118
|
+
"transforms": Array [
|
119
|
+
null,
|
120
|
+
],
|
69
121
|
},
|
70
122
|
"property": "value",
|
71
123
|
},
|
72
124
|
Object {
|
73
125
|
"cell": Object {
|
74
|
-
"
|
75
|
-
|
76
|
-
|
126
|
+
"formatters": Array [
|
127
|
+
null,
|
128
|
+
],
|
77
129
|
},
|
78
130
|
"header": Object {
|
131
|
+
"formatters": Array [
|
132
|
+
null,
|
133
|
+
],
|
79
134
|
"label": "Actions",
|
80
135
|
"props": Object {
|
81
136
|
"index": 4,
|
137
|
+
"style": Object {
|
138
|
+
"width": "10%",
|
139
|
+
},
|
82
140
|
},
|
83
141
|
},
|
84
142
|
"property": "actions",
|
@@ -88,45 +146,67 @@ Array [
|
|
88
146
|
|
89
147
|
exports[`ParameterSelectionSelectors should return editMode from parameterSelectionData_1 fixtures 1`] = `false`;
|
90
148
|
|
91
|
-
exports[`ParameterSelectionSelectors should return
|
149
|
+
exports[`ParameterSelectionSelectors should return hostgroupId from parameterSelectionData_1 fixtures 1`] = `1`;
|
150
|
+
|
151
|
+
exports[`ParameterSelectionSelectors should return loading from parameterSelectionData_1 fixtures 1`] = `false`;
|
152
|
+
|
153
|
+
exports[`ParameterSelectionSelectors should return paramData from parameterSelectionData_1 fixtures 1`] = `
|
92
154
|
Object {
|
93
|
-
"computeprofiles": Array [
|
94
|
-
"domains": Array [],
|
95
|
-
"environments": Array [
|
155
|
+
"computeprofiles": Array [
|
96
156
|
Object {
|
97
157
|
"id": 1,
|
98
|
-
"name": "
|
158
|
+
"name": "1-Small",
|
99
159
|
},
|
100
160
|
Object {
|
101
161
|
"id": 2,
|
102
|
-
"name": "
|
162
|
+
"name": "2-Medium",
|
163
|
+
},
|
164
|
+
Object {
|
165
|
+
"id": 3,
|
166
|
+
"name": "3-Large",
|
167
|
+
},
|
168
|
+
Object {
|
169
|
+
"id": 4,
|
170
|
+
"name": "Orchahosts-VM",
|
171
|
+
},
|
172
|
+
],
|
173
|
+
"dataType": "PARAMETER_SELECTION_PARAM_TYPE_FOREMAN",
|
174
|
+
"domains": Array [
|
175
|
+
Object {
|
176
|
+
"id": 1,
|
177
|
+
"name": "deploy3.dev.atix",
|
178
|
+
},
|
179
|
+
],
|
180
|
+
"environments": Array [
|
181
|
+
Object {
|
182
|
+
"id": 1,
|
183
|
+
"name": "production",
|
103
184
|
},
|
104
185
|
],
|
105
186
|
"hostgroup_id": 1,
|
106
|
-
"lifecycle_environments": Array [
|
107
|
-
"ptables": Array [
|
187
|
+
"lifecycle_environments": Array [
|
108
188
|
Object {
|
109
|
-
"id":
|
110
|
-
"name": "
|
189
|
+
"id": 1,
|
190
|
+
"name": "Library",
|
111
191
|
},
|
192
|
+
],
|
193
|
+
"ptables": Array [
|
112
194
|
Object {
|
113
|
-
"id":
|
114
|
-
"name": "Kickstart default
|
195
|
+
"id": 125,
|
196
|
+
"name": "Kickstart default",
|
115
197
|
},
|
116
198
|
],
|
117
199
|
}
|
118
200
|
`;
|
119
201
|
|
120
|
-
exports[`ParameterSelectionSelectors should return hostgroupId from parameterSelectionData_1 fixtures 1`] = `1`;
|
121
|
-
|
122
|
-
exports[`ParameterSelectionSelectors should return loading from parameterSelectionData_1 fixtures 1`] = `false`;
|
123
|
-
|
124
202
|
exports[`ParameterSelectionSelectors should return parameterTypes from parameterSelectionData_1 fixtures 1`] = `
|
125
203
|
Object {
|
126
|
-
"computeprofile": "Compute profile",
|
127
204
|
"domain": "Domain",
|
128
205
|
"hostparam": "Host parameter",
|
129
|
-
"
|
206
|
+
"ip": "IP",
|
207
|
+
"password": "Root password",
|
208
|
+
"ptable": "Partition table",
|
209
|
+
"puppetenv": "Puppet environment",
|
130
210
|
}
|
131
211
|
`;
|
132
212
|
|
@@ -135,64 +215,22 @@ Array [
|
|
135
215
|
Object {
|
136
216
|
"description": "",
|
137
217
|
"id": 1,
|
138
|
-
"
|
139
|
-
"
|
140
|
-
"
|
218
|
+
"locked": false,
|
219
|
+
"name": "CP",
|
220
|
+
"type": "computeprofile",
|
221
|
+
"value": "1",
|
141
222
|
},
|
142
223
|
Object {
|
143
224
|
"description": "",
|
144
225
|
"id": 2,
|
145
|
-
"
|
146
|
-
"
|
147
|
-
"
|
148
|
-
|
149
|
-
Object {
|
150
|
-
"description": "",
|
151
|
-
"id": 3,
|
152
|
-
"name": "Blub",
|
153
|
-
"type": "hostparam",
|
154
|
-
"value": "awesome",
|
155
|
-
},
|
156
|
-
Object {
|
157
|
-
"description": "",
|
158
|
-
"id": 4,
|
159
|
-
"name": "111allo",
|
160
|
-
"type": "ip",
|
161
|
-
"value": "1.1.1.1",
|
162
|
-
},
|
163
|
-
Object {
|
164
|
-
"description": "",
|
165
|
-
"id": 5,
|
166
|
-
"name": "1111aasdfasf",
|
167
|
-
"type": "hostname",
|
168
|
-
"value": "dername",
|
169
|
-
},
|
170
|
-
Object {
|
171
|
-
"description": "",
|
172
|
-
"id": 6,
|
173
|
-
"name": "222nocheiner",
|
174
|
-
"type": "hostparam",
|
175
|
-
"value": "",
|
176
|
-
},
|
177
|
-
Object {
|
178
|
-
"description": "aa",
|
179
|
-
"id": 7,
|
180
|
-
"name": "aaaaa",
|
181
|
-
"type": "ptable",
|
182
|
-
"value": "",
|
183
|
-
},
|
184
|
-
Object {
|
185
|
-
"description": "",
|
186
|
-
"id": 8,
|
187
|
-
"name": "aaa",
|
188
|
-
"type": "hostparam",
|
189
|
-
"value": "2134234",
|
226
|
+
"locked": true,
|
227
|
+
"name": "LE",
|
228
|
+
"type": "lifecycleenv",
|
229
|
+
"value": "1",
|
190
230
|
},
|
191
231
|
]
|
192
232
|
`;
|
193
233
|
|
194
|
-
exports[`ParameterSelectionSelectors should return serviceDefinition from parameterSelectionData_1 fixtures 1`] = `undefined`;
|
195
|
-
|
196
234
|
exports[`ParameterSelectionSelectors should return sortingColumns from parameterSelectionData_1 fixtures 1`] = `
|
197
235
|
Object {
|
198
236
|
"name": Object {
|
@@ -8,23 +8,23 @@ import * as ParameterSelectionActions from './ParameterSelectionActions';
|
|
8
8
|
import {
|
9
9
|
selectLoading,
|
10
10
|
selectEditMode,
|
11
|
-
|
11
|
+
selectParamData,
|
12
12
|
selectParameterTypes,
|
13
13
|
selectParameters,
|
14
14
|
selectSortingColumns,
|
15
15
|
selectColumns,
|
16
|
-
|
16
|
+
selectParamDefinition,
|
17
17
|
} from './ParameterSelectionSelectors';
|
18
18
|
|
19
19
|
const mapStateToProps = state => ({
|
20
20
|
loading: selectLoading(state),
|
21
21
|
editMode: selectEditMode(state),
|
22
|
-
|
22
|
+
paramData: selectParamData(state),
|
23
23
|
parameterTypes: selectParameterTypes(state),
|
24
24
|
parameters: selectParameters(state),
|
25
25
|
sortingColumns: selectSortingColumns(state),
|
26
26
|
columns: selectColumns(state),
|
27
|
-
|
27
|
+
paramDefinition: selectParamDefinition(state),
|
28
28
|
});
|
29
29
|
|
30
30
|
const mapDispatchToProps = dispatch =>
|
@@ -0,0 +1,210 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {
|
4
|
+
Icon,
|
5
|
+
Button,
|
6
|
+
} from 'patternfly-react';
|
7
|
+
import {
|
8
|
+
sprintf,
|
9
|
+
translate as __
|
10
|
+
} from 'foremanReact/common/I18n';
|
11
|
+
import {Select, TextInput} from 'foremanReact/components/common/forms/Select';
|
12
|
+
import RailsData from '../common/RailsData';
|
13
|
+
import ScmTypeSelector from './components/ScmTypeSelector';
|
14
|
+
import FormTextInput from './components/FormTextInput'
|
15
|
+
import { arrayToObject } from '../../helper';
|
16
|
+
import CommonForm from 'foremanReact/components/common/forms/CommonForm';
|
17
|
+
import $ from 'jquery';
|
18
|
+
|
19
|
+
import {
|
20
|
+
FormControl,
|
21
|
+
inlineEditFormatterFactory,
|
22
|
+
} from 'patternfly-react';
|
23
|
+
|
24
|
+
class SyncGitRepo extends React.Component {
|
25
|
+
constructor(props) {
|
26
|
+
super(props);
|
27
|
+
}
|
28
|
+
|
29
|
+
validateParameters() {
|
30
|
+
let result = true;
|
31
|
+
let msg = "";
|
32
|
+
|
33
|
+
if (this.props.path === "" && this.props.scmType === 'directory') {
|
34
|
+
result = false;
|
35
|
+
|
36
|
+
if (msg == "") {
|
37
|
+
msg += __("Directory path cannot be blank");
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
if (this.props.scmType === 'git') {
|
42
|
+
if (this.props.gitUrl === "") {
|
43
|
+
result = false;
|
44
|
+
|
45
|
+
if (msg == "") {
|
46
|
+
msg += __("Git URL cannot be blank");
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
if (this.props.gitCommit === "") {
|
51
|
+
result = false;
|
52
|
+
|
53
|
+
if (msg == "") {
|
54
|
+
msg += __("Git Branch/Commit/Tag cannot be blank");
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
if (this.props.scmType !== "git" && this.props.scmType !== "directory" ) {
|
60
|
+
result = false;
|
61
|
+
|
62
|
+
if (msg == "") {
|
63
|
+
msg += __("SCM Type cannot be blank");
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
return {
|
68
|
+
validateResult: result,
|
69
|
+
validateMsg: msg
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
componentDidMount() {
|
74
|
+
const {
|
75
|
+
data: {mode, scmType, path, gitCommit, gitUrl, appDefinitions},
|
76
|
+
initSyncGitRepo,
|
77
|
+
loadScmType,
|
78
|
+
loadPath,
|
79
|
+
loadGitCommit,
|
80
|
+
loadGitUrl,
|
81
|
+
handleGitRepoSync,
|
82
|
+
} = this.props;
|
83
|
+
|
84
|
+
if (mode === 'editInstance') {
|
85
|
+
loadScmType(scmType);
|
86
|
+
loadPath(path);
|
87
|
+
loadGitCommit(gitCommit);
|
88
|
+
loadGitUrl(gitUrl);
|
89
|
+
handleGitRepoSync(this.props.scmType, this.props.path, this.props.gitCommit)
|
90
|
+
}
|
91
|
+
|
92
|
+
initSyncGitRepo(
|
93
|
+
scmType,
|
94
|
+
path,
|
95
|
+
gitCommit,
|
96
|
+
gitUrl,
|
97
|
+
);
|
98
|
+
};
|
99
|
+
|
100
|
+
render() {
|
101
|
+
const {
|
102
|
+
data: {mode, scmTypes, organization, location, appDefinitions},
|
103
|
+
scmType,
|
104
|
+
path,
|
105
|
+
gitCommit,
|
106
|
+
gitUrl,
|
107
|
+
loadScmType,
|
108
|
+
loadPath,
|
109
|
+
loadGitCommit,
|
110
|
+
loadGitUrl,
|
111
|
+
handleGitRepoSync,
|
112
|
+
} = this.props;
|
113
|
+
|
114
|
+
var url_validator = /^(ftp|http|https):\/\/[^ "]+$/;
|
115
|
+
|
116
|
+
let { validateResult, validateMsg } = this.validateParameters();
|
117
|
+
|
118
|
+
if (validateResult === false) {
|
119
|
+
$('input[type="submit"][name="commit"]').attr("disabled", true);
|
120
|
+
} else {
|
121
|
+
$('input[type="submit"][name="commit"]').attr("disabled", false);
|
122
|
+
}
|
123
|
+
|
124
|
+
return (
|
125
|
+
<span>
|
126
|
+
<div>
|
127
|
+
<ScmTypeSelector
|
128
|
+
label="SCM Type *"
|
129
|
+
editable={ appDefinitions.length == 0 }
|
130
|
+
viewText={ scmTypes[scmType] }
|
131
|
+
options={ scmTypes }
|
132
|
+
onChange={ loadScmType }
|
133
|
+
selectValue={ scmType }
|
134
|
+
/>
|
135
|
+
{(scmType === 'directory') ? (
|
136
|
+
<FormTextInput
|
137
|
+
label= 'Directory Path *'
|
138
|
+
editable= { appDefinitions.length == 0 }
|
139
|
+
viewText={ path }
|
140
|
+
onChange={ loadPath }
|
141
|
+
parameter="path"
|
142
|
+
/> ) : null }
|
143
|
+
{(scmType === 'git') ? (
|
144
|
+
<FormTextInput
|
145
|
+
label= 'Git Url *'
|
146
|
+
editable= { appDefinitions.length == 0 }
|
147
|
+
viewText={ gitUrl }
|
148
|
+
onChange={ loadGitUrl }
|
149
|
+
parameter="git_url"
|
150
|
+
/> ) : null }
|
151
|
+
{(!url_validator.test(gitUrl) && gitUrl)? (
|
152
|
+
<div className="form-group">
|
153
|
+
<div className="col-md-2"></div>
|
154
|
+
<div className="col-md-4"><pre>{ __("Git URL is wrong") }</pre></div>
|
155
|
+
</div>
|
156
|
+
) : (<div></div>)}
|
157
|
+
{validateResult == false ? (
|
158
|
+
<div className="form-group">
|
159
|
+
<div className="col-md-2"></div>
|
160
|
+
<div className="col-md-4"><pre>{validateMsg}</pre></div>
|
161
|
+
</div>
|
162
|
+
) : (<div></div>)}
|
163
|
+
{(scmType === "git") ? (
|
164
|
+
<FormTextInput
|
165
|
+
label="Git Branch/Commit/Tag *"
|
166
|
+
editable= { appDefinitions.length == 0 }
|
167
|
+
viewText={ gitCommit }
|
168
|
+
onChange={ loadGitCommit }
|
169
|
+
parameter="git_commit"
|
170
|
+
/> ) : null }
|
171
|
+
{(scmType === "git") ? (
|
172
|
+
<CommonForm>
|
173
|
+
<span className="help-block help-inline">
|
174
|
+
<Button
|
175
|
+
bsStyle="default"
|
176
|
+
onClick={ (e) => handleGitRepoSync(gitUrl, gitCommit, scmType, e) }
|
177
|
+
>
|
178
|
+
{__('Sync Repository')} </Button>
|
179
|
+
</span>
|
180
|
+
</CommonForm>
|
181
|
+
) : null }
|
182
|
+
|
183
|
+
</div>
|
184
|
+
</span>
|
185
|
+
)};
|
186
|
+
}
|
187
|
+
|
188
|
+
SyncGitRepo.defaultProps = {
|
189
|
+
error: {},
|
190
|
+
scmType: "",
|
191
|
+
path: "",
|
192
|
+
gitCommit: "",
|
193
|
+
gitUrl: "",
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
SyncGitRepo.propTypes = {
|
198
|
+
initSyncGitRepo: PropTypes.func,
|
199
|
+
loadScmType: PropTypes.func,
|
200
|
+
loadGitCommit: PropTypes.func,
|
201
|
+
loadPath: PropTypes.func,
|
202
|
+
loadGitUrl: PropTypes.func,
|
203
|
+
handleGitRepoSync: PropTypes.func,
|
204
|
+
scmType: PropTypes.string.isRequired,
|
205
|
+
path: PropTypes.string.isRequired,
|
206
|
+
gitCommit: PropTypes.string,
|
207
|
+
gitUrl: PropTypes.string,
|
208
|
+
};
|
209
|
+
|
210
|
+
export default SyncGitRepo;
|