diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index bfdee9a6e9..b395e94d69 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -187,7 +187,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam }) .error( function(data, status, headers, config) { ProcessErrors(scope, data, status, ProjectsForm, - { hdr: 'Error!', msg: 'Failed to create new project. Post returned status: ' + status }); + { hdr: 'Error!', msg: 'Failed to create new project. Post returned status: ' + status }); }); }; diff --git a/awx/ui/static/js/helpers/ProjectPath.js b/awx/ui/static/js/helpers/ProjectPath.js index f052f2d4d7..0e4a50b389 100644 --- a/awx/ui/static/js/helpers/ProjectPath.js +++ b/awx/ui/static/js/helpers/ProjectPath.js @@ -10,8 +10,8 @@ */ angular.module('ProjectPathHelper', ['RestServices', 'Utilities']) - .factory('GetProjectPath', ['Alert', 'Rest', 'GetBasePath','ProcessErrors', - function(Alert, Rest, GetBasePath, ProcessErrors) { + .factory('GetProjectPath', ['Alert', 'Rest', 'GetBasePath','ProcessErrors', 'Alert', + function(Alert, Rest, GetBasePath, ProcessErrors, Alert) { return function(params) { var scope = params.scope; @@ -23,11 +23,19 @@ angular.module('ProjectPathHelper', ['RestServices', 'Utilities']) var opts = []; for (var i=0; i < data.project_local_paths.length; i++) { opts.push(data.project_local_paths[i]); + } + if (scope.local_path) { + opts.push(scope.local_path); } scope.project_local_paths = opts; scope.base_dir = data.project_base_dir; master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get // wiped out on form reset. + if (opts.length == 0) { + Alert('Missing project path', 'All of the project paths have been assigned to existing projects, or ' + + 'there are no directories found in the base path. You will need to add a project path before creating ' + + 'a new project.', 'alert-info'); + } }) .error( function(data, status, headers, config) { ProcessErrors(scope, data, status, null,