mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 00:57:48 -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,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
||||
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
|
||||
//scope.
|
||||
@@ -187,7 +187,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
|
||||
// Detect and alert user to potential SCM status issues
|
||||
var checkSCMStatus = function(oldValue, newValue) {
|
||||
if (oldValue !== newValue) {
|
||||
if (oldValue !== newValue && !Empty(scope.project)) {
|
||||
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
||||
Rest.get()
|
||||
.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',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
|
||||
'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
|
||||
'md5Setup', 'ParseTypeChange', 'Wait'];
|
||||
'md5Setup', 'ParseTypeChange', 'Wait', 'Empty' ];
|
||||
|
||||
|
||||
function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList,
|
||||
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
|
||||
//scope.
|
||||
@@ -366,6 +366,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
||||
|
||||
// Detect and alert user to potential SCM status issues
|
||||
var checkSCMStatus = function() {
|
||||
if (!Empty(scope.project)) {
|
||||
Rest.setUrl(GetBasePath('projects') + scope.project + '/');
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
@@ -395,6 +396,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
|
||||
{ hdr: 'Error!', msg: 'Failed to get project ' + scope.project +'. GET returned status: ' + status });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Register a watcher on project_name. Refresh the playbook list on change.
|
||||
@@ -683,5 +685,5 @@ JobTemplatesEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList',
|
||||
'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 hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url',defaultUrl +
|
||||
'?' + form.fields[field].sourceField + '__' + 'iexact=:value');
|
||||
var watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
||||
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);
|
||||
|
||||
scope['lookUp' + name] = function() {
|
||||
|
||||
Reference in New Issue
Block a user