1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #142 from jaredevantabor/sources-form

Adding source vars for cloudforms, satellite6
This commit is contained in:
Jared Tabor 2017-08-02 09:49:14 -07:00 committed by GitHub
commit d9ae22b148
3 changed files with 66 additions and 9 deletions

View File

@ -101,12 +101,15 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
});
};
$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;

View File

@ -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;

View File

@ -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: "<p>Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " +
"<a href=\"https://github.com/ansible/ansible/blob/devel/contrib/inventory/cloudforms.ini\" target=\"_blank\">" +
"view openstack.yml in the Ansible github repo.</a></p>" +
"<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />&emsp;\"somevar\": \"somevalue\",<br />&emsp;\"password\": \"magic\"<br /> }</blockquote>\n" +
"YAML:<br />\n" +
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n" +
'<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
'<p>View YAML examples at <a href="http://docs.ansible.com/YAMLSyntax.html" target="_blank">docs.ansible.com</a></p>',
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: "<p>Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " +
"<a href=\"https://github.com/ansible/ansible/blob/devel/contrib/inventory/foreman.ini\" target=\"_blank\">" +
"view openstack.yml in the Ansible github repo.</a></p>" +
"<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />&emsp;\"somevar\": \"somevalue\",<br />&emsp;\"password\": \"magic\"<br /> }</blockquote>\n" +
"YAML:<br />\n" +
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n" +
'<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
'<p>View YAML examples at <a href="http://docs.ansible.com/YAMLSyntax.html" target="_blank">docs.ansible.com</a></p>',
dataContainer: 'body',
subForm: 'sourceSubForm'
},
verbosity: {
label: i18n._('Verbosity'),
type: 'select',