From ec065e0d970b2bd81bd012df143fb9393f39999c Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Tue, 31 May 2016 13:10:11 -0400 Subject: [PATCH] Project source types, popovers, form fixes --- awx/ui/client/legacy-styles/forms.less | 7 ++++ awx/ui/client/src/controllers/Projects.js | 29 +++++++++++++++++ awx/ui/client/src/forms/Projects.js | 38 ++++++---------------- awx/ui/client/src/shared/form-generator.js | 4 +-- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/awx/ui/client/legacy-styles/forms.less b/awx/ui/client/legacy-styles/forms.less index e04e43860d..948132ab10 100644 --- a/awx/ui/client/legacy-styles/forms.less +++ b/awx/ui/client/legacy-styles/forms.less @@ -181,6 +181,13 @@ align-items: flex-start; } +.Form-textUneditable { + .Form-textInput { + border: none; + padding: 0; + } +} + .Form-subForm { width: 100%; margin-bottom: 15px; diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 033328f838..fb22032545 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -495,6 +495,35 @@ export function ProjectsAdd(Refresh, $scope, $rootScope, $compile, $location, $l $scope.scmRequired = ($scope.scm_type.value !== 'manual') ? true : false; $scope.scmBranchLabel = ($scope.scm_type.value === 'svn') ? 'Revision #' : 'SCM Branch'; } + + // Dynamically update popover values + if($scope.scm_type.value) { + switch ($scope.scm_type.value) { + case 'git': + $scope.urlPopover = '

Example URLs for GIT SCM include:

' + + '

Note: When using SSH protocol for GitHub or Bitbucket, enter an SSH key only, ' + + 'do not enter a username (other than git). Additionally, GitHub and Bitbucket do not support password authentication when using ' + + 'SSH. GIT read only protocol (git://) does not use username or password information.'; + break; + case 'svn': + $scope.urlPopover = '

Example URLs for Subversion SCM include:

' + + ''; + break; + case 'hg': + $scope.urlPopover = '

Example URLs for Mercurial SCM include:

' + + '' + + '

Note: Mercurial does not support password authentication for SSH. ' + + 'Do not put the username and key in the URL. ' + + 'If using Bitbucket and SSH, do not supply your Bitbucket username.'; + break; + default: + $scope.urlPopover = '

URL popover text'; + } + } + }; $scope.formCancel = function () { diff --git a/awx/ui/client/src/forms/Projects.js b/awx/ui/client/src/forms/Projects.js index a57e73dd25..41f2834f9b 100644 --- a/awx/ui/client/src/forms/Projects.js +++ b/awx/ui/client/src/forms/Projects.js @@ -64,11 +64,11 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) ngChange: 'scmChange()', addRequired: true, editRequired: true, - hasSubForm: true + hasSubForm: true, }, missing_path_alert: { type: 'alertblock', - "class": 'alert-info', + //"class": 'alert-info', ngShow: "showMissingPlaybooksAlert && scm_type.value == 'manual'", alertTxt: '

WARNING: There are no available playbook directories in {{ base_dir }}. ' + 'Either that directory is empty, or all of the contents are already assigned to other projects. ' + @@ -79,7 +79,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) base_dir: { label: 'Project Base Path', type: 'text', - //"class": 'col-lg-6', + class: 'Form-textUneditable', showonly: true, 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. ' + @@ -87,7 +87,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) '

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

', dataTitle: 'Project Base Path', dataContainer: 'body', - dataPlacement: 'right' + dataPlacement: 'right', }, local_path: { label: 'Playbook Directory', @@ -115,30 +115,12 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) init: false }, subForm: 'sourceSubForm', - helpCollapse: [{ - hdr: 'GIT URLs', - content: '

Example URLs for GIT SCM include:

' + - '

Note: When using SSH protocol for GitHub or Bitbucket, enter an SSH key only, ' + - 'do not enter a username (other than git). Additionally, GitHub and Bitbucket do not support password authentication when using ' + - 'SSH. GIT read only protocol (git://) does not use username or password information.', - show: "scm_type.value == 'git'" - }, { - hdr: 'SVN URLs', - content: '

Example URLs for Subversion SCM include:

' + - '', - show: "scm_type.value == 'svn'" - }, { - hdr: 'Mercurial URLs', - content: '

Example URLs for Mercurial SCM include:

' + - '' + - '

Note: Mercurial does not support password authentication for SSH. ' + - 'Do not put the username and key in the URL. ' + - 'If using Bitbucket and SSH, do not supply your Bitbucket username.', - show: "scm_type.value == 'hg'" - }], + hideSubForm: "scm_type.value === 'manual'", + awPopOverWatch: "urlPopover", + awPopOver: "set in controllers/projects", + dataTitle: 'SCM URL', + dataContainer: 'body', + dataPlacement: 'right', }, scm_branch: { labelBind: "scmBranchLabel", diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index c75bfd7afb..33c1048f0c 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -787,7 +787,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat if ((!field.readonly) || (field.readonly && options.mode === 'edit')) { - if((field.excludeMode === undefined || field.excludeMode !== options.mode)) { + if((field.excludeMode === undefined || field.excludeMode !== options.mode) && field.type !== 'alertblock') { html += "

'; + html += '
'; html += ''+ subFormTitle +''; } else if (!field.subForm && currentSubForm !== undefined) {