diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js index f97ceadd2f..3f43f42978 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js @@ -101,12 +101,17 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', }); }; - $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; + // $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; $scope.sourceChange = function(source) { source = (source && source.value) ? source.value : ''; - $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; - if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm') { + if ($scope.source.value === "scm" && $scope.source.value === "custom") { + $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; + } + else{ + $scope.credentialBasePath = (source === 'ec2') ? GetBasePath('credentials') + '?kind=aws' : GetBasePath('credentials') + (source === '' ? '' : '?kind=' + (source)); + } + if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm' || source === 'cloudforms' || source === "satellite6") { $scope.envParseType = 'yaml'; var varName; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js index 5f18c1fd81..883bb72c90 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js @@ -141,7 +141,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', function initSourceSelect() { $scope.source = _.find($scope.source_type_options, { value: inventorySourceData.source }); var source = $scope.source && $scope.source.value ? $scope.source.value : null; - + $scope.cloudCredentialRequired = source !== '' && source !== 'scm' && source !== 'custom' && source !== 'ec2' ? true : false; CreateSelect2({ element: '#inventory_source_source', multiple: false @@ -149,7 +149,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || - source === 'scm') { + source === 'scm' || source === 'cloudforms' || + source === 'satellite6') { var varName; if (source === 'scm') { @@ -369,8 +370,13 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', $scope.sourceChange = function(source) { source = (source && source.value) ? source.value : ''; - $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; - if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm') { + if ($scope.source.value === "scm" && $scope.source.value === "custom") { + $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network'; + } + else{ + $scope.credentialBasePath = (source === 'ec2') ? GetBasePath('credentials') + '?kind=aws' : GetBasePath('credentials') + (source === '' ? '' : '?kind=' + (source)); + } + if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm' || source === 'cloudforms' || source === "satellite6") { $scope.envParseType = 'yaml'; var varName; diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js index 302dd8135e..ac82220414 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js @@ -75,7 +75,7 @@ return { type: 'lookup', list: 'CredentialList', basePath: 'credentials', - ngShow: "source && source.value !== ''", + ngShow: "source && source.value !== '' && source.value !== 'custom'", sourceModel: 'credential', sourceField: 'name', ngClick: 'lookupCredential()', @@ -274,6 +274,54 @@ return { dataContainer: 'body', subForm: 'sourceSubForm' }, + cloudforms_variables: { + id: 'cloudforms_variables', + label: i18n._('Source Variables'), + ngShow: "source && source.value == 'cloudforms'", + type: 'textarea', + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + rows: 6, + 'default': '---', + parseTypeName: 'envParseType', + dataTitle: "Source Variables", + dataPlacement: 'right', + awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + + "" + + "view openstack.yml in the Ansible github repo.

" + + "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + + "JSON:
\n" + + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + + "YAML:
\n" + + "
---
somevar: somevalue
password: magic
\n" + + '

View JSON examples at www.json.org

' + + '

View YAML examples at docs.ansible.com

', + dataContainer: 'body', + subForm: 'sourceSubForm' + }, + satellite6_variables: { + id: 'satellite6_variables', + label: i18n._('Source Variables'), + ngShow: "source && source.value == 'satellite6'", + type: 'textarea', + class: 'Form-textAreaLabel Form-formGroup--fullWidth', + rows: 6, + 'default': '---', + parseTypeName: 'envParseType', + dataTitle: "Source Variables", + dataPlacement: 'right', + awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + + "" + + "view openstack.yml in the Ansible github repo.

" + + "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + + "JSON:
\n" + + "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + + "YAML:
\n" + + "
---
somevar: somevalue
password: magic
\n" + + '

View JSON examples at www.json.org

' + + '

View YAML examples at docs.ansible.com

', + dataContainer: 'body', + subForm: 'sourceSubForm' + }, verbosity: { label: i18n._('Verbosity'), type: 'select',