Fixed 'empty directory' warning on project detail page. The styling was off, and it was incorrectly displaying when scm_type was to empty.

This commit is contained in:
Chris Houseknecht
2014-02-03 23:20:08 +00:00
parent 32364ad055
commit 6c2b8358a0
4 changed files with 36 additions and 21 deletions

View File

@@ -442,9 +442,11 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
scope.scmChange = function() { scope.scmChange = function() {
// When an scm_type is set, path is not required // When an scm_type is set, path is not required
scope.pathRequired = (scope.scm_type.value == '') ? true : false; if (scope.scm_type) {
scope.scmRequired = (scope.scm_type.value !== '') ? true : false; scope.pathRequired = (scope.scm_type.value == '') ? true : false;
scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; scope.scmRequired = (scope.scm_type.value !== '') ? true : false;
scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch';
}
} }
// Cancel // Cancel
@@ -681,9 +683,11 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
} }
scope.scmChange = function() { scope.scmChange = function() {
scope.pathRequired = (scope.scm_type.value == '') ? true : false; if (scope.scm_type) {
scope.scmRequired = (scope.scm_type.value !== '') ? true : false; scope.pathRequired = (scope.scm_type.value == '') ? true : false;
scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; scope.scmRequired = (scope.scm_type.value !== '') ? true : false;
scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch';
}
} }
// Reset the form // Reset the form

View File

@@ -71,13 +71,15 @@ angular.module('ProjectFormDefinition', [])
}, },
missing_path_alert: { missing_path_alert: {
type: 'alertblock', type: 'alertblock',
"class": 'alert-info col-lg-6 col-lg-offset-2', "class": 'alert-info',
ngShow: 'showMissingPlaybooksAlert && !scm_type', ngShow: "showMissingPlaybooksAlert && scm_type.value == ''",
alertTxt: '<p class=\"text-justify\"><strong>WARNING:</strong> There are no unassigned playbook directories in the base project path {{ base_dir }}. Either the projects ' + alertTxt: '<p class=\"text-justify\"><strong>WARNING:</strong> There are no unassigned playbook directories in the base ' +
'directory is empty, or all of the contents are already assigned to other projects. New projects can be checked out from source control by ' + 'project path {{ base_dir }}. Either the projects directory is empty, or all of the contents are already assigned to ' +
'changing the SCM type option rather than specifying checkout paths manually. To continue with manual setup, log into the Tower host and ' + 'other projects. New projects can be checked out from source control by ' +
'ensure content is present in a subdirectory under {{ base_dir }}. Run "chown -R awx" on the content directory to ensure Tower can read the ' + 'changing the SCM type option rather than specifying checkout paths manually. To continue with manual setup, log into ' +
'playbooks.</p>' '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.</p>',
closeable: false
}, },
base_dir: { base_dir: {
label: 'Project Base Path', label: 'Project Base Path',
@@ -98,7 +100,7 @@ angular.module('ProjectFormDefinition', [])
id: 'local-path-select', id: 'local-path-select',
ngOptions: 'path.label for path in project_local_paths', ngOptions: 'path.label for path in project_local_paths',
awRequiredWhen: { variable: "pathRequired", init: false }, awRequiredWhen: { variable: "pathRequired", init: false },
ngShow: "scm_type.value == ''", ngShow: "scm_type.value == '' && !showMissingPlaybooksAlert",
awPopOver: '<p>Select from the list of directories found in the base path.' + awPopOver: '<p>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.</p>' + 'Together the base path and the playbook directory provide the full path used to locate playbooks.</p>' +
'<p>Use PROJECTS_ROOT in your environment settings file to determine the base path value.</p>', '<p>Use PROJECTS_ROOT in your environment settings file to determine the base path value.</p>',
@@ -109,7 +111,7 @@ angular.module('ProjectFormDefinition', [])
scm_url: { scm_url: {
label: 'SCM URL', label: 'SCM URL',
type: 'text', type: 'text',
ngShow: "scm_type.value !== ''", ngShow: "scm_type && scm_type.value !== ''",
awRequiredWhen: { variable: "scmRequired", init: false }, awRequiredWhen: { variable: "scmRequired", init: false },
helpCollapse: [ helpCollapse: [
{ hdr: 'GIT URLs', { hdr: 'GIT URLs',
@@ -137,14 +139,14 @@ angular.module('ProjectFormDefinition', [])
scm_branch: { scm_branch: {
labelBind: "scmBranchLabel", labelBind: "scmBranchLabel",
type: 'text', type: 'text',
ngShow: "scm_type.value !== ''", ngShow: "scm_type && scm_type.value !== ''",
addRequired: false, addRequired: false,
editRequired: false editRequired: false
}, },
credential: { credential: {
label: 'SCM Credential', label: 'SCM Credential',
type: 'lookup', type: 'lookup',
ngShow: "scm_type.value !== ''", ngShow: "scm_type && scm_type.value !== ''",
sourceModel: 'credential', sourceModel: 'credential',
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpCredential()', ngClick: 'lookUpCredential()',

View File

@@ -1,6 +1,10 @@
/********************************************* /******************************************************
* Copyright (c) 2014 AnsibleWorks, Inc. * Copyright (c) 2014 AnsibleWorks, Inc.
* *
* helpers/Access.js
*
* Routines for checking user access and license state
*
*/ */
angular.module('AccessHelper', ['RestServices', 'Utilities', 'ngCookies']) angular.module('AccessHelper', ['RestServices', 'Utilities', 'ngCookies'])

View File

@@ -516,15 +516,20 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities'])
var horizontal = (this.form.horizontal) ? true : false; var horizontal = (this.form.horizontal) ? true : false;
if (field.type == 'alertblock') { if (field.type == 'alertblock') {
html += "<div class=\"alert "; html += "<div class=\"row\">\n";
html += (field.closeable == undefined || field.closeable == true) ? "alert-dismissable " : ""; html += "<div class=\"col-lg-8 col-lg-offset-2\">\n";
html += field['class'] + "\" "; html += "<div class=\"alert";
html += (field.closeable == undefined || field.closeable == true) ? " alert-dismissable" : "";
html += (field['class']) ? " " + field['class'] : "";
html += "\" ";
html += (field.ngShow) ? this.attr(field, 'ngShow') : ""; html += (field.ngShow) ? this.attr(field, 'ngShow') : "";
html += ">\n"; html += ">\n";
html += (field.closeable == undefined || field.closeable == true) ? html += (field.closeable == undefined || field.closeable == true) ?
"<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>\n" : ""; "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>\n" : "";
html += field.alertTxt; html += field.alertTxt;
html += "</div>\n"; html += "</div>\n";
html += "</div>\n";
html += "</div>\n";
} }
if (field.type == 'hidden') { if (field.type == 'hidden') {