AC-395 Changed txt of 'No unassigned playbook directories' message. Message now displays in the form rather than via a modal dialog. The message is only displayed when scm_type is manual and all project directories are already assigned.

This commit is contained in:
chouseknecht
2013-09-04 15:11:21 -04:00
parent d32240803e
commit cadbf5f22d
5 changed files with 33 additions and 9 deletions

View File

@@ -161,7 +161,9 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
}
}
else {
data[fld] = scope[fld];
if (form.fields[fld].type !== 'alertblock') {
data[fld] = scope[fld];
}
}
}
if (scope.scm_type) {
@@ -339,7 +341,9 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
}
}
else {
params[fld] = scope[fld];
if (form.fields[fld].type !== 'alertblock') {
params[fld] = scope[fld];
}
}
}
if (scope.scm_type) {

View File

@@ -55,6 +55,16 @@ angular.module('ProjectFormDefinition', [])
addRequired: false,
editRequired: false
},
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 AWX server and ' +
'ensure content is present in a subdirectory under {{ base_dir }}. Run "chown -R awx" on the content directory to ensure awx can read the ' +
'playbooks.</p>'
},
base_dir: {
label: 'Project Base Path',
type: 'textarea',

View File

@@ -16,6 +16,8 @@ angular.module('ProjectPathHelper', ['RestServices', 'Utilities'])
var scope = params.scope;
var master = params.master;
scope.showMissingPlaybooksAlert = false;
Rest.setUrl( GetBasePath('config') );
Rest.get()
@@ -31,14 +33,9 @@ angular.module('ProjectPathHelper', ['RestServices', 'Utilities'])
scope.base_dir = data.project_base_dir;
master.base_dir = scope.base_dir; // Keep in master object so that it doesn't get
// wiped out on form reset.
console.log('base_dir: ' + scope.base_dir);
if (opts.length == 0) {
Alert('Missing Playbooks',
'<p>There are no unassigned playbook directories in the base project path (' + scope.base_dir + '). ' +
'Either the project directory is empty, or all of the contents are already assigned to other AWX projects.</p>' +
'<p>To fix this, log into the AWX server and check out another playbook project from your SCM repository into ' +
scope.base_dir + '. After checking out the project, run &quot;chown -R awx&quot; on the content directory to ' +
'ensure awx can read the playbooks.</p>', 'alert-info');
// trigger display of alert block when scm_type == manual
scope.showMissingPlaybooksAlert = true;
}
})
.error( function(data, status, headers, config) {

View File

@@ -160,6 +160,10 @@ hr {
color: @blue;
}
.text-justify {
text-align: justify;
}
/* Using inline-block rather than block keeps
brand img from right aligning into the collapse button
on mobile screens */

View File

@@ -337,6 +337,15 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
var html = '';
if (field.type == 'alertblock') {
html += "<div class=\"alert alert-dismissable " + field['class'] + "\" ";
html += (field.ngShow) ? this.attr(field, 'ngShow') : "";
html += ">\n";
html += "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>\n";
html += field.alertTxt;
html += "</div>\n";
}
if (field.type == 'hidden') {
if ( (options.mode == 'edit' && field.includeOnEdit) ||
(options.mode == 'add' && field.includeOnAdd) ) {