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() {
// 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

View File

@ -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: '<p class=\"text-justify\"><strong>WARNING:</strong> 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.</p>'
"class": 'alert-info',
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 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.</p>',
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: '<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>' +
'<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: {
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()',

View File

@ -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'])

View File

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