1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

fix playbook not found by showing specific error in ui

This commit is contained in:
John Mitchell 2016-06-28 17:06:53 -04:00
parent 45bf92aecb
commit 6888aa6d2a
3 changed files with 9 additions and 1 deletions

View File

@ -116,6 +116,7 @@ export default
dataTitle: 'Playbook',
dataPlacement: 'right',
dataContainer: "body",
includePlaybookNotFoundError: true
},
credential: {
label: 'Machine Credential',

View File

@ -109,12 +109,15 @@ export default
Rest.get()
.success(function (data) {
$scope.playbook_options = [];
var playbookNotFound = true;
for (var i = 0; i < data.length; i++) {
$scope.playbook_options.push(data[i]);
if (data[i] === $scope.playbook) {
$scope.job_templates_form.playbook.$setValidity('required', true);
playbookNotFound = false;
}
}
$scope.playbookNotFound = playbookNotFound;
sync_playbook_select2();
if ($scope.playbook) {
$scope.$emit('jobTemplateLoadFinished');

View File

@ -1160,7 +1160,11 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
field.awRequiredWhen) {
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select a value.") + "</div>\n";
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select a value.");
if (field.includePlaybookNotFoundError) {
html += " <span ng-show=\"playbookNotFound\">Playbook {{ job_template_obj.playbook }} not found for project.</span>\n";
}
html += "</div>\n";
}
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";