The Project selected has a status of \"failed\". You must run a successful update before you can select an inventory file.";
- break;
- case 'never updated':
- msg = "
The Project selected has a status of \"never updated\". You must run a successful update before you can select an inventory file.";
- break;
- case 'missing':
- msg = '
The selected project has a status of \"missing\". Please check the server and make sure ' +
- ' the directory exists and file permissions are set correctly.
';
- break;
- }
- if (msg) {
- Alert('Warning', msg, 'alert-info alert-info--noTextTransform', null, null, null, null, true);
- }
- })
- .error(function (data, status) {
- ProcessErrors($scope, data, status, form, { hdr: 'Error!',
- msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status });
- });
- }
- };
-
// Register a watcher on project_name
if ($scope.getInventoryFilesUnregister) {
$scope.getInventoryFilesUnregister();
@@ -83,7 +54,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
$scope.getInventoryFilesUnregister = $scope.$watch('project', function (newValue, oldValue) {
if (newValue !== oldValue) {
getInventoryFiles(newValue);
- checkSCMStatus();
}
});
@@ -118,7 +88,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 +113,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') + '?not__status=never updated';
+ $scope.overwrite_vars = true;
+ $scope.inventory_source_form.inventory_file.$setPristine();
} else {
- $scope.overwrite_vars = false;
+ $scope.overwrite_vars = false;
}
// reset fields
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 f4a68679ed..acef7d2c82 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
@@ -8,15 +8,15 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupsService',
'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions',
'inventorySourceData', 'SourcesService', 'inventoryData', 'inventorySourcesOptions', 'Empty',
- 'Wait', 'Rest', 'Alert', 'ProcessErrors',
+ 'Wait', 'Rest', 'Alert',
function($state, $stateParams, $scope, ParseVariableString,
rbacUiControlService, ToJSON,ParseTypeChange, GroupsService,
GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions,
inventorySourceData, SourcesService, inventoryData, inventorySourcesOptions, Empty,
- Wait, Rest, Alert, ProcessErrors) {
+ Wait, Rest, Alert) {
function init() {
- $scope.projectBasePath = GetBasePath('projects');
+ $scope.projectBasePath = GetBasePath('projects') + '?not__status=never updated';
$scope.canAdd = inventorySourcesOptions.actions.POST;
// instantiate expected $scope values from inventorySourceData
_.assign($scope,
@@ -136,33 +136,6 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
Wait('stop');
});
}
-
- if (!Empty($scope.project)) {
- Rest.setUrl(GetBasePath('projects') + $scope.project + '/');
- Rest.get()
- .success(function (data) {
- var msg;
- switch (data.status) {
- case 'failed':
- msg = "
The Project selected has a status of \"failed\". You must run a successful update before you can select an inventory file.";
- break;
- case 'never updated':
- msg = "
The Project selected has a status of \"never updated\". You must run a successful update before you can select an inventory file.";
- break;
- case 'missing':
- msg = '
The selected project has a status of \"missing\". Please check the server and make sure ' +
- ' the directory exists and file permissions are set correctly.
';
- break;
- }
- if (msg) {
- Alert('Warning', msg, 'alert-info alert-info--noTextTransform', null, null, null, null, true);
- }
- })
- .error(function (data, status) {
- ProcessErrors($scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status });
- });
- }
}
function initSourceSelect() {
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js
index 14614b24d1..53869691a7 100644
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js
+++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js
@@ -4,6 +4,7 @@ export default {
value: {
page_size:"5",
order_by:"name",
+ not__status:"never updated",
role_level:"use_role",
},
dynamic:true,
diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js
index 4fff94bca1..2967ffaba5 100644
--- a/awx/ui/client/src/shared/directives.js
+++ b/awx/ui/client/src/shared/directives.js
@@ -564,10 +564,6 @@ function(ConfigurationUtils, i18n, $rootScope) {
_doAutoPopulate();
}
});
-
- if (attrs.watchbasepath === 'projectBasePath') {
- _doAutoPopulate();
- }
}
function _doAutoPopulate() {
diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js
index ff3bcbf568..10923c5329 100644
--- a/awx/ui/client/src/shared/form-generator.js
+++ b/awx/ui/client/src/shared/form-generator.js
@@ -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
-.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 -.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) {