From b4be8f7d49e3b420b9f42bbcbd40ee046c7f8aa6 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 4 Dec 2014 15:51:38 -0500 Subject: [PATCH] Project SCM type drop down fix The SCM type for the projects page was broken when we sorted the drop down options by value. There was no value for 'manual' projects. I had to insert the word 'manual' where it was expecting a blank sting and then remove the word manual before saving the job template to the API --- awx/ui/static/js/controllers/Projects.js | 11 +++++++---- awx/ui/static/js/forms/Projects.js | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index 8a8ac65d6b..62193d3049 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -417,7 +417,8 @@ function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams var i; for (i = 0; i < $scope.scm_type_options.length; i++) { if ($scope.scm_type_options[i].value === '') { - $scope.scm_type = $scope.scm_type_options[i]; + $scope.scm_type_options[i].value="manual"; + //$scope.scm_type = $scope.scm_type_options[i]; break; } } @@ -467,7 +468,9 @@ function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams } } } - data.scm_type = $scope.scm_type.value; + if(data.scm_type.value==="manual" ){ + data.scm_type = ""; + } else data.scm_type = $scope.scm_type.value; if ($scope.scm_type.value !== '') { delete data.local_path; } else { @@ -509,8 +512,8 @@ function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams $scope.scmChange = function () { // When an scm_type is set, path is not required if ($scope.scm_type) { - $scope.pathRequired = ($scope.scm_type.value === '') ? true : false; - $scope.scmRequired = ($scope.scm_type.value !== '') ? true : false; + $scope.pathRequired = ($scope.scm_type.value === 'manual') ? true : false; + $scope.scmRequired = ($scope.scm_type.value !== 'manual') ? true : false; $scope.scmBranchLabel = ($scope.scm_type.value === 'svn') ? 'Revision #' : 'SCM Branch'; } }; diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index d667f0c4b2..e2ab63dc20 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -105,7 +105,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) type: 'textarea', //"class": 'col-lg-6', showonly: true, - ngShow: "scm_type.value == ''", + ngShow: "scm_type.value == 'manual' " , awPopOver: '

Base path used for locating playbooks. Directories found inside this path will be listed in the playbook directory drop-down. ' + 'Together the base path and selected playbook directory provide the full path used to locate playbooks.

' + '

Use PROJECTS_ROOT in your environment settings file to determine the base path value.

', @@ -122,7 +122,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) variable: "pathRequired", init: false }, - ngShow: "scm_type.value == '' && !showMissingPlaybooksAlert", + ngShow: "scm_type.value == 'manual' && !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.

', @@ -133,7 +133,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) scm_url: { label: 'SCM URL', type: 'text', - ngShow: "scm_type && scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== 'manual'", awRequiredWhen: { variable: "scmRequired", init: false @@ -166,14 +166,14 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) scm_branch: { labelBind: "scmBranchLabel", type: 'text', - ngShow: "scm_type && scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== 'manual'", addRequired: false, editRequired: false }, credential: { label: 'SCM Credential', type: 'lookup', - ngShow: "scm_type && scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== 'manual'", sourceModel: 'credential', sourceField: 'name', ngClick: 'lookUpCredential()', @@ -183,7 +183,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) checkbox_group: { label: 'SCM Update Options', type: 'checkbox_group', - ngShow: "scm_type && scm_type.value !== ''", + ngShow: "scm_type && scm_type.value !== 'manual'", fields: [{ name: 'scm_clean', label: 'Clean',