mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Fixed console error when switching source type back to Choose a source
This commit is contained in:
@@ -144,6 +144,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
varName = source + '_variables';
|
varName = source + '_variables';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope[varName] = $scope[varName] === (null || undefined) ? '---' : $scope[varName];
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
field_id: varName,
|
field_id: varName,
|
||||||
|
|||||||
@@ -341,13 +341,20 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.sourceChange = function(source) {
|
$scope.sourceChange = function(source) {
|
||||||
$scope.source = source;
|
if (source) {
|
||||||
|
source = source.value;
|
||||||
|
} else {
|
||||||
|
source = "";
|
||||||
|
}
|
||||||
|
|
||||||
source = source.value;
|
$scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network';
|
||||||
|
|
||||||
if (source === 'ec2' || source === 'custom' ||
|
if (source === 'custom'){
|
||||||
source === 'vmware' || source === 'openstack' ||
|
$scope.credentialBasePath = GetBasePath('inventory_script');
|
||||||
source === 'scm') {
|
}
|
||||||
|
|
||||||
|
if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm') {
|
||||||
|
$scope.envParseType = 'yaml';
|
||||||
|
|
||||||
var varName;
|
var varName;
|
||||||
if (source === 'scm') {
|
if (source === 'scm') {
|
||||||
@@ -361,18 +368,26 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
scope: $scope,
|
scope: $scope,
|
||||||
field_id: varName,
|
field_id: varName,
|
||||||
variable: varName,
|
variable: varName,
|
||||||
parse_variable: 'envParseType',
|
parse_variable: 'envParseType'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source === 'scm') {
|
||||||
|
$scope.overwrite_vars = true;
|
||||||
|
$scope.inventory_source_form.inventory_file.$setPristine();
|
||||||
|
} else {
|
||||||
|
$scope.overwrite_vars = false;
|
||||||
|
}
|
||||||
|
|
||||||
// reset fields
|
// reset fields
|
||||||
|
$scope.group_by_choices = source === 'ec2' ? $scope.ec2_group_by : null;
|
||||||
// azure_rm regions choices are keyed as "azure" in an OPTIONS request to the inventory_sources endpoint
|
// azure_rm regions choices are keyed as "azure" in an OPTIONS request to the inventory_sources endpoint
|
||||||
$scope.source_region_choices = source.value === 'azure_rm' ? $scope.azure_regions : $scope[source.value + '_regions'];
|
$scope.source_region_choices = source === 'azure_rm' ? $scope.azure_regions : $scope[source + '_regions'];
|
||||||
$scope.cloudCredentialRequired = source.value !== '' && source.value !== 'custom' && source.value !== 'scm' && source.value !== 'ec2' ? true : false;
|
$scope.cloudCredentialRequired = source !== '' && source !== 'scm' && source !== 'custom' && source !== 'ec2' ? true : false;
|
||||||
$scope.group_by = null;
|
$scope.group_by = null;
|
||||||
$scope.source_regions = null;
|
$scope.source_regions = null;
|
||||||
$scope.credential = null;
|
$scope.credential = null;
|
||||||
$scope.credential_name = null;
|
$scope.credential_name = null;
|
||||||
|
|
||||||
initRegionSelect();
|
initRegionSelect();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user