diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index b6f3a21f16..2fb4c0bff7 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -442,9 +442,11 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam scope.scmChange = function() { // When an scm_type is set, path is not required - scope.pathRequired = (scope.scm_type.value == '') ? true : false; - scope.scmRequired = (scope.scm_type.value !== '') ? true : false; - scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; + if (scope.scm_type) { + scope.pathRequired = (scope.scm_type.value == '') ? true : false; + scope.scmRequired = (scope.scm_type.value !== '') ? true : false; + scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; + } } // Cancel @@ -681,9 +683,11 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara } scope.scmChange = function() { - scope.pathRequired = (scope.scm_type.value == '') ? true : false; - scope.scmRequired = (scope.scm_type.value !== '') ? true : false; - scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; + if (scope.scm_type) { + scope.pathRequired = (scope.scm_type.value == '') ? true : false; + scope.scmRequired = (scope.scm_type.value !== '') ? true : false; + scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; + } } // Reset the form diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index 0fadf0a84e..04c0e07ca1 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -71,13 +71,15 @@ angular.module('ProjectFormDefinition', []) }, missing_path_alert: { type: 'alertblock', - "class": 'alert-info col-lg-6 col-lg-offset-2', - ngShow: 'showMissingPlaybooksAlert && !scm_type', - alertTxt: '
WARNING: There are no unassigned playbook directories in the base project path {{ base_dir }}. Either the projects ' + - 'directory is empty, or all of the contents are already assigned to other projects. New projects can be checked out from source control by ' + - 'changing the SCM type option rather than specifying checkout paths manually. To continue with manual setup, log into the Tower host and ' + - 'ensure content is present in a subdirectory under {{ base_dir }}. Run "chown -R awx" on the content directory to ensure Tower can read the ' + - 'playbooks.
' + "class": 'alert-info', + ngShow: "showMissingPlaybooksAlert && scm_type.value == ''", + alertTxt: 'WARNING: There are no unassigned playbook directories in the base ' + + 'project path {{ base_dir }}. Either the projects directory is empty, or all of the contents are already assigned to ' + + 'other projects. New projects can be checked out from source control by ' + + 'changing the SCM type option rather than specifying checkout paths manually. To continue with manual setup, log into ' + + 'the Tower host and ensure content is present in a subdirectory under {{ base_dir }}. Run "chown -R awx" on the content ' + + 'directory to ensure Tower can read the playbooks.
', + closeable: false }, base_dir: { label: 'Project Base Path', @@ -98,7 +100,7 @@ angular.module('ProjectFormDefinition', []) id: 'local-path-select', ngOptions: 'path.label for path in project_local_paths', awRequiredWhen: { variable: "pathRequired", init: false }, - ngShow: "scm_type.value == ''", + ngShow: "scm_type.value == '' && !showMissingPlaybooksAlert", awPopOver: 'Select from the list of directories found in the base path.' + 'Together the base path and the playbook directory provide the full path used to locate playbooks.
' + 'Use PROJECTS_ROOT in your environment settings file to determine the base path value.
', @@ -109,7 +111,7 @@ angular.module('ProjectFormDefinition', []) scm_url: { label: 'SCM URL', type: 'text', - ngShow: "scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== ''", awRequiredWhen: { variable: "scmRequired", init: false }, helpCollapse: [ { hdr: 'GIT URLs', @@ -137,14 +139,14 @@ angular.module('ProjectFormDefinition', []) scm_branch: { labelBind: "scmBranchLabel", type: 'text', - ngShow: "scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== ''", addRequired: false, editRequired: false }, credential: { label: 'SCM Credential', type: 'lookup', - ngShow: "scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== ''", sourceModel: 'credential', sourceField: 'name', ngClick: 'lookUpCredential()', diff --git a/awx/ui/static/js/helpers/Access.js b/awx/ui/static/js/helpers/Access.js index 13680c5aea..6f0604e119 100644 --- a/awx/ui/static/js/helpers/Access.js +++ b/awx/ui/static/js/helpers/Access.js @@ -1,6 +1,10 @@ -/********************************************* +/****************************************************** * Copyright (c) 2014 AnsibleWorks, Inc. * + * helpers/Access.js + * + * Routines for checking user access and license state + * */ angular.module('AccessHelper', ['RestServices', 'Utilities', 'ngCookies']) diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 4c063dcb96..72aa0f812f 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -516,15 +516,20 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities']) var horizontal = (this.form.horizontal) ? true : false; if (field.type == 'alertblock') { - html += "