mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 15:08:03 -03:30
Only auto-populate inventory source project when the user selects scm type from the dropdown
This commit is contained in:
parent
586961907c
commit
9213eec681
@ -18,8 +18,9 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
||||
init();
|
||||
|
||||
function init() {
|
||||
$scope.mode = 'add';
|
||||
// apply form definition's default field values
|
||||
GenerateForm.applyDefaults(form, $scope);
|
||||
GenerateForm.applyDefaults(form, $scope, true);
|
||||
$scope.canAdd = inventorySourcesOptions.actions.POST;
|
||||
$scope.envParseType = 'yaml';
|
||||
initSources();
|
||||
@ -118,7 +119,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
||||
});
|
||||
};
|
||||
|
||||
$scope.projectBasePath = GetBasePath('projects');
|
||||
$scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network';
|
||||
|
||||
$scope.sourceChange = function(source) {
|
||||
@ -144,10 +144,11 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
||||
}
|
||||
|
||||
if (source === 'scm') {
|
||||
$scope.overwrite_vars = true;
|
||||
$scope.inventory_source_form.inventory_file.$setPristine();
|
||||
$scope.projectBasePath = GetBasePath('projects');
|
||||
$scope.overwrite_vars = true;
|
||||
$scope.inventory_source_form.inventory_file.$setPristine();
|
||||
} else {
|
||||
$scope.overwrite_vars = false;
|
||||
$scope.overwrite_vars = false;
|
||||
}
|
||||
|
||||
// reset fields
|
||||
|
||||
@ -564,10 +564,6 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
||||
_doAutoPopulate();
|
||||
}
|
||||
});
|
||||
|
||||
if (attrs.watchbasepath === 'projectBasePath') {
|
||||
_doAutoPopulate();
|
||||
}
|
||||
}
|
||||
|
||||
function _doAutoPopulate() {
|
||||
|
||||
@ -375,11 +375,13 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
return this.build(options);
|
||||
},
|
||||
|
||||
applyDefaults: function (form, scope) {
|
||||
// Note: This is a hack. Ideally, mode should be set in each <resource>-<mode>.controller.js
|
||||
// The mode is needed by the awlookup directive to auto-populate form fields when there is a
|
||||
// single related resource.
|
||||
scope.mode = this.mode;
|
||||
applyDefaults: function (form, scope, ignoreMode) {
|
||||
if(!ignoreMode) {
|
||||
// Note: This is a hack. Ideally, mode should be set in each <resource>-<mode>.controller.js
|
||||
// The mode is needed by the awlookup directive to auto-populate form fields when there is a
|
||||
// single related resource.
|
||||
scope.mode = this.mode;
|
||||
}
|
||||
|
||||
for (var fld in form.fields) {
|
||||
if (form.fields[fld]['default'] || form.fields[fld]['default'] === 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user