mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 17:28:51 -03:30
Merge pull request #7056 from jlmitch5/fixCTITLdapForm
fix ctit ldap search form fields in ui
This commit is contained in:
@@ -313,6 +313,15 @@ export default [
|
|||||||
populateTacacsProtocol(false);
|
populateTacacsProtocol(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$on('codeMirror_populated', function() {
|
||||||
|
let tab = $stateParams.currentTab;
|
||||||
|
if (tab === 'auth') {
|
||||||
|
startCodeMirrors();
|
||||||
|
codeInputInitialized = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
angular.extend(authVm, {
|
angular.extend(authVm, {
|
||||||
activeForm: activeForm,
|
activeForm: activeForm,
|
||||||
activeAuthForm: activeAuthForm,
|
activeAuthForm: activeAuthForm,
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ export default [
|
|||||||
// behind the comma.
|
// behind the comma.
|
||||||
if(key === "AD_HOC_COMMANDS"){
|
if(key === "AD_HOC_COMMANDS"){
|
||||||
$scope[key] = data[key].toString();
|
$scope[key] = data[key].toString();
|
||||||
}
|
} else if (key === "AUTH_LDAP_USER_SEARCH" || key === "AUTH_LDAP_GROUP_SEARCH") {
|
||||||
else {
|
$scope[key] = JSON.stringify(data[key]);
|
||||||
|
} else {
|
||||||
$scope[key] = ConfigurationUtils.arrayToList(data[key], key);
|
$scope[key] = ConfigurationUtils.arrayToList(data[key], key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,11 +325,12 @@ export default [
|
|||||||
else if($scope[key + '_field'].reset === "CUSTOM_LOGO"){
|
else if($scope[key + '_field'].reset === "CUSTOM_LOGO"){
|
||||||
$scope.$broadcast(key+'_reverted');
|
$scope.$broadcast(key+'_reverted');
|
||||||
}
|
}
|
||||||
else if($scope[key + '_field'].type === "textarea" && _.isArray($scope.configDataResolve[key].default)){
|
|
||||||
$scope[key] = ConfigurationUtils.arrayToList($scope[key], key);
|
|
||||||
}
|
|
||||||
else if($scope[key + '_field'].hasOwnProperty('codeMirror')){
|
else if($scope[key + '_field'].hasOwnProperty('codeMirror')){
|
||||||
$scope[key] = '{}';
|
if (key === "AUTH_LDAP_USER_SEARCH" || key === "AUTH_LDAP_GROUP_SEARCH") {
|
||||||
|
$scope[key] = '[]';
|
||||||
|
} else {
|
||||||
|
$scope[key] = '{}';
|
||||||
|
}
|
||||||
$scope.$broadcast('codeMirror_populated', key);
|
$scope.$broadcast('codeMirror_populated', key);
|
||||||
}
|
}
|
||||||
loginUpdate();
|
loginUpdate();
|
||||||
|
|||||||
@@ -9,16 +9,30 @@ export default ['$q',
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
listToArray: function(input) {
|
listToArray: function(input) {
|
||||||
if (input.indexOf('\n') !== -1) {
|
var payload;
|
||||||
|
|
||||||
|
if (input.indexOf('[') !== -1) {
|
||||||
|
try {
|
||||||
|
payload = JSON.parse(input);
|
||||||
|
|
||||||
|
if (!Array.isArray(payload)) {
|
||||||
|
payload = [];
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
payload = [];
|
||||||
|
}
|
||||||
|
} else if (input.indexOf('\n') !== -1) {
|
||||||
//Parse multiline input
|
//Parse multiline input
|
||||||
return input.replace(/^\s+|\s+$/g, "").split('\n');
|
payload = input.replace(/^\s+|\s+$/g, "").split('\n');
|
||||||
} else {
|
} else {
|
||||||
if (input === '') {
|
if (input === '' || input === '{}') {
|
||||||
return [];
|
payload = [];
|
||||||
} else {
|
} else {
|
||||||
return input.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/);
|
payload = input.replace(/^\s+|\s+$/g, "")
|
||||||
|
.split(/\s*,\s*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return payload;
|
||||||
},
|
},
|
||||||
|
|
||||||
arrayToList: function(input) {
|
arrayToList: function(input) {
|
||||||
|
|||||||
@@ -51,11 +51,16 @@ export default
|
|||||||
// converting yaml to json
|
// converting yaml to json
|
||||||
try {
|
try {
|
||||||
removeField(fld);
|
removeField(fld);
|
||||||
|
|
||||||
json_obj = jsyaml.load(scope[fld]);
|
json_obj = jsyaml.load(scope[fld]);
|
||||||
|
|
||||||
if ($.isEmptyObject(json_obj)) {
|
if ($.isEmptyObject(json_obj)) {
|
||||||
scope[fld] = "{}";
|
if (Array.isArray(json_obj)) {
|
||||||
}
|
scope[fld] = "[]";
|
||||||
else {
|
} else {
|
||||||
|
scope[fld] = "{}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
scope[fld] = JSON.stringify(json_obj, null, " ");
|
scope[fld] = JSON.stringify(json_obj, null, " ");
|
||||||
}
|
}
|
||||||
createField(onReady, onChange, fld);
|
createField(onReady, onChange, fld);
|
||||||
|
|||||||
Reference in New Issue
Block a user