foreman_acd 0.9.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 +0 -2
- data/app/controllers/ui_acd_controller.rb +4 -2
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +25 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +4 -0
- data/app/views/foreman_acd/app_instances/_form.html.erb +4 -0
- data/lib/foreman_acd/plugin.rb +3 -3
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +5 -19
- data/test/controllers/ui_acd_controller_test.rb +4 -1
- data/webpack/__snapshots__/helper.test.js.snap +1 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +6 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +6 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +1 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +12 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +1 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +8 -0
- data/webpack/components/ApplicationDefinition/index.js +2 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +1 -1
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +6 -1
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +6 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +1 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +12 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +1 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +8 -0
- data/webpack/components/ApplicationInstance/index.js +2 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +5 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +10 -2
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +3 -3
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +1 -0
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +8 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -0
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +112 -17
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +13 -0
- data/webpack/components/ParameterSelection/index.js +2 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +1 -1
- data/webpack/helper.js +16 -1
- data/webpack/helper.test.js +20 -1
- data/webpack/test_setup.js +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a738c9828728db02d8d06460befc527ffbf7c3662d0bd0ba4d252ffe416be7e
|
4
|
+
data.tar.gz: 30c1d33e7525179ac752d949116fd99bc9fefb27e11c1a6f69567803ef5a0e25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8311857ec1c4a78e95e4f6a401548fa975b876fba04839a0641d84c4dd138d20858717df830d391651bb517ce07e423fc4faa2b4abc42e25a8fe332233e7460c
|
7
|
+
data.tar.gz: 455afe8abd543214663b4a621d92893a8e63e28a44e412b1de65695c32e712432906324b73b09c64ee94a6091bc4470f8b8640eb3f1507c3a21d804526ee45a8
|
data/README.md
CHANGED
@@ -119,8 +119,6 @@ All Foreman parameters require a value.
|
|
119
119
|
|
120
120
|
## TODO
|
121
121
|
|
122
|
-
* Add `git` support for the Ansible playbooks.
|
123
|
-
* Provide application templates which contains application definition and the required Ansible-playbook.
|
124
122
|
* Add Saltstack support to configure the application.
|
125
123
|
* Extend the Foreman parameter and value validation.
|
126
124
|
|
@@ -40,13 +40,15 @@ class UiAcdController < ::Api::V2::BaseController
|
|
40
40
|
def collect_foreman_data(hostgroup_id)
|
41
41
|
hg = Hostgroup.find(hostgroup_id)
|
42
42
|
fdata = OpenStruct.new(
|
43
|
-
:environments => Environment.all,
|
44
|
-
:lifecycle_environments => Katello::KTEnvironment.all,
|
45
43
|
:domains => Domain.all,
|
46
44
|
:computeprofiles => ComputeProfile.all,
|
47
45
|
:hostgroup_id => hg.id,
|
48
46
|
:ptables => hg&.operatingsystem&.ptables
|
49
47
|
)
|
48
|
+
|
49
|
+
fdata[:environments] = Environment.all if defined?(ForemanPuppet)
|
50
|
+
fdata[:lifecycle_environments] = Katello::KTEnvironment.all if defined?(Katello)
|
51
|
+
|
50
52
|
fdata
|
51
53
|
end
|
52
54
|
|
@@ -9,6 +9,31 @@ module ForemanAcd
|
|
9
9
|
base.instance_eval do
|
10
10
|
before_provision :initiate_acd_app_configurator_after_host_deployment, :if => :deployed_via_acd?
|
11
11
|
before_destroy :check_deletable, :prepend => true, :if => :deployed_via_acd?
|
12
|
+
|
13
|
+
has_many :app_instances, :through => :foreman_hosts, :class_name => 'ForemanAcd::AppInstance'
|
14
|
+
|
15
|
+
scoped_search :relation => :app_instances,
|
16
|
+
:on => :name,
|
17
|
+
:rename => :acd_app_instance,
|
18
|
+
:only_explicit => true,
|
19
|
+
:complete_value => true,
|
20
|
+
:operators => ['= '],
|
21
|
+
:ext_method => :find_by_acd_app_instance_name
|
22
|
+
end
|
23
|
+
|
24
|
+
base.singleton_class.prepend ClassMethods
|
25
|
+
end
|
26
|
+
|
27
|
+
# New class methods for Host::Managed
|
28
|
+
module ClassMethods
|
29
|
+
def find_by_acd_app_instance_name(_key, operator, acd_instance_name)
|
30
|
+
cond = sanitize_sql_for_conditions(["acd_app_instances.name #{operator} ?", value_to_sql(operator, acd_instance_name)])
|
31
|
+
hosts = ForemanAcd::AppInstance.where(cond).joins(:foreman_hosts).pluck(:host_id)
|
32
|
+
if hosts.empty?
|
33
|
+
{ :condition => '1=0' }
|
34
|
+
else
|
35
|
+
{ :conditions => Host::Managed.arel_table[:id].in(hosts).to_sql }
|
36
|
+
end
|
12
37
|
end
|
13
38
|
end
|
14
39
|
|
@@ -24,6 +24,10 @@
|
|
24
24
|
if @app_definition.ansible_vars_all.present?
|
25
25
|
json["ansibleVarsAll"] = JSON.parse(@app_definition.ansible_vars_all)
|
26
26
|
end
|
27
|
+
|
28
|
+
json["supportedPlugins"] = {}
|
29
|
+
json["supportedPlugins"]["puppet"] = defined?(ForemanPuppet) != nil
|
30
|
+
json["supportedPlugins"]["katello"] = defined?(Katello) != nil
|
27
31
|
%>
|
28
32
|
|
29
33
|
<%= form_for @app_definition, :url => (@app_definition.new_record? ? app_definitions_path : app_definition_path(:id => @app_definition.id)) do |f| %>
|
@@ -24,6 +24,10 @@
|
|
24
24
|
"ansibleVarsAll": @app_instance.ansible_vars_all.blank? ? [] : JSON.parse(@app_instance.ansible_vars_all),
|
25
25
|
}
|
26
26
|
end
|
27
|
+
|
28
|
+
json["supportedPlugins"] = {}
|
29
|
+
json["supportedPlugins"]["puppet"] = defined?(ForemanPuppet) != nil
|
30
|
+
json["supportedPlugins"]["katello"] = defined?(Katello) != nil
|
27
31
|
%>
|
28
32
|
|
29
33
|
<%= form_for @app_instance, :url => (@app_instance.new_record? ? app_instances_path : app_instance_path(:id => @app_instance.id)) do |f| %>
|
data/lib/foreman_acd/plugin.rb
CHANGED
@@ -33,7 +33,7 @@ Foreman::Plugin.register :foreman_acd do
|
|
33
33
|
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
34
34
|
|
35
35
|
permission :edit_ansible_playbooks,
|
36
|
-
{ :'foreman_acd/ansible_playbooks' => [:update, :edit],
|
36
|
+
{ :'foreman_acd/ansible_playbooks' => [:update, :edit, :sync_git_repo],
|
37
37
|
:'foreman_acd/api/v2/ansible_playbooks' => [:update] },
|
38
38
|
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
39
39
|
|
@@ -72,7 +72,7 @@ Foreman::Plugin.register :foreman_acd do
|
|
72
72
|
:resource_type => 'ForemanAcd::AppDefinition'
|
73
73
|
|
74
74
|
permission :export_app_definitions,
|
75
|
-
{ :'foreman_acd/app_definitions' => [:export],
|
75
|
+
{ :'foreman_acd/app_definitions' => [:export, :handle_file_upload],
|
76
76
|
:'foreman_acd/api/v2/app_definitions' => [:export] },
|
77
77
|
:resource_type => 'ForemanAcd::AppDefinition'
|
78
78
|
|
@@ -120,7 +120,7 @@ Foreman::Plugin.register :foreman_acd do
|
|
120
120
|
:resource_type => 'ForemanAcd::AppInstance'
|
121
121
|
|
122
122
|
permission :view_ui_acd,
|
123
|
-
{ :ui_acd => [:app, :foreman_data, :ansible_data] }
|
123
|
+
{ :ui_acd => [:app, :foreman_data, :ansible_data, :validate_hostname, :report_data] }
|
124
124
|
|
125
125
|
permission :acd_foreman_hosts,
|
126
126
|
{ :'foreman_acd/app_instances' => [:create, :edit, :update, :deploy, :destroy_with_hosts, :destroy] },
|
data/lib/foreman_acd/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,42 +1,28 @@
|
|
1
1
|
{
|
2
2
|
"name": "foreman_acd",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.0",
|
4
4
|
"description": "foreman application centric deployment",
|
5
5
|
"main": "index.js",
|
6
6
|
"directories": {
|
7
7
|
"test": "test"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
|
-
"@theforeman/vendor": "^
|
10
|
+
"@theforeman/vendor": "^4.14.0",
|
11
11
|
"react-intl": "^2.8.0"
|
12
12
|
},
|
13
13
|
"devDependencies": {
|
14
|
-
"@theforeman/
|
15
|
-
"
|
16
|
-
"babel-jest": "^23.6.0",
|
17
|
-
"babel-plugin-dynamic-import-node": "^2.3.3",
|
18
|
-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
14
|
+
"@theforeman/builder": "^4.14.0",
|
15
|
+
"@theforeman/vendor-dev": "^4.14.0",
|
19
16
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
20
|
-
"babel-plugin-transform-object-assign": "^6.22.0",
|
21
|
-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
22
17
|
"babel-preset-env": "^1.6.0",
|
23
18
|
"babel-preset-react": "^6.24.1",
|
24
19
|
"enzyme": "^3.11.0",
|
25
20
|
"enzyme-adapter-react-16": "^1.15.6",
|
26
21
|
"enzyme-to-json": "^3.6.1",
|
27
|
-
"eslint": "^4.18.1",
|
28
|
-
"eslint-plugin-import": "^2.22.1",
|
29
|
-
"eslint-plugin-jest": "^21.2.0",
|
30
|
-
"eslint-plugin-patternfly-react": "^0.2.1",
|
31
|
-
"eslint-plugin-react": "^7.22.0",
|
32
22
|
"identity-obj-proxy": "^3.0.0",
|
33
23
|
"jest": "^23.6.0",
|
34
|
-
"jest-cli": "^23.6.0",
|
35
24
|
"jest-prop-type-error": "^1.1.0",
|
36
|
-
"
|
37
|
-
"react-redux-test-utils": "^0.1.1",
|
38
|
-
"sortabular": "~1.5.1",
|
39
|
-
"table-resolver": "~3.2.0"
|
25
|
+
"react-redux-test-utils": "^0.1.1"
|
40
26
|
},
|
41
27
|
"scripts": {
|
42
28
|
"test": "node node_modules/.bin/jest --no-cache"
|
@@ -30,7 +30,10 @@ class UiAcdControllerTest < ActionController::TestCase
|
|
30
30
|
assert_equal json_app_all.first['name'], parsed_all_response.first['name']
|
31
31
|
end
|
32
32
|
|
33
|
-
test 'get foreman data json' do
|
33
|
+
test 'get foreman data json foreman <3' do
|
34
|
+
# TODO: Get rid of the puppet dependency at all!
|
35
|
+
skip 'Puppet env was removed with foreman >= 3.x' unless defined?(ForemanPuppet)
|
36
|
+
|
34
37
|
hostgroup = FactoryBot.create(:hostgroup, :with_domain, :with_os, :with_environment)
|
35
38
|
get :foreman_data, :params => { :id => hostgroup.id }, :session => set_session_user
|
36
39
|
assert_response :success
|
@@ -57,7 +57,7 @@ class ApplicationDefinition extends React.Component {
|
|
57
57
|
|
58
58
|
componentDidMount() {
|
59
59
|
const {
|
60
|
-
data: { mode, ansiblePlaybook, ansibleDataUrl, services, ansibleVarsAll, hostgroups },
|
60
|
+
data: { mode, ansiblePlaybook, ansibleDataUrl, services, ansibleVarsAll, hostgroups, supportedPlugins },
|
61
61
|
initApplicationDefinition,
|
62
62
|
addApplicationDefinitionService,
|
63
63
|
deleteApplicationDefinitionService,
|
@@ -194,6 +194,7 @@ class ApplicationDefinition extends React.Component {
|
|
194
194
|
ansiblePlaybook,
|
195
195
|
services,
|
196
196
|
ansibleVarsAll,
|
197
|
+
supportedPlugins,
|
197
198
|
this.headerFormatter,
|
198
199
|
this.inlineEditFormatter,
|
199
200
|
this.inlineEditButtonsFormatter,
|
@@ -207,6 +208,7 @@ class ApplicationDefinition extends React.Component {
|
|
207
208
|
ansiblePlaybook,
|
208
209
|
services,
|
209
210
|
columns,
|
211
|
+
hiddenForemanParameterTypes,
|
210
212
|
addApplicationDefinitionService,
|
211
213
|
confirmEditApplicationDefinitionService,
|
212
214
|
cancelEditApplicationDefinitionService,
|
@@ -308,6 +310,7 @@ class ApplicationDefinition extends React.Component {
|
|
308
310
|
<ParameterSelection
|
309
311
|
editModeCallback={ (hide) => changeParameterSelectionMode({ mode: hide })}
|
310
312
|
paramType={ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN }
|
313
|
+
hiddenParameterTypes={ hiddenForemanParameterTypes }
|
311
314
|
location={ location }
|
312
315
|
organization={ organization }
|
313
316
|
paramDataUrl= { foremanDataUrl }
|
@@ -377,6 +380,7 @@ ApplicationDefinition.defaultProps = {
|
|
377
380
|
ansibleVarsAll: [],
|
378
381
|
parametersData: {},
|
379
382
|
columns: [],
|
383
|
+
hiddenForemanParameterTypes: [],
|
380
384
|
editParamsOfRowId: null,
|
381
385
|
paramEditMode: false,
|
382
386
|
}
|
@@ -391,6 +395,7 @@ ApplicationDefinition.propTypes = {
|
|
391
395
|
services: PropTypes.array,
|
392
396
|
ansibleVarsAll: PropTypes.array,
|
393
397
|
columns: PropTypes.array,
|
398
|
+
hiddenForemanParameterTypes: PropTypes.array,
|
394
399
|
closeAlertModal: PropTypes.func,
|
395
400
|
addApplicationDefinitionService: PropTypes.func,
|
396
401
|
deleteApplicationDefinitionService: PropTypes.func,
|
@@ -34,6 +34,10 @@ import {
|
|
34
34
|
APPLICATION_DEFINITION_CHANGE_PARAMETER_SELECTION_MODE,
|
35
35
|
} from './ApplicationDefinitionConstants';
|
36
36
|
|
37
|
+
import {
|
38
|
+
supportedPluginsToHiddenParameterTypes,
|
39
|
+
} from '../../helper';
|
40
|
+
|
37
41
|
import {
|
38
42
|
transformAnsiblePlaybook,
|
39
43
|
} from './ApplicationDefinitionHelper';
|
@@ -42,6 +46,7 @@ export const initApplicationDefinition = (
|
|
42
46
|
ansiblePlaybook,
|
43
47
|
services,
|
44
48
|
ansibleVarsAll,
|
49
|
+
supportedPlugins,
|
45
50
|
headerFormatter,
|
46
51
|
inlineEditFormatter,
|
47
52
|
inlineEditButtonsFormatter,
|
@@ -168,6 +173,7 @@ export const initApplicationDefinition = (
|
|
168
173
|
}
|
169
174
|
initialState.services = services;
|
170
175
|
initialState.ansibleVarsAll = ansibleVarsAll;
|
176
|
+
initialState.hiddenForemanParameterTypes = supportedPluginsToHiddenParameterTypes(supportedPlugins);
|
171
177
|
|
172
178
|
dispatch({
|
173
179
|
type: APPLICATION_DEFINITION_INIT,
|
@@ -7,6 +7,7 @@ export const selectEditMode = state => applicationDefinitionConf(state).editMode
|
|
7
7
|
export const selectAnsiblePlaybook = state => applicationDefinitionConf(state).ansiblePlaybook;
|
8
8
|
export const selectServices = state => applicationDefinitionConf(state).services;
|
9
9
|
export const selectColumns = state => applicationDefinitionConf(state).columns;
|
10
|
+
export const selectHiddenForemanParameterTypes = state => applicationDefinitionConf(state).hiddenForemanParameterTypes;
|
10
11
|
export const selectParametersData = state => applicationDefinitionConf(state).parametersData;
|
11
12
|
export const selectAnsibleVarsAll = state => applicationDefinitionConf(state).ansibleVarsAll;
|
12
13
|
export const selectParamEditMode = state => applicationDefinitionConf(state).paramEditMode;
|
data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
2
|
|
3
3
|
import {
|
4
|
+
selectShowAlertModal,
|
5
|
+
selectAlertModalText,
|
6
|
+
selectAlertModalTitle,
|
4
7
|
selectEditMode,
|
5
8
|
selectAnsiblePlaybook,
|
6
9
|
selectServices,
|
7
10
|
selectColumns,
|
11
|
+
selectHiddenForemanParameterTypes,
|
8
12
|
selectParametersData,
|
9
13
|
selectAnsibleVarsAll,
|
10
14
|
selectParamEditMode,
|
@@ -21,6 +25,12 @@ const stateFactory = obj => ({
|
|
21
25
|
});
|
22
26
|
|
23
27
|
const fixtures = {
|
28
|
+
'should return showAlertModal from applicationDefinitionConfData_1 fixtures': () =>
|
29
|
+
selectShowAlertModal(stateFactory(applicationDefinitionConfData_1)),
|
30
|
+
'should return alertModalText from applicationDefinitionConfData_1 fixtures': () =>
|
31
|
+
selectAlertModalText(stateFactory(applicationDefinitionConfData_1)),
|
32
|
+
'should return alertModalTitle from applicationDefinitionConfData_1 fixtures': () =>
|
33
|
+
selectAlertModalTitle(stateFactory(applicationDefinitionConfData_1)),
|
24
34
|
'should return editMode from applicationDefinitionConfData_1 fixtures': () =>
|
25
35
|
selectEditMode(stateFactory(applicationDefinitionConfData_1)),
|
26
36
|
'should return ansiblePlaybook from applicationDefinitionConfData_1 fixtures': () =>
|
@@ -31,6 +41,8 @@ const fixtures = {
|
|
31
41
|
selectParametersData(stateFactory(applicationDefinitionConfData_1)),
|
32
42
|
'should return columns from applicationDefinitionConfData_1 fixtures': () =>
|
33
43
|
selectColumns(stateFactory(applicationDefinitionConfData_1)),
|
44
|
+
'should return hiddenForemanParameterTypes from applicationDefinitionConfData_1 fixtures': () =>
|
45
|
+
selectHiddenForemanParameterTypes(stateFactory(applicationDefinitionConfData_1)),
|
34
46
|
'should return ansibleVarsAll from applicationDefinitionConfData_1 fixtures': () =>
|
35
47
|
selectAnsibleVarsAll(stateFactory(applicationDefinitionConfData_1)),
|
36
48
|
'should return ParamEditMode from applicationDefinitionConfData_1 fixtures': () =>
|
@@ -134,6 +134,7 @@ exports[`ApplicationDefinition should render application definition 1`] = `
|
|
134
134
|
<Connect(ParameterSelection)
|
135
135
|
data={Object {}}
|
136
136
|
editModeCallback={[Function]}
|
137
|
+
hiddenParameterTypes={Array []}
|
137
138
|
location="Default Location"
|
138
139
|
organization="Default Organization"
|
139
140
|
paramDataUrl="url/does/not/exist"
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
exports[`ApplicationDefinitionSelectors should return ParamEditMode from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
4
4
|
|
5
|
+
exports[`ApplicationDefinitionSelectors should return alertModalText from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
6
|
+
|
7
|
+
exports[`ApplicationDefinitionSelectors should return alertModalTitle from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
8
|
+
|
5
9
|
exports[`ApplicationDefinitionSelectors should return ansiblePlaybook from applicationDefinitionConfData_1 fixtures 1`] = `
|
6
10
|
Object {
|
7
11
|
"groups": Object {
|
@@ -214,6 +218,8 @@ Array [
|
|
214
218
|
|
215
219
|
exports[`ApplicationDefinitionSelectors should return editMode from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
216
220
|
|
221
|
+
exports[`ApplicationDefinitionSelectors should return hiddenForemanParameterTypes from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
222
|
+
|
217
223
|
exports[`ApplicationDefinitionSelectors should return parametersData from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
218
224
|
|
219
225
|
exports[`ApplicationDefinitionSelectors should return services from applicationDefinitionConfData_1 fixtures 1`] = `
|
@@ -297,3 +303,5 @@ Array [
|
|
297
303
|
},
|
298
304
|
]
|
299
305
|
`;
|
306
|
+
|
307
|
+
exports[`ApplicationDefinitionSelectors should return showAlertModal from applicationDefinitionConfData_1 fixtures 1`] = `undefined`;
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
selectAnsiblePlaybook,
|
14
14
|
selectServices,
|
15
15
|
selectColumns,
|
16
|
+
selectHiddenForemanParameterTypes,
|
16
17
|
selectParametersData,
|
17
18
|
selectAnsibleVarsAll,
|
18
19
|
selectParamEditMode,
|
@@ -26,6 +27,7 @@ const mapStateToProps = state => ({
|
|
26
27
|
ansiblePlaybook: selectAnsiblePlaybook(state),
|
27
28
|
services: selectServices(state),
|
28
29
|
columns: selectColumns(state),
|
30
|
+
hiddenForemanParameterTypes: selectHiddenForemanParameterTypes(state),
|
29
31
|
parametersData: selectParametersData(state),
|
30
32
|
ansibleVarsAll: selectAnsibleVarsAll(state),
|
31
33
|
paramEditMode: selectParamEditMode(state),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { API, actionTypeGenerator } from 'foremanReact/redux/API';
|
3
|
-
import { addToast } from 'foremanReact/
|
3
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
4
4
|
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
5
5
|
|
6
6
|
|
@@ -92,7 +92,7 @@ class ApplicationInstance extends React.Component {
|
|
92
92
|
|
93
93
|
componentDidMount() {
|
94
94
|
const {
|
95
|
-
data: { mode, appDefinition, hosts, ansibleVarsAll, appDefinitionUrl },
|
95
|
+
data: { mode, appDefinition, hosts, ansibleVarsAll, appDefinitionUrl, supportedPlugins },
|
96
96
|
initApplicationInstance,
|
97
97
|
addApplicationInstanceHost,
|
98
98
|
deleteApplicationInstanceHost,
|
@@ -244,6 +244,7 @@ class ApplicationInstance extends React.Component {
|
|
244
244
|
appDefinition,
|
245
245
|
hosts,
|
246
246
|
ansibleVarsAll,
|
247
|
+
supportedPlugins,
|
247
248
|
this.headerFormatter,
|
248
249
|
this.inlineEditFormatter,
|
249
250
|
this.inlineEditButtonsFormatter,
|
@@ -258,6 +259,7 @@ class ApplicationInstance extends React.Component {
|
|
258
259
|
services,
|
259
260
|
hosts,
|
260
261
|
columns,
|
262
|
+
hiddenForemanParameterTypes,
|
261
263
|
addApplicationInstanceHost,
|
262
264
|
confirmEditApplicationInstanceHost,
|
263
265
|
cancelEditApplicationInstanceHost,
|
@@ -385,6 +387,7 @@ class ApplicationInstance extends React.Component {
|
|
385
387
|
<ParameterSelection
|
386
388
|
editModeCallback={ (hide) => changeParameterSelectionMode({ mode: hide })}
|
387
389
|
paramType={ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN }
|
390
|
+
hiddenParameterTypes={ hiddenForemanParameterTypes }
|
388
391
|
location={ location }
|
389
392
|
organization={ organization }
|
390
393
|
paramDataUrl= { foremanDataUrl }
|
@@ -483,6 +486,7 @@ ApplicationInstance.defaultProps = {
|
|
483
486
|
ansibleVarsAll: [],
|
484
487
|
parametersData: {},
|
485
488
|
columns: [],
|
489
|
+
hiddenForemanParameterTypes: [],
|
486
490
|
editParamsOfRowId: null,
|
487
491
|
paramEditMode: false,
|
488
492
|
}
|
@@ -496,6 +500,7 @@ ApplicationInstance.propTypes = {
|
|
496
500
|
services: PropTypes.array,
|
497
501
|
appDefinition: PropTypes.object,
|
498
502
|
columns: PropTypes.array,
|
503
|
+
hiddenForemanParameterTypes: PropTypes.array,
|
499
504
|
hosts: PropTypes.array,
|
500
505
|
ansibleVarsAll: PropTypes.array,
|
501
506
|
closeAlertModal: PropTypes.func,
|
@@ -36,10 +36,15 @@ import {
|
|
36
36
|
APPLICATION_INSTANCE_CHANGE_PARAMETER_SELECTION_MODE,
|
37
37
|
} from './ApplicationInstanceConstants';
|
38
38
|
|
39
|
+
import {
|
40
|
+
supportedPluginsToHiddenParameterTypes,
|
41
|
+
} from '../../helper';
|
42
|
+
|
39
43
|
export const initApplicationInstance = (
|
40
44
|
appDefinition,
|
41
45
|
hosts,
|
42
46
|
ansibleVarsAll,
|
47
|
+
supportedPlugins,
|
43
48
|
headerFormatter,
|
44
49
|
inlineEditFormatter,
|
45
50
|
inlineEditButtonsFormatter,
|
@@ -116,6 +121,7 @@ export const initApplicationInstance = (
|
|
116
121
|
initialState.appDefinition = appDefinition;
|
117
122
|
initialState.hosts = hosts;
|
118
123
|
initialState.ansibleVarsAll = ansibleVarsAll;
|
124
|
+
initialState.hiddenForemanParameterTypes = supportedPluginsToHiddenParameterTypes(supportedPlugins);
|
119
125
|
|
120
126
|
dispatch({
|
121
127
|
type: APPLICATION_INSTANCE_INIT,
|
@@ -7,6 +7,7 @@ export const selectEditMode = state => applicationInstanceConf(state).editMode;
|
|
7
7
|
export const selectAppDefinition = state => applicationInstanceConf(state).appDefinition;
|
8
8
|
export const selectHosts = state => applicationInstanceConf(state).hosts;
|
9
9
|
export const selectColumns = state => applicationInstanceConf(state).columns;
|
10
|
+
export const selectHiddenForemanParameterTypes = state => applicationInstanceConf(state).hiddenForemanParameterTypes;
|
10
11
|
export const selectServices = state => applicationInstanceConf(state).services;
|
11
12
|
export const selectParametersData = state => applicationInstanceConf(state).parametersData;
|
12
13
|
export const selectAnsibleVarsAll = state => applicationInstanceConf(state).ansibleVarsAll;
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
2
|
|
3
3
|
import {
|
4
|
+
selectShowAlertModal,
|
5
|
+
selectAlertModalText,
|
6
|
+
selectAlertModalTitle,
|
4
7
|
selectEditMode,
|
5
8
|
selectAppDefinition,
|
6
9
|
selectHosts,
|
7
10
|
selectColumns,
|
11
|
+
selectHiddenForemanParameterTypes,
|
8
12
|
selectServices,
|
9
13
|
selectParametersData,
|
10
14
|
selectAnsibleVarsAll,
|
@@ -22,6 +26,12 @@ const stateFactory = obj => ({
|
|
22
26
|
});
|
23
27
|
|
24
28
|
const fixtures = {
|
29
|
+
'should return showAlertModal from applicationInstanceConfData_1 fixtures': () =>
|
30
|
+
selectShowAlertModal(stateFactory(applicationInstanceConfData_1)),
|
31
|
+
'should return alertModalText from applicationInstanceConfData_1 fixtures': () =>
|
32
|
+
selectAlertModalText(stateFactory(applicationInstanceConfData_1)),
|
33
|
+
'should return alertModalTitle from applicationInstanceConfData_1 fixtures': () =>
|
34
|
+
selectAlertModalTitle(stateFactory(applicationInstanceConfData_1)),
|
25
35
|
'should return editMode from applicationInstanceConfData_1 fixtures': () =>
|
26
36
|
selectEditMode(stateFactory(applicationInstanceConfData_1)),
|
27
37
|
'should return appDefinition from applicationInstanceConfData_1 fixtures': () =>
|
@@ -30,6 +40,8 @@ const fixtures = {
|
|
30
40
|
selectHosts(stateFactory(applicationInstanceConfData_1)),
|
31
41
|
'should return columns from applicationInstanceConfData_1 fixtures': () =>
|
32
42
|
selectColumns(stateFactory(applicationInstanceConfData_1)),
|
43
|
+
'should return hiddenForemanParameterTypes from applicationInstanceConfData_1 fixtures': () =>
|
44
|
+
selectHiddenForemanParameterTypes(stateFactory(applicationInstanceConfData_1)),
|
33
45
|
'should return services from applicationInstanceConfData_1 fixtures': () =>
|
34
46
|
selectServices(stateFactory(applicationInstanceConfData_1)),
|
35
47
|
'should return parametersData from applicationInstanceConfData_1 fixtures': () =>
|
data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap
CHANGED
@@ -165,6 +165,7 @@ exports[`ApplicationInstance should render application instance 1`] = `
|
|
165
165
|
<Connect(ParameterSelection)
|
166
166
|
data={Object {}}
|
167
167
|
editModeCallback={[Function]}
|
168
|
+
hiddenParameterTypes={Array []}
|
168
169
|
location="Default Location"
|
169
170
|
organization="Default Organization"
|
170
171
|
paramType="PARAMETER_SELECTION_PARAM_TYPE_FOREMAN"
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
exports[`ApplicationInstanceSelectors should return ParamEditMode from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
4
4
|
|
5
|
+
exports[`ApplicationInstanceSelectors should return alertModalText from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
6
|
+
|
7
|
+
exports[`ApplicationInstanceSelectors should return alertModalTitle from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
8
|
+
|
5
9
|
exports[`ApplicationInstanceSelectors should return ansibleVarsAll from applicationInstanceConfData_1 fixtures 1`] = `
|
6
10
|
Array [
|
7
11
|
Object {
|
@@ -117,6 +121,8 @@ Array [
|
|
117
121
|
|
118
122
|
exports[`ApplicationInstanceSelectors should return editMode from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
119
123
|
|
124
|
+
exports[`ApplicationInstanceSelectors should return hiddenForemanParameterTypes from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
125
|
+
|
120
126
|
exports[`ApplicationInstanceSelectors should return hosts from applicationInstanceConfData_1 fixtures 1`] = `
|
121
127
|
Array [
|
122
128
|
Object {
|
@@ -274,3 +280,5 @@ Array [
|
|
274
280
|
},
|
275
281
|
]
|
276
282
|
`;
|
283
|
+
|
284
|
+
exports[`ApplicationInstanceSelectors should return showAlertModal from applicationInstanceConfData_1 fixtures 1`] = `undefined`;
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
selectHosts,
|
15
15
|
selectServices,
|
16
16
|
selectColumns,
|
17
|
+
selectHiddenForemanParameterTypes,
|
17
18
|
selectParametersData,
|
18
19
|
selectAnsibleVarsAll,
|
19
20
|
selectParamEditMode,
|
@@ -28,6 +29,7 @@ const mapStateToProps = state => ({
|
|
28
29
|
hosts: selectHosts(state),
|
29
30
|
services: selectServices(state),
|
30
31
|
columns: selectColumns(state),
|
32
|
+
hiddenForemanParameterTypes: selectHiddenForemanParameterTypes(state),
|
31
33
|
parametersData: selectParametersData(state),
|
32
34
|
ansibleVarsAll: selectAnsibleVarsAll(state),
|
33
35
|
paramEditMode: selectParamEditMode(state),
|
@@ -95,6 +95,7 @@ class ParameterSelection extends React.Component {
|
|
95
95
|
organization,
|
96
96
|
paramType,
|
97
97
|
paramDataUrl,
|
98
|
+
hiddenParameterTypes,
|
98
99
|
initParameterSelection,
|
99
100
|
sortParameter,
|
100
101
|
deleteParameter,
|
@@ -306,6 +307,7 @@ class ParameterSelection extends React.Component {
|
|
306
307
|
paramType,
|
307
308
|
paramDefinition,
|
308
309
|
parameters,
|
310
|
+
hiddenParameterTypes,
|
309
311
|
useDefaultValue,
|
310
312
|
allowNameAdjustment,
|
311
313
|
allowDescriptionAdjustment,
|
@@ -463,6 +465,7 @@ ParameterSelection.defaultProps = {
|
|
463
465
|
paramData: {},
|
464
466
|
parameters: [],
|
465
467
|
columns: [],
|
468
|
+
hiddenParameterTypes: [],
|
466
469
|
sortingColumns: {},
|
467
470
|
editParamsRowIndex: [],
|
468
471
|
editModeCallback: undefined,
|
@@ -481,6 +484,8 @@ ParameterSelection.propTypes = {
|
|
481
484
|
editMode: PropTypes.bool.isRequired,
|
482
485
|
loading: PropTypes.bool.isRequired,
|
483
486
|
paramData: PropTypes.object.isRequired,
|
487
|
+
hiddenParameterTypes: PropTypes.array.isRequired,
|
488
|
+
allowedParameterTypes: PropTypes.object,
|
484
489
|
parameterTypes: PropTypes.object,
|
485
490
|
parameters: PropTypes.array,
|
486
491
|
sortingColumns: PropTypes.object,
|
@@ -17,7 +17,7 @@ import {
|
|
17
17
|
} from 'foremanReact/common/helpers';
|
18
18
|
|
19
19
|
import {
|
20
|
-
|
20
|
+
filterParameterTypes,
|
21
21
|
} from './ParameterSelectionHelper';
|
22
22
|
|
23
23
|
import {
|
@@ -49,6 +49,7 @@ export const initParameterSelection = (
|
|
49
49
|
paramType,
|
50
50
|
paramDefinition,
|
51
51
|
parameters,
|
52
|
+
hiddenParameterTypes,
|
52
53
|
useDefaultValue,
|
53
54
|
allowNameAdjustment,
|
54
55
|
allowDescriptionAdjustment,
|
@@ -181,7 +182,14 @@ export const initParameterSelection = (
|
|
181
182
|
initialState.parameters = parameters;
|
182
183
|
|
183
184
|
if ((paramType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) && (parameters)) {
|
184
|
-
|
185
|
+
let pTypes = PARAMETER_SELECTION_TYPES;
|
186
|
+
|
187
|
+
// filter hidden parameters
|
188
|
+
hiddenParameterTypes.forEach(item => delete pTypes[item]);
|
189
|
+
initialState.allowedParameterTypes = pTypes;
|
190
|
+
|
191
|
+
// filter already used parameter types
|
192
|
+
initialState.parameterTypes = filterParameterTypes(pTypes, parameters);
|
185
193
|
}
|
186
194
|
|
187
195
|
initialState.paramType = paramType;
|
@@ -11,10 +11,14 @@ export const transformForemanData = (fdata) => {
|
|
11
11
|
return (result);
|
12
12
|
}
|
13
13
|
|
14
|
-
export const
|
14
|
+
export const filterParameterTypes = (options, parameters) => {
|
15
15
|
const newOptions = cloneDeep(options);
|
16
|
+
|
16
17
|
// hostparam can be used multiple times
|
17
18
|
const alreadyUsed = parameters.map(item => item["type"]).filter(item => item != 'hostparam');
|
19
|
+
|
20
|
+
// remove already used items
|
18
21
|
alreadyUsed.forEach(item => delete newOptions[item])
|
22
|
+
|
19
23
|
return newOptions;
|
20
24
|
}
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
} from 'lodash';
|
8
8
|
|
9
9
|
import {
|
10
|
-
|
10
|
+
filterParameterTypes,
|
11
11
|
} from './ParameterSelectionHelper';
|
12
12
|
|
13
13
|
import * as sort from 'sortabular';
|
@@ -83,7 +83,7 @@ const parameterSelectionParameters = (state = initialState, action) => {
|
|
83
83
|
const parameters = state.parameters.filter(v => v.id !== payload.rowData.id);
|
84
84
|
return state.merge({
|
85
85
|
parameters: parameters,
|
86
|
-
parameterTypes:
|
86
|
+
parameterTypes: filterParameterTypes(state.allowedParameterTypes, parameters),
|
87
87
|
})
|
88
88
|
}
|
89
89
|
case PARAMETER_SELECTION_EDIT_ACTIVATE: {
|
@@ -106,7 +106,7 @@ const parameterSelectionParameters = (state = initialState, action) => {
|
|
106
106
|
|
107
107
|
return state.merge({
|
108
108
|
editMode: false,
|
109
|
-
parameterTypes:
|
109
|
+
parameterTypes: filterParameterTypes(state.allowedParameterTypes, parameters),
|
110
110
|
parameters: parameters
|
111
111
|
});
|
112
112
|
}
|
@@ -3,6 +3,7 @@ const parameterState = state => state.foremanAcd.parameterSelectionParameters;
|
|
3
3
|
export const selectLoading = state => parameterState(state).loading;
|
4
4
|
export const selectEditMode = state => parameterState(state).editMode;
|
5
5
|
export const selectParamData = state => parameterState(state).paramData;
|
6
|
+
export const selectAllowedParameterTypes = state => parameterState(state).allowedParameterTypes;
|
6
7
|
export const selectParameterTypes = state => parameterState(state).parameterTypes;
|
7
8
|
export const selectParameters = state => parameterState(state).parameters;
|
8
9
|
export const selectSortingColumns = state => parameterState(state).sortingColumns;
|
data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js
CHANGED
@@ -215,6 +215,14 @@ export const parameterSelectionData_1 = {
|
|
215
215
|
value: '1'
|
216
216
|
}
|
217
217
|
],
|
218
|
+
allowedParameterTypes: [
|
219
|
+
'domain',
|
220
|
+
'hostparam',
|
221
|
+
'ip',
|
222
|
+
'ptable',
|
223
|
+
'puppetenv',
|
224
|
+
'password',
|
225
|
+
],
|
218
226
|
parameterTypes: {
|
219
227
|
domain: 'Domain',
|
220
228
|
hostparam: 'Host parameter',
|
@@ -4,12 +4,14 @@ import {
|
|
4
4
|
selectLoading,
|
5
5
|
selectEditMode,
|
6
6
|
selectParamData,
|
7
|
+
selectAllowedParameterTypes,
|
7
8
|
selectParameterTypes,
|
8
9
|
selectParameters,
|
9
10
|
selectSortingColumns,
|
10
11
|
selectColumns,
|
11
12
|
selectParamDefinition,
|
12
13
|
selectHostgroupId,
|
14
|
+
selectEditParamsRowIndex,
|
13
15
|
} from '../ParameterSelectionSelectors';
|
14
16
|
|
15
17
|
import {
|
@@ -29,6 +31,8 @@ const fixtures = {
|
|
29
31
|
selectEditMode(stateFactory(parameterSelectionData_1)),
|
30
32
|
'should return paramData from parameterSelectionData_1 fixtures': () =>
|
31
33
|
selectParamData(stateFactory(parameterSelectionData_1)),
|
34
|
+
'should return allowedParameterTypes from parameterSelectionData_1 fixtures': () =>
|
35
|
+
selectAllowedParameterTypes(stateFactory(parameterSelectionData_1)),
|
32
36
|
'should return parameterTypes from parameterSelectionData_1 fixtures': () =>
|
33
37
|
selectParameterTypes(stateFactory(parameterSelectionData_1)),
|
34
38
|
'should return parameters from parameterSelectionData_1 fixtures': () =>
|
@@ -41,6 +45,8 @@ const fixtures = {
|
|
41
45
|
selectParamDefinition(stateFactory(parameterSelectionData_1)),
|
42
46
|
'should return hostgroupId from parameterSelectionData_1 fixtures': () =>
|
43
47
|
selectHostgroupId(stateFactory(parameterSelectionData_1)),
|
48
|
+
'should return editParamsRowIndex from parameterSelectionData_1 fixtures': () =>
|
49
|
+
selectEditParamsRowIndex(stateFactory(parameterSelectionData_1)),
|
44
50
|
};
|
45
51
|
|
46
52
|
describe('ParameterSelectionSelectors', () =>
|
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
exports[`ParameterSelectionReducer should activate edit parameter 1`] = `
|
4
4
|
Object {
|
5
|
+
"allowedParameterTypes": Array [
|
6
|
+
"domain",
|
7
|
+
"hostparam",
|
8
|
+
"ip",
|
9
|
+
"ptable",
|
10
|
+
"puppetenv",
|
11
|
+
"password",
|
12
|
+
],
|
5
13
|
"columns": Array [
|
6
14
|
Object {
|
7
15
|
"cell": Object {
|
@@ -240,6 +248,14 @@ Object {
|
|
240
248
|
|
241
249
|
exports[`ParameterSelectionReducer should add a parameter 1`] = `
|
242
250
|
Object {
|
251
|
+
"allowedParameterTypes": Array [
|
252
|
+
"domain",
|
253
|
+
"hostparam",
|
254
|
+
"ip",
|
255
|
+
"ptable",
|
256
|
+
"puppetenv",
|
257
|
+
"password",
|
258
|
+
],
|
243
259
|
"columns": Array [
|
244
260
|
Object {
|
245
261
|
"cell": Object {
|
@@ -490,6 +506,14 @@ Object {
|
|
490
506
|
|
491
507
|
exports[`ParameterSelectionReducer should cancel edit parameter 1`] = `
|
492
508
|
Object {
|
509
|
+
"allowedParameterTypes": Array [
|
510
|
+
"domain",
|
511
|
+
"hostparam",
|
512
|
+
"ip",
|
513
|
+
"ptable",
|
514
|
+
"puppetenv",
|
515
|
+
"password",
|
516
|
+
],
|
493
517
|
"columns": Array [
|
494
518
|
Object {
|
495
519
|
"cell": Object {
|
@@ -719,6 +743,14 @@ Object {
|
|
719
743
|
|
720
744
|
exports[`ParameterSelectionReducer should change edit parameter 1`] = `
|
721
745
|
Object {
|
746
|
+
"allowedParameterTypes": Array [
|
747
|
+
"domain",
|
748
|
+
"hostparam",
|
749
|
+
"ip",
|
750
|
+
"ptable",
|
751
|
+
"puppetenv",
|
752
|
+
"password",
|
753
|
+
],
|
722
754
|
"columns": Array [
|
723
755
|
Object {
|
724
756
|
"cell": Object {
|
@@ -957,6 +989,14 @@ Object {
|
|
957
989
|
|
958
990
|
exports[`ParameterSelectionReducer should confirm edit parameter 1`] = `
|
959
991
|
Object {
|
992
|
+
"allowedParameterTypes": Array [
|
993
|
+
"domain",
|
994
|
+
"hostparam",
|
995
|
+
"ip",
|
996
|
+
"ptable",
|
997
|
+
"puppetenv",
|
998
|
+
"password",
|
999
|
+
],
|
960
1000
|
"columns": Array [
|
961
1001
|
Object {
|
962
1002
|
"cell": Object {
|
@@ -1149,14 +1189,14 @@ Object {
|
|
1149
1189
|
"id": 1,
|
1150
1190
|
"name": "web",
|
1151
1191
|
},
|
1152
|
-
"parameterTypes":
|
1153
|
-
"domain"
|
1154
|
-
"hostparam"
|
1155
|
-
"ip"
|
1156
|
-
"
|
1157
|
-
"
|
1158
|
-
"
|
1159
|
-
|
1192
|
+
"parameterTypes": Array [
|
1193
|
+
"domain",
|
1194
|
+
"hostparam",
|
1195
|
+
"ip",
|
1196
|
+
"ptable",
|
1197
|
+
"puppetenv",
|
1198
|
+
"password",
|
1199
|
+
],
|
1160
1200
|
"parameters": Array [
|
1161
1201
|
Object {
|
1162
1202
|
"description": "",
|
@@ -1186,6 +1226,14 @@ Object {
|
|
1186
1226
|
|
1187
1227
|
exports[`ParameterSelectionReducer should delete a parameter 1`] = `
|
1188
1228
|
Object {
|
1229
|
+
"allowedParameterTypes": Array [
|
1230
|
+
"domain",
|
1231
|
+
"hostparam",
|
1232
|
+
"ip",
|
1233
|
+
"ptable",
|
1234
|
+
"puppetenv",
|
1235
|
+
"password",
|
1236
|
+
],
|
1189
1237
|
"columns": Array [
|
1190
1238
|
Object {
|
1191
1239
|
"cell": Object {
|
@@ -1378,15 +1426,14 @@ Object {
|
|
1378
1426
|
"id": 1,
|
1379
1427
|
"name": "web",
|
1380
1428
|
},
|
1381
|
-
"parameterTypes":
|
1382
|
-
"domain"
|
1383
|
-
"hostparam"
|
1384
|
-
"ip"
|
1385
|
-
"
|
1386
|
-
"
|
1387
|
-
"
|
1388
|
-
|
1389
|
-
},
|
1429
|
+
"parameterTypes": Array [
|
1430
|
+
"domain",
|
1431
|
+
"hostparam",
|
1432
|
+
"ip",
|
1433
|
+
"ptable",
|
1434
|
+
"puppetenv",
|
1435
|
+
"password",
|
1436
|
+
],
|
1390
1437
|
"parameters": Array [
|
1391
1438
|
Object {
|
1392
1439
|
"description": "",
|
@@ -1408,6 +1455,14 @@ Object {
|
|
1408
1455
|
|
1409
1456
|
exports[`ParameterSelectionReducer should initialize component 1`] = `
|
1410
1457
|
Object {
|
1458
|
+
"allowedParameterTypes": Array [
|
1459
|
+
"domain",
|
1460
|
+
"hostparam",
|
1461
|
+
"ip",
|
1462
|
+
"ptable",
|
1463
|
+
"puppetenv",
|
1464
|
+
"password",
|
1465
|
+
],
|
1411
1466
|
"columns": Array [
|
1412
1467
|
Object {
|
1413
1468
|
"cell": Object {
|
@@ -1645,6 +1700,14 @@ Object {
|
|
1645
1700
|
|
1646
1701
|
exports[`ParameterSelectionReducer should load param data be erroneous 1`] = `
|
1647
1702
|
Object {
|
1703
|
+
"allowedParameterTypes": Array [
|
1704
|
+
"domain",
|
1705
|
+
"hostparam",
|
1706
|
+
"ip",
|
1707
|
+
"ptable",
|
1708
|
+
"puppetenv",
|
1709
|
+
"password",
|
1710
|
+
],
|
1648
1711
|
"columns": Array [
|
1649
1712
|
Object {
|
1650
1713
|
"cell": Object {
|
@@ -1870,6 +1933,14 @@ Object {
|
|
1870
1933
|
|
1871
1934
|
exports[`ParameterSelectionReducer should load param data be successful 1`] = `
|
1872
1935
|
Object {
|
1936
|
+
"allowedParameterTypes": Array [
|
1937
|
+
"domain",
|
1938
|
+
"hostparam",
|
1939
|
+
"ip",
|
1940
|
+
"ptable",
|
1941
|
+
"puppetenv",
|
1942
|
+
"password",
|
1943
|
+
],
|
1873
1944
|
"columns": Array [
|
1874
1945
|
Object {
|
1875
1946
|
"cell": Object {
|
@@ -2099,6 +2170,14 @@ Object {
|
|
2099
2170
|
|
2100
2171
|
exports[`ParameterSelectionReducer should lock a parameter 1`] = `
|
2101
2172
|
Object {
|
2173
|
+
"allowedParameterTypes": Array [
|
2174
|
+
"domain",
|
2175
|
+
"hostparam",
|
2176
|
+
"ip",
|
2177
|
+
"ptable",
|
2178
|
+
"puppetenv",
|
2179
|
+
"password",
|
2180
|
+
],
|
2102
2181
|
"columns": Array [
|
2103
2182
|
Object {
|
2104
2183
|
"cell": Object {
|
@@ -2328,6 +2407,14 @@ Object {
|
|
2328
2407
|
|
2329
2408
|
exports[`ParameterSelectionReducer should request load param data 1`] = `
|
2330
2409
|
Object {
|
2410
|
+
"allowedParameterTypes": Array [
|
2411
|
+
"domain",
|
2412
|
+
"hostparam",
|
2413
|
+
"ip",
|
2414
|
+
"ptable",
|
2415
|
+
"puppetenv",
|
2416
|
+
"password",
|
2417
|
+
],
|
2331
2418
|
"columns": Array [
|
2332
2419
|
Object {
|
2333
2420
|
"cell": Object {
|
@@ -2568,6 +2655,14 @@ Object {
|
|
2568
2655
|
|
2569
2656
|
exports[`ParameterSelectionReducer should sort parameter 1`] = `
|
2570
2657
|
Object {
|
2658
|
+
"allowedParameterTypes": Array [
|
2659
|
+
"domain",
|
2660
|
+
"hostparam",
|
2661
|
+
"ip",
|
2662
|
+
"ptable",
|
2663
|
+
"puppetenv",
|
2664
|
+
"password",
|
2665
|
+
],
|
2571
2666
|
"columns": Array [
|
2572
2667
|
Object {
|
2573
2668
|
"cell": Object {
|
@@ -8,6 +8,17 @@ Object {
|
|
8
8
|
}
|
9
9
|
`;
|
10
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
|
+
|
11
22
|
exports[`ParameterSelectionSelectors should return columns from parameterSelectionData_1 fixtures 1`] = `
|
12
23
|
Array [
|
13
24
|
Object {
|
@@ -146,6 +157,8 @@ Array [
|
|
146
157
|
|
147
158
|
exports[`ParameterSelectionSelectors should return editMode from parameterSelectionData_1 fixtures 1`] = `false`;
|
148
159
|
|
160
|
+
exports[`ParameterSelectionSelectors should return editParamsRowIndex from parameterSelectionData_1 fixtures 1`] = `undefined`;
|
161
|
+
|
149
162
|
exports[`ParameterSelectionSelectors should return hostgroupId from parameterSelectionData_1 fixtures 1`] = `1`;
|
150
163
|
|
151
164
|
exports[`ParameterSelectionSelectors should return loading from parameterSelectionData_1 fixtures 1`] = `false`;
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
selectLoading,
|
10
10
|
selectEditMode,
|
11
11
|
selectParamData,
|
12
|
+
selectAllowedParameterTypes,
|
12
13
|
selectParameterTypes,
|
13
14
|
selectParameters,
|
14
15
|
selectSortingColumns,
|
@@ -21,6 +22,7 @@ const mapStateToProps = state => ({
|
|
21
22
|
loading: selectLoading(state),
|
22
23
|
editMode: selectEditMode(state),
|
23
24
|
paramData: selectParamData(state),
|
25
|
+
allowedParameterTypes: selectAllowedParameterTypes(state),
|
24
26
|
parameterTypes: selectParameterTypes(state),
|
25
27
|
parameters: selectParameters(state),
|
26
28
|
sortingColumns: selectSortingColumns(state),
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { API, actionTypeGenerator } from 'foremanReact/redux/API';
|
3
3
|
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
4
|
-
import { addToast } from 'foremanReact/
|
4
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
5
5
|
|
6
6
|
import {
|
7
7
|
SYNC_GIT_REPO_INIT,
|
data/webpack/helper.js
CHANGED
@@ -31,9 +31,24 @@ function EasyHeaderFormatter(value, { column }) {
|
|
31
31
|
);
|
32
32
|
}
|
33
33
|
|
34
|
+
function supportedPluginsToHiddenParameterTypes(supportedPlugins) {
|
35
|
+
let hiddenParameterTypes = [];
|
36
|
+
|
37
|
+
if (supportedPlugins['puppet'] == false) {
|
38
|
+
hiddenParameterTypes.push("puppetenv");
|
39
|
+
}
|
40
|
+
|
41
|
+
if (supportedPlugins['katello'] == false) {
|
42
|
+
hiddenParameterTypes.push("lifecycleenv");
|
43
|
+
}
|
44
|
+
|
45
|
+
return hiddenParameterTypes;
|
46
|
+
}
|
47
|
+
|
34
48
|
export {
|
35
49
|
arrayToObject,
|
36
50
|
arrayToObjectObj,
|
37
51
|
shortHostname,
|
38
|
-
EasyHeaderFormatter
|
52
|
+
EasyHeaderFormatter,
|
53
|
+
supportedPluginsToHiddenParameterTypes
|
39
54
|
};
|
data/webpack/helper.test.js
CHANGED
@@ -2,6 +2,7 @@ import {
|
|
2
2
|
arrayToObject,
|
3
3
|
arrayToObjectObj,
|
4
4
|
EasyHeaderFormatter,
|
5
|
+
supportedPluginsToHiddenParameterTypes,
|
5
6
|
} from './helper';
|
6
7
|
|
7
8
|
describe('helper', () => {
|
@@ -30,8 +31,26 @@ describe('helper', () => {
|
|
30
31
|
);
|
31
32
|
});
|
32
33
|
|
33
|
-
it('
|
34
|
+
it('formats a nice, easy header', () => {
|
34
35
|
expect(EasyHeaderFormatter('MyValue', { column: { header: { label: 'TheLabel', props: { p1: '1' } } } })).toMatchSnapshot();
|
35
36
|
});
|
37
|
+
|
38
|
+
it('creates hidden parameter definition by supported plugins 1', () => {
|
39
|
+
expect(supportedPluginsToHiddenParameterTypes({ puppet: false})).toEqual(
|
40
|
+
['puppetenv']
|
41
|
+
);
|
42
|
+
});
|
43
|
+
|
44
|
+
it('creates hidden parameter definition by supported plugins 2', () => {
|
45
|
+
expect(supportedPluginsToHiddenParameterTypes({ puppet: true})).toEqual(
|
46
|
+
[]
|
47
|
+
);
|
48
|
+
});
|
49
|
+
|
50
|
+
it('creates hidden parameter definition by supported plugins 3', () => {
|
51
|
+
expect(supportedPluginsToHiddenParameterTypes({})).toEqual(
|
52
|
+
[]
|
53
|
+
);
|
54
|
+
});
|
36
55
|
});
|
37
56
|
|
data/webpack/test_setup.js
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_acd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|