mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
Fixed bug where typing in scm credential when adding/editing project wouldn't work
This commit is contained in:
@@ -137,6 +137,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
|
|||||||
},
|
},
|
||||||
ngShow: "scm_type && scm_type.value !== 'manual'",
|
ngShow: "scm_type && scm_type.value !== 'manual'",
|
||||||
sourceModel: 'credential',
|
sourceModel: 'credential',
|
||||||
|
awLookupType: 'scm_credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)',
|
||||||
subForm: 'sourceSubForm'
|
subForm: 'sourceSubForm'
|
||||||
|
|||||||
@@ -482,6 +482,7 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
autopopulateLookup,
|
autopopulateLookup,
|
||||||
modelKey = attrs.ngModel,
|
modelKey = attrs.ngModel,
|
||||||
modelName = attrs.source,
|
modelName = attrs.source,
|
||||||
|
lookupType = attrs.awlookuptype,
|
||||||
watcher = attrs.awRequiredWhen || undefined,
|
watcher = attrs.awRequiredWhen || undefined,
|
||||||
watchBasePath;
|
watchBasePath;
|
||||||
|
|
||||||
@@ -516,10 +517,14 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
basePath = GetBasePath(elm.attr('data-basePath')) || elm.attr('data-basePath');
|
basePath = GetBasePath(elm.attr('data-basePath')) || elm.attr('data-basePath');
|
||||||
switch(modelName) {
|
let switchType = lookupType ? lookupType : modelName;
|
||||||
|
switch(switchType) {
|
||||||
case 'credential':
|
case 'credential':
|
||||||
query = '?kind=ssh&role_level=use_role';
|
query = '?kind=ssh&role_level=use_role';
|
||||||
break;
|
break;
|
||||||
|
case 'scm_credential':
|
||||||
|
query = '?kind=scm&role_level=use_role';
|
||||||
|
break;
|
||||||
case 'network_credential':
|
case 'network_credential':
|
||||||
query = '?kind=net&role_level=use_role';
|
query = '?kind=net&role_level=use_role';
|
||||||
break;
|
break;
|
||||||
@@ -596,12 +601,12 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
function applyValidationStrategy(viewValue, ctrl) {
|
function applyValidationStrategy(viewValue, ctrl) {
|
||||||
|
|
||||||
// use supplied data attributes to build an endpoint, query, resolve outstanding promise
|
// use supplied data attributes to build an endpoint, query, resolve outstanding promise
|
||||||
function applyValidation(viewValue) {
|
function applyValidation(viewValue) {console.log(viewValue);
|
||||||
basePath = GetBasePath(elm.attr('data-basePath')) || elm.attr('data-basePath');
|
basePath = GetBasePath(elm.attr('data-basePath')) || elm.attr('data-basePath');
|
||||||
query = elm.attr('data-query');
|
query = elm.attr('data-query');
|
||||||
query = query.replace(/\:value/, encodeURIComponent(viewValue));
|
query = query.replace(/\:value/, encodeURIComponent(viewValue));
|
||||||
|
|
||||||
let base = ctrl.$name.split('_name')[0];
|
let base = lookupType ? lookupType : ctrl.$name.split('_name')[0];
|
||||||
if (attrs.watchbasepath !== undefined && scope[attrs.watchbasepath] !== undefined) {
|
if (attrs.watchbasepath !== undefined && scope[attrs.watchbasepath] !== undefined) {
|
||||||
basePath = scope[attrs.watchbasepath];
|
basePath = scope[attrs.watchbasepath];
|
||||||
query += '&role_level=use_role';
|
query += '&role_level=use_role';
|
||||||
@@ -612,6 +617,9 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
case 'credential':
|
case 'credential':
|
||||||
query += '&kind=ssh&role_level=use_role';
|
query += '&kind=ssh&role_level=use_role';
|
||||||
break;
|
break;
|
||||||
|
case 'scm_credential':
|
||||||
|
query += '&kind=scm&role_level=use_role';
|
||||||
|
break;
|
||||||
case 'network_credential':
|
case 'network_credential':
|
||||||
query += '&kind=net&role_level=use_role';
|
query += '&kind=net&role_level=use_role';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1384,6 +1384,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += `data-basePath="${field.basePath}"`;
|
html += `data-basePath="${field.basePath}"`;
|
||||||
html += `data-source="${field.sourceModel}"`;
|
html += `data-source="${field.sourceModel}"`;
|
||||||
html += `data-query="?${field.sourceField}__iexact=:value"`;
|
html += `data-query="?${field.sourceField}__iexact=:value"`;
|
||||||
|
html += (field.awLookupType !== undefined) ? ` data-awLookupType=${field.awLookupType} ` : "";
|
||||||
html += (field.autopopulateLookup !== undefined) ? ` autopopulateLookup=${field.autopopulateLookup} ` : "";
|
html += (field.autopopulateLookup !== undefined) ? ` autopopulateLookup=${field.autopopulateLookup} ` : "";
|
||||||
html += (field.watchBasePath !== undefined) ? ` watchBasePath=${field.watchBasePath} ` : "";
|
html += (field.watchBasePath !== undefined) ? ` watchBasePath=${field.watchBasePath} ` : "";
|
||||||
html += `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 300, 'blur': 0 } }"`;
|
html += `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 300, 'blur': 0 } }"`;
|
||||||
|
|||||||
Reference in New Issue
Block a user