mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
AC-715 Fixed issues with bad API requests when user types in value and lookup is built with predetermined search parameters. Fixed project lookup failure while user is typing.
This commit is contained in:
@@ -95,7 +95,7 @@ JobTemplatesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$rout
|
|||||||
function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
|
function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||||
GetBasePath, InventoryList, CredentialList, ProjectList, LookUpInit,
|
GetBasePath, InventoryList, CredentialList, ProjectList, LookUpInit,
|
||||||
md5Setup, ParseTypeChange, Wait)
|
md5Setup, ParseTypeChange, Wait, Empty)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -187,7 +187,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
|
|
||||||
// Detect and alert user to potential SCM status issues
|
// Detect and alert user to potential SCM status issues
|
||||||
var checkSCMStatus = function(oldValue, newValue) {
|
var checkSCMStatus = function(oldValue, newValue) {
|
||||||
if (oldValue !== newValue) {
|
if (oldValue !== newValue && !Empty(scope.project)) {
|
||||||
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
@@ -304,14 +304,14 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
JobTemplatesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
|
JobTemplatesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm',
|
||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
|
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
|
||||||
'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
|
'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
|
||||||
'md5Setup', 'ParseTypeChange', 'Wait'];
|
'md5Setup', 'ParseTypeChange', 'Wait', 'Empty' ];
|
||||||
|
|
||||||
|
|
||||||
function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
|
function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
|
||||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||||
RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList,
|
RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList,
|
||||||
ProjectList, LookUpInit, PromptPasswords, GetBasePath, md5Setup, ParseTypeChange,
|
ProjectList, LookUpInit, PromptPasswords, GetBasePath, md5Setup, ParseTypeChange,
|
||||||
JobStatusToolTip, FormatDate, Wait, Stream)
|
JobStatusToolTip, FormatDate, Wait, Stream, Empty)
|
||||||
{
|
{
|
||||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||||
//scope.
|
//scope.
|
||||||
@@ -366,34 +366,36 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
|||||||
|
|
||||||
// Detect and alert user to potential SCM status issues
|
// Detect and alert user to potential SCM status issues
|
||||||
var checkSCMStatus = function() {
|
var checkSCMStatus = function() {
|
||||||
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
if (!Empty(scope.project)) {
|
||||||
Rest.get()
|
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
||||||
.success( function(data, status, headers, config) {
|
Rest.get()
|
||||||
var msg;
|
.success( function(data, status, headers, config) {
|
||||||
switch(data.status) {
|
var msg;
|
||||||
case 'failed':
|
switch(data.status) {
|
||||||
msg = "The selected project has a <em>failed</em> status. Review the project's SCM settings" +
|
case 'failed':
|
||||||
" and run an update before adding it to a template.";
|
msg = "The selected project has a <em>failed</em> status. Review the project's SCM settings" +
|
||||||
break;
|
" and run an update before adding it to a template.";
|
||||||
case 'never updated':
|
break;
|
||||||
msg = 'The selected project has a <em>never updated</em> status. You will need to run a successful' +
|
case 'never updated':
|
||||||
' update in order to selected a playbook. Without a valid playbook you will not be able ' +
|
msg = 'The selected project has a <em>never updated</em> status. You will need to run a successful' +
|
||||||
' to save this template.';
|
' update in order to selected a playbook. Without a valid playbook you will not be able ' +
|
||||||
break;
|
' to save this template.';
|
||||||
case 'missing':
|
break;
|
||||||
msg = 'The selected project has a status of <em>missing</em>. Please check the server and make sure ' +
|
case 'missing':
|
||||||
' the directory exists and file permissions are set correctly.';
|
msg = 'The selected project has a status of <em>missing</em>. Please check the server and make sure ' +
|
||||||
break;
|
' the directory exists and file permissions are set correctly.';
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
Alert('Waning', msg, 'alert-info');
|
Alert('Waning', msg, 'alert-info');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, form,
|
ProcessErrors(scope, data, status, form,
|
||||||
{ hdr: 'Error!', msg: 'Failed to get project ' + scope.project +'. GET returned status: ' + status });
|
{ hdr: 'Error!', msg: 'Failed to get project ' + scope.project +'. GET returned status: ' + status });
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -683,5 +685,5 @@ JobTemplatesEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$
|
|||||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList',
|
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList',
|
||||||
'ProjectList', 'LookUpInit', 'PromptPasswords', 'GetBasePath', 'md5Setup', 'ParseTypeChange',
|
'ProjectList', 'LookUpInit', 'PromptPasswords', 'GetBasePath', 'md5Setup', 'ParseTypeChange',
|
||||||
'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream'
|
'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
|||||||
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||||
var hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
var hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||||
|
|
||||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url',defaultUrl +
|
var watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
||||||
'?' + form.fields[field].sourceField + '__' + 'iexact=:value');
|
watchUrl += form.fields[field].sourceField + '__' + 'iexact=:value';
|
||||||
|
|
||||||
|
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url', watchUrl);
|
||||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source',field);
|
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source',field);
|
||||||
|
|
||||||
scope['lookUp' + name] = function() {
|
scope['lookUp' + name] = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user