foreman_acd 0.6.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +90 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
- data/app/controllers/foreman_acd/app_instances_controller.rb +34 -32
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
- data/app/controllers/foreman_acd/remote_execution_controller.rb +37 -21
- data/app/controllers/ui_acd_controller.rb +42 -3
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +12 -7
- data/app/lib/actions/foreman_acd/run_configurator.rb +11 -7
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +41 -28
- data/app/models/foreman_acd/acd_provider.rb +7 -1
- data/app/models/foreman_acd/ansible_playbook.rb +2 -1
- data/app/models/foreman_acd/app_instance.rb +48 -3
- data/app/models/foreman_acd/foreman_host.rb +8 -0
- data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +59 -15
- data/app/services/foreman_acd/app_deployer.rb +27 -4
- data/app/services/foreman_acd/inventory_creator.rb +25 -1
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +41 -7
- data/app/views/foreman_acd/app_definitions/_form.html.erb +5 -1
- data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
- data/app/views/foreman_acd/app_definitions/index.html.erb +3 -6
- data/app/views/foreman_acd/app_instances/_form.html.erb +5 -1
- data/app/views/foreman_acd/app_instances/index.html.erb +18 -12
- data/app/views/foreman_acd/app_instances/report.html.erb +8 -3
- data/app/views/templates/job/run_acd_ansible_playbook.erb +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 +6 -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/75-job_templates.rb +1 -1
- data/lib/foreman_acd/engine.rb +26 -4
- data/lib/foreman_acd/plugin.rb +9 -18
- 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/package.json +8 -22
- data/test/controllers/ansible_playbooks_controller_test.rb +1 -1
- data/test/controllers/app_instances_controller_test.rb +8 -3
- data/test/controllers/ui_acd_controller_test.rb +25 -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 +35 -11
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +12 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
- 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 +53 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +226 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +307 -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 +105 -31
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +118 -6
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +71 -30
- 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 +56 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +300 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2990 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +284 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
- 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 +81 -6
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +35 -1
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +3 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
- 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/__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 -1
- 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 +103 -1
- data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +46 -4
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +51 -29
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -0
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +124 -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 +12 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +84 -112
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1589 -878
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +130 -79
- data/webpack/components/ParameterSelection/index.js +4 -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 +16 -2
- data/webpack/components/common/ExtTextInput.js +43 -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 +35 -1
- data/webpack/helper.test.js +56 -0
- data/webpack/index.js +7 -0
- data/webpack/js-yaml.js +3874 -0
- data/webpack/reducer.js +16 -1
- data/webpack/test_setup.js +0 -2
- metadata +136 -11
- 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
@@ -1,27 +1,69 @@
|
|
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
|
+
|
11
|
+
exports[`ParameterSelectionSelectors should return allowedParameterTypes from parameterSelectionData_1 fixtures 1`] = `
|
12
|
+
Array [
|
13
|
+
"domain",
|
14
|
+
"hostparam",
|
15
|
+
"ip",
|
16
|
+
"ptable",
|
17
|
+
"puppetenv",
|
18
|
+
"password",
|
19
|
+
]
|
20
|
+
`;
|
21
|
+
|
3
22
|
exports[`ParameterSelectionSelectors should return columns from parameterSelectionData_1 fixtures 1`] = `
|
4
23
|
Array [
|
5
24
|
Object {
|
25
|
+
"cell": Object {
|
26
|
+
"formatters": Array [
|
27
|
+
null,
|
28
|
+
],
|
29
|
+
},
|
6
30
|
"header": Object {
|
31
|
+
"customFormatters": Array [
|
32
|
+
null,
|
33
|
+
],
|
34
|
+
"formatters": Array [
|
35
|
+
null,
|
36
|
+
],
|
7
37
|
"label": "Name",
|
8
38
|
"props": Object {
|
9
39
|
"index": 0,
|
10
40
|
"sort": true,
|
11
41
|
"style": Object {
|
12
|
-
"width": "
|
42
|
+
"width": "25%",
|
13
43
|
},
|
14
44
|
},
|
45
|
+
"transforms": Array [
|
46
|
+
null,
|
47
|
+
],
|
15
48
|
},
|
16
49
|
"property": "name",
|
17
50
|
},
|
18
51
|
Object {
|
19
52
|
"cell": Object {
|
53
|
+
"formatters": Array [
|
54
|
+
null,
|
55
|
+
],
|
20
56
|
"props": Object {
|
21
57
|
"index": 1,
|
22
58
|
},
|
23
59
|
},
|
24
60
|
"header": Object {
|
61
|
+
"customFormatters": Array [
|
62
|
+
null,
|
63
|
+
],
|
64
|
+
"formatters": Array [
|
65
|
+
null,
|
66
|
+
],
|
25
67
|
"label": "Description",
|
26
68
|
"props": Object {
|
27
69
|
"index": 1,
|
@@ -30,16 +72,25 @@ Array [
|
|
30
72
|
"width": "25%",
|
31
73
|
},
|
32
74
|
},
|
75
|
+
"transforms": Array [
|
76
|
+
null,
|
77
|
+
],
|
33
78
|
},
|
34
79
|
"property": "description",
|
35
80
|
},
|
36
81
|
Object {
|
37
82
|
"cell": Object {
|
38
|
-
"
|
39
|
-
|
40
|
-
|
83
|
+
"formatters": Array [
|
84
|
+
null,
|
85
|
+
],
|
41
86
|
},
|
42
87
|
"header": Object {
|
88
|
+
"customFormatters": Array [
|
89
|
+
null,
|
90
|
+
],
|
91
|
+
"formatters": Array [
|
92
|
+
null,
|
93
|
+
],
|
43
94
|
"label": "Type",
|
44
95
|
"props": Object {
|
45
96
|
"index": 2,
|
@@ -48,37 +99,55 @@ Array [
|
|
48
99
|
"width": "20%",
|
49
100
|
},
|
50
101
|
},
|
102
|
+
"transforms": Array [
|
103
|
+
null,
|
104
|
+
],
|
51
105
|
},
|
52
106
|
"property": "type",
|
53
107
|
},
|
54
108
|
Object {
|
55
109
|
"cell": Object {
|
56
|
-
"
|
57
|
-
|
58
|
-
|
110
|
+
"formatters": Array [
|
111
|
+
null,
|
112
|
+
],
|
59
113
|
},
|
60
114
|
"header": Object {
|
115
|
+
"customFormatters": Array [
|
116
|
+
null,
|
117
|
+
],
|
118
|
+
"formatters": Array [
|
119
|
+
null,
|
120
|
+
],
|
61
121
|
"label": "Default value",
|
62
122
|
"props": Object {
|
63
123
|
"index": 3,
|
64
124
|
"sort": true,
|
65
125
|
"style": Object {
|
66
|
-
"width": "
|
126
|
+
"width": "20%",
|
67
127
|
},
|
68
128
|
},
|
129
|
+
"transforms": Array [
|
130
|
+
null,
|
131
|
+
],
|
69
132
|
},
|
70
133
|
"property": "value",
|
71
134
|
},
|
72
135
|
Object {
|
73
136
|
"cell": Object {
|
74
|
-
"
|
75
|
-
|
76
|
-
|
137
|
+
"formatters": Array [
|
138
|
+
null,
|
139
|
+
],
|
77
140
|
},
|
78
141
|
"header": Object {
|
142
|
+
"formatters": Array [
|
143
|
+
null,
|
144
|
+
],
|
79
145
|
"label": "Actions",
|
80
146
|
"props": Object {
|
81
147
|
"index": 4,
|
148
|
+
"style": Object {
|
149
|
+
"width": "10%",
|
150
|
+
},
|
82
151
|
},
|
83
152
|
},
|
84
153
|
"property": "actions",
|
@@ -88,45 +157,69 @@ Array [
|
|
88
157
|
|
89
158
|
exports[`ParameterSelectionSelectors should return editMode from parameterSelectionData_1 fixtures 1`] = `false`;
|
90
159
|
|
91
|
-
exports[`ParameterSelectionSelectors should return
|
160
|
+
exports[`ParameterSelectionSelectors should return editParamsRowIndex from parameterSelectionData_1 fixtures 1`] = `undefined`;
|
161
|
+
|
162
|
+
exports[`ParameterSelectionSelectors should return hostgroupId from parameterSelectionData_1 fixtures 1`] = `1`;
|
163
|
+
|
164
|
+
exports[`ParameterSelectionSelectors should return loading from parameterSelectionData_1 fixtures 1`] = `false`;
|
165
|
+
|
166
|
+
exports[`ParameterSelectionSelectors should return paramData from parameterSelectionData_1 fixtures 1`] = `
|
92
167
|
Object {
|
93
|
-
"computeprofiles": Array [
|
94
|
-
"domains": Array [],
|
95
|
-
"environments": Array [
|
168
|
+
"computeprofiles": Array [
|
96
169
|
Object {
|
97
170
|
"id": 1,
|
98
|
-
"name": "
|
171
|
+
"name": "1-Small",
|
99
172
|
},
|
100
173
|
Object {
|
101
174
|
"id": 2,
|
102
|
-
"name": "
|
175
|
+
"name": "2-Medium",
|
176
|
+
},
|
177
|
+
Object {
|
178
|
+
"id": 3,
|
179
|
+
"name": "3-Large",
|
180
|
+
},
|
181
|
+
Object {
|
182
|
+
"id": 4,
|
183
|
+
"name": "Orchahosts-VM",
|
184
|
+
},
|
185
|
+
],
|
186
|
+
"dataType": "PARAMETER_SELECTION_PARAM_TYPE_FOREMAN",
|
187
|
+
"domains": Array [
|
188
|
+
Object {
|
189
|
+
"id": 1,
|
190
|
+
"name": "deploy3.dev.atix",
|
191
|
+
},
|
192
|
+
],
|
193
|
+
"environments": Array [
|
194
|
+
Object {
|
195
|
+
"id": 1,
|
196
|
+
"name": "production",
|
103
197
|
},
|
104
198
|
],
|
105
199
|
"hostgroup_id": 1,
|
106
|
-
"lifecycle_environments": Array [
|
107
|
-
"ptables": Array [
|
200
|
+
"lifecycle_environments": Array [
|
108
201
|
Object {
|
109
|
-
"id":
|
110
|
-
"name": "
|
202
|
+
"id": 1,
|
203
|
+
"name": "Library",
|
111
204
|
},
|
205
|
+
],
|
206
|
+
"ptables": Array [
|
112
207
|
Object {
|
113
|
-
"id":
|
114
|
-
"name": "Kickstart default
|
208
|
+
"id": 125,
|
209
|
+
"name": "Kickstart default",
|
115
210
|
},
|
116
211
|
],
|
117
212
|
}
|
118
213
|
`;
|
119
214
|
|
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
215
|
exports[`ParameterSelectionSelectors should return parameterTypes from parameterSelectionData_1 fixtures 1`] = `
|
125
216
|
Object {
|
126
|
-
"computeprofile": "Compute profile",
|
127
217
|
"domain": "Domain",
|
128
218
|
"hostparam": "Host parameter",
|
129
|
-
"
|
219
|
+
"ip": "IP",
|
220
|
+
"password": "Root password",
|
221
|
+
"ptable": "Partition table",
|
222
|
+
"puppetenv": "Puppet environment",
|
130
223
|
}
|
131
224
|
`;
|
132
225
|
|
@@ -135,64 +228,22 @@ Array [
|
|
135
228
|
Object {
|
136
229
|
"description": "",
|
137
230
|
"id": 1,
|
138
|
-
"
|
139
|
-
"
|
140
|
-
"
|
231
|
+
"locked": false,
|
232
|
+
"name": "CP",
|
233
|
+
"type": "computeprofile",
|
234
|
+
"value": "1",
|
141
235
|
},
|
142
236
|
Object {
|
143
237
|
"description": "",
|
144
238
|
"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",
|
239
|
+
"locked": true,
|
240
|
+
"name": "LE",
|
241
|
+
"type": "lifecycleenv",
|
242
|
+
"value": "1",
|
190
243
|
},
|
191
244
|
]
|
192
245
|
`;
|
193
246
|
|
194
|
-
exports[`ParameterSelectionSelectors should return serviceDefinition from parameterSelectionData_1 fixtures 1`] = `undefined`;
|
195
|
-
|
196
247
|
exports[`ParameterSelectionSelectors should return sortingColumns from parameterSelectionData_1 fixtures 1`] = `
|
197
248
|
Object {
|
198
249
|
"name": Object {
|
@@ -9,22 +9,26 @@ import {
|
|
9
9
|
selectLoading,
|
10
10
|
selectEditMode,
|
11
11
|
selectParamData,
|
12
|
+
selectAllowedParameterTypes,
|
12
13
|
selectParameterTypes,
|
13
14
|
selectParameters,
|
14
15
|
selectSortingColumns,
|
15
16
|
selectColumns,
|
16
17
|
selectParamDefinition,
|
18
|
+
selectEditParamsRowIndex,
|
17
19
|
} from './ParameterSelectionSelectors';
|
18
20
|
|
19
21
|
const mapStateToProps = state => ({
|
20
22
|
loading: selectLoading(state),
|
21
23
|
editMode: selectEditMode(state),
|
22
24
|
paramData: selectParamData(state),
|
25
|
+
allowedParameterTypes: selectAllowedParameterTypes(state),
|
23
26
|
parameterTypes: selectParameterTypes(state),
|
24
27
|
parameters: selectParameters(state),
|
25
28
|
sortingColumns: selectSortingColumns(state),
|
26
29
|
columns: selectColumns(state),
|
27
30
|
paramDefinition: selectParamDefinition(state),
|
31
|
+
editParamsRowIndex: selectEditParamsRowIndex(state),
|
28
32
|
});
|
29
33
|
|
30
34
|
const mapDispatchToProps = dispatch =>
|
@@ -34,4 +38,3 @@ export default connect(
|
|
34
38
|
mapStateToProps,
|
35
39
|
mapDispatchToProps
|
36
40
|
)(ParameterSelection);
|
37
|
-
|
@@ -0,0 +1,202 @@
|
|
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 ScmTypeSelector from './components/ScmTypeSelector';
|
13
|
+
import FormTextInput from './components/FormTextInput'
|
14
|
+
import { arrayToObject } from '../../helper';
|
15
|
+
import CommonForm from 'foremanReact/components/common/forms/CommonForm';
|
16
|
+
import $ from 'jquery';
|
17
|
+
|
18
|
+
import {
|
19
|
+
FormControl,
|
20
|
+
inlineEditFormatterFactory,
|
21
|
+
} from 'patternfly-react';
|
22
|
+
|
23
|
+
class SyncGitRepo extends React.Component {
|
24
|
+
constructor(props) {
|
25
|
+
super(props);
|
26
|
+
}
|
27
|
+
|
28
|
+
validateParameters() {
|
29
|
+
let result = true;
|
30
|
+
let msg = "";
|
31
|
+
|
32
|
+
if (this.props.path === "" && this.props.scmType === 'directory') {
|
33
|
+
result = false;
|
34
|
+
|
35
|
+
if (msg == "") {
|
36
|
+
msg += __("Directory path cannot be blank");
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
if (this.props.scmType === 'git') {
|
41
|
+
if (this.props.gitUrl === "") {
|
42
|
+
result = false;
|
43
|
+
|
44
|
+
if (msg == "") {
|
45
|
+
msg += __("Git URL cannot be blank");
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
if (this.props.scmType !== "git" && this.props.scmType !== "directory" ) {
|
51
|
+
result = false;
|
52
|
+
|
53
|
+
if (msg == "") {
|
54
|
+
msg += __("SCM Type cannot be blank");
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
return {
|
59
|
+
validateResult: result,
|
60
|
+
validateMsg: msg
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
componentDidMount() {
|
65
|
+
const {
|
66
|
+
data: {mode, scmType, path, gitCommit, gitUrl, appDefinitions},
|
67
|
+
initSyncGitRepo,
|
68
|
+
loadScmType,
|
69
|
+
loadPath,
|
70
|
+
loadGitCommit,
|
71
|
+
loadGitUrl,
|
72
|
+
handleGitRepoSync,
|
73
|
+
} = this.props;
|
74
|
+
|
75
|
+
if (mode === 'editInstance') {
|
76
|
+
loadScmType(scmType);
|
77
|
+
loadPath(path);
|
78
|
+
loadGitCommit(gitCommit);
|
79
|
+
loadGitUrl(gitUrl);
|
80
|
+
handleGitRepoSync(this.props.scmType, this.props.path, this.props.gitCommit)
|
81
|
+
}
|
82
|
+
|
83
|
+
initSyncGitRepo(
|
84
|
+
scmType,
|
85
|
+
path,
|
86
|
+
gitCommit,
|
87
|
+
gitUrl,
|
88
|
+
);
|
89
|
+
};
|
90
|
+
|
91
|
+
render() {
|
92
|
+
const {
|
93
|
+
data: {mode, scmTypes, organization, location, appDefinitions},
|
94
|
+
scmType,
|
95
|
+
path,
|
96
|
+
gitCommit,
|
97
|
+
gitUrl,
|
98
|
+
loadScmType,
|
99
|
+
loadPath,
|
100
|
+
loadGitCommit,
|
101
|
+
loadGitUrl,
|
102
|
+
handleGitRepoSync,
|
103
|
+
} = this.props;
|
104
|
+
|
105
|
+
var url_validator = /^(ftp|http|https):\/\/[^ "]+$/;
|
106
|
+
|
107
|
+
let { validateResult, validateMsg } = this.validateParameters();
|
108
|
+
|
109
|
+
if (validateResult === false) {
|
110
|
+
$('input[type="submit"][name="commit"]').attr("disabled", true);
|
111
|
+
} else {
|
112
|
+
$('input[type="submit"][name="commit"]').attr("disabled", false);
|
113
|
+
}
|
114
|
+
|
115
|
+
return (
|
116
|
+
<span>
|
117
|
+
<div>
|
118
|
+
<ScmTypeSelector
|
119
|
+
label="SCM Type *"
|
120
|
+
hidden={ false }
|
121
|
+
editable={ appDefinitions.length == 0 }
|
122
|
+
viewText={ scmTypes[scmType] }
|
123
|
+
options={ scmTypes }
|
124
|
+
onChange={ loadScmType }
|
125
|
+
selectValue={ scmType }
|
126
|
+
/>
|
127
|
+
{(scmType === 'directory') ? (
|
128
|
+
<FormTextInput
|
129
|
+
label= 'Directory Path *'
|
130
|
+
editable= { appDefinitions.length == 0 }
|
131
|
+
viewText={ path }
|
132
|
+
onChange={ loadPath }
|
133
|
+
parameter="path"
|
134
|
+
/> ) : null }
|
135
|
+
{(scmType === 'git') ? (
|
136
|
+
<FormTextInput
|
137
|
+
label= 'Git Url *'
|
138
|
+
editable= { appDefinitions.length == 0 }
|
139
|
+
viewText={ gitUrl }
|
140
|
+
onChange={ loadGitUrl }
|
141
|
+
parameter="git_url"
|
142
|
+
/> ) : null }
|
143
|
+
{(!url_validator.test(gitUrl) && gitUrl)? (
|
144
|
+
<div className="form-group">
|
145
|
+
<div className="col-md-2"></div>
|
146
|
+
<div className="col-md-4"><pre>{ __("Git URL is wrong") }</pre></div>
|
147
|
+
</div>
|
148
|
+
) : (<div></div>)}
|
149
|
+
{validateResult == false ? (
|
150
|
+
<div className="form-group">
|
151
|
+
<div className="col-md-2"></div>
|
152
|
+
<div className="col-md-4"><pre>{validateMsg}</pre></div>
|
153
|
+
</div>
|
154
|
+
) : (<div></div>)}
|
155
|
+
{(scmType === "git") ? (
|
156
|
+
<FormTextInput
|
157
|
+
label="Git Branch/Commit/Tag"
|
158
|
+
editable= { appDefinitions.length == 0 }
|
159
|
+
viewText={ gitCommit }
|
160
|
+
onChange={ loadGitCommit }
|
161
|
+
parameter="git_commit"
|
162
|
+
/> ) : null }
|
163
|
+
{(scmType === "git") ? (
|
164
|
+
<CommonForm>
|
165
|
+
<span className="help-block help-inline">
|
166
|
+
<Button
|
167
|
+
bsStyle="default"
|
168
|
+
onClick={ (e) => handleGitRepoSync(gitUrl, gitCommit, scmType, e) }
|
169
|
+
>
|
170
|
+
{__('Sync Repository')} </Button>
|
171
|
+
</span>
|
172
|
+
</CommonForm>
|
173
|
+
) : null }
|
174
|
+
|
175
|
+
</div>
|
176
|
+
</span>
|
177
|
+
)};
|
178
|
+
}
|
179
|
+
|
180
|
+
SyncGitRepo.defaultProps = {
|
181
|
+
error: {},
|
182
|
+
scmType: "",
|
183
|
+
path: "",
|
184
|
+
gitCommit: "",
|
185
|
+
gitUrl: "",
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
SyncGitRepo.propTypes = {
|
190
|
+
initSyncGitRepo: PropTypes.func,
|
191
|
+
loadScmType: PropTypes.func,
|
192
|
+
loadGitCommit: PropTypes.func,
|
193
|
+
loadPath: PropTypes.func,
|
194
|
+
loadGitUrl: PropTypes.func,
|
195
|
+
handleGitRepoSync: PropTypes.func,
|
196
|
+
scmType: PropTypes.string.isRequired,
|
197
|
+
path: PropTypes.string.isRequired,
|
198
|
+
gitCommit: PropTypes.string,
|
199
|
+
gitUrl: PropTypes.string,
|
200
|
+
};
|
201
|
+
|
202
|
+
export default SyncGitRepo;
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '~@theforeman/vendor/scss/variables';
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { API, actionTypeGenerator } from 'foremanReact/redux/API';
|
3
|
+
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
5
|
+
|
6
|
+
import {
|
7
|
+
SYNC_GIT_REPO_INIT,
|
8
|
+
SYNC_GIT_REPO_LOAD_SCM_TYPE,
|
9
|
+
SYNC_GIT_REPO_LOAD_PATH,
|
10
|
+
SYNC_GIT_REPO_LOAD_GIT_COMMIT,
|
11
|
+
SYNC_GIT_REPO_LOAD_GIT_URL,
|
12
|
+
SYNC_GIT_REPO_REQUEST,
|
13
|
+
SYNC_GIT_REPO_FAILURE,
|
14
|
+
SYNC_GIT_REPO_SUCCESS,
|
15
|
+
} from './SyncGitRepoConstants';
|
16
|
+
|
17
|
+
export const initSyncGitRepo = (
|
18
|
+
scmType,
|
19
|
+
path,
|
20
|
+
gitCommit,
|
21
|
+
gitUrl,
|
22
|
+
) => dispatch => {
|
23
|
+
const initialState = {};
|
24
|
+
|
25
|
+
initialState.scmType = scmType;
|
26
|
+
initialState.path = path;
|
27
|
+
initialState.gitCommit = gitCommit;
|
28
|
+
initialState.gitUrl = gitUrl;
|
29
|
+
|
30
|
+
dispatch({
|
31
|
+
type: SYNC_GIT_REPO_INIT,
|
32
|
+
payload: initialState,
|
33
|
+
});
|
34
|
+
};
|
35
|
+
|
36
|
+
const errorHandler = (msg, err) => {
|
37
|
+
const error = {
|
38
|
+
errorMsg: __('Failed to fetch data from server.'),
|
39
|
+
statusText: err,
|
40
|
+
};
|
41
|
+
return { type: msg, payload: { error } };
|
42
|
+
};
|
43
|
+
|
44
|
+
export const handleGitRepoSync = (
|
45
|
+
gitUrl, gitCommit, scmType, e,
|
46
|
+
) => async dispatch => {
|
47
|
+
e.preventDefault();
|
48
|
+
//const { REQUEST, SUCCESS, FAILURE } = actionTypeGenerator(SYNC_GIT_REPOSITORY);
|
49
|
+
dispatch({
|
50
|
+
type: SYNC_GIT_REPO_REQUEST,
|
51
|
+
payload: {
|
52
|
+
git_commit: gitCommit,
|
53
|
+
scm_type: scmType,
|
54
|
+
git_url: gitUrl,
|
55
|
+
}});
|
56
|
+
try {
|
57
|
+
const { data } = await API.post(
|
58
|
+
'/acd/ansible_playbooks/sync_git_repo', {"ansible_playbook": {"git_commit":gitCommit, "scm_type":scmType, "git_url":gitUrl}}
|
59
|
+
);
|
60
|
+
dispatch(
|
61
|
+
addToast({
|
62
|
+
type: 'success',
|
63
|
+
message: sprintf(
|
64
|
+
__('Sucessfully synced git repository ')
|
65
|
+
),
|
66
|
+
key: SYNC_GIT_REPO_SUCCESS,
|
67
|
+
})
|
68
|
+
);
|
69
|
+
return dispatch({
|
70
|
+
type: SYNC_GIT_REPO_SUCCESS,
|
71
|
+
payload: {
|
72
|
+
git_commit: gitCommit,
|
73
|
+
git_url: gitUrl,
|
74
|
+
scm_type: scmType,
|
75
|
+
},
|
76
|
+
response: data,
|
77
|
+
});
|
78
|
+
} catch (error) {
|
79
|
+
dispatch(
|
80
|
+
addToast({
|
81
|
+
type: 'error',
|
82
|
+
message: sprintf(__('Error occurred while syncing git repository: %s'), error.response.data.message),
|
83
|
+
key: SYNC_GIT_REPO_FAILURE,
|
84
|
+
})
|
85
|
+
);
|
86
|
+
return dispatch({
|
87
|
+
type: SYNC_GIT_REPO_FAILURE,
|
88
|
+
payload: {
|
89
|
+
error: error,
|
90
|
+
},
|
91
|
+
response: error,
|
92
|
+
});
|
93
|
+
}
|
94
|
+
};
|
95
|
+
|
96
|
+
|
97
|
+
export const loadScmType = (scmType) => {
|
98
|
+
return ({
|
99
|
+
type: SYNC_GIT_REPO_LOAD_SCM_TYPE,
|
100
|
+
scmType: scmType,
|
101
|
+
})
|
102
|
+
};
|
103
|
+
|
104
|
+
export const loadPath = (path) => {
|
105
|
+
return ({
|
106
|
+
type: SYNC_GIT_REPO_LOAD_PATH,
|
107
|
+
path: path,
|
108
|
+
})
|
109
|
+
};
|
110
|
+
|
111
|
+
export const loadGitCommit = (gitCommit) => {
|
112
|
+
return ({
|
113
|
+
type: SYNC_GIT_REPO_LOAD_GIT_COMMIT,
|
114
|
+
gitCommit: gitCommit,
|
115
|
+
})
|
116
|
+
};
|
117
|
+
|
118
|
+
export const loadGitUrl = (gitUrl) => {
|
119
|
+
return ({
|
120
|
+
type: SYNC_GIT_REPO_LOAD_GIT_URL,
|
121
|
+
gitUrl: gitUrl,
|
122
|
+
})
|
123
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export const SYNC_GIT_REPO_INIT = 'SYNC_GIT_REPO_INIT';
|
2
|
+
export const SYNC_GIT_REPO_LOAD_PATH = 'SYNC_GIT_REPO_LOAD_PATH';
|
3
|
+
export const SYNC_GIT_REPO_LOAD_SCM_TYPE = 'SYNC_GIT_REPO_LOAD_SCM_TYPE';
|
4
|
+
export const SYNC_GIT_REPO_LOAD_GIT_COMMIT = 'SYNC_GIT_REPO_LOAD_GIT_COMMIT';
|
5
|
+
export const SYNC_GIT_REPO_LOAD_GIT_URL = 'SYNC_GIT_REPO_LOAD_GIT_URL';
|
6
|
+
export const SYNC_GIT_REPO_REQUEST = 'SYNC_GIT_REPO_REQUEST';
|
7
|
+
export const SYNC_GIT_REPO_SUCCESS = 'SYNC_GIT_REPO_SUCCESS';
|
8
|
+
export const SYNC_GIT_REPO_FAILURE = 'SYNC_GIT_REPO_FAILURE';
|