KEYCLOAK-3943 Admin console issues when updating LDAP Storage provider

This commit is contained in:
mposolda 2016-11-21 14:21:45 +01:00
parent 2d4cda7eda
commit d8c8afe070
4 changed files with 16 additions and 6 deletions

View file

@ -319,7 +319,7 @@ public class AdminConsole {
@Path("messages.json")
@Produces(MediaType.APPLICATION_JSON)
public Properties getMessages(@QueryParam("lang") String lang) {
return AdminRoot.getMessages(session, realm, "admin-messages", lang);
return AdminRoot.getMessages(session, realm, lang, "admin-messages");
}
}

View file

@ -288,7 +288,16 @@ public class AdminRoot {
}
}
public static Properties getMessages(KeycloakSession session, RealmModel realm, String bundle, String lang) {
public static Properties getMessages(KeycloakSession session, RealmModel realm, String lang, String... bundles) {
Properties compound = new Properties();
for (String bundle : bundles) {
Properties current = getMessages(session, realm, lang, bundle);
compound.putAll(current);
}
return compound;
}
private static Properties getMessages(KeycloakSession session, RealmModel realm, String lang, String bundle) {
try {
Theme theme = getTheme(session, realm);
Locale locale = lang != null ? Locale.forLanguageTag(lang) : Locale.ENGLISH;

View file

@ -188,7 +188,7 @@ public class ComponentResource {
}
private Response localizedErrorResponse(ComponentValidationException cve) {
Properties messages = AdminRoot.getMessages(session, realm, "admin-messages", auth.getAuth().getToken().getLocale());
Properties messages = AdminRoot.getMessages(session, realm, auth.getAuth().getToken().getLocale(), "admin-messages", "messages");
Object[] localizedParameters = cve.getParameters()==null ? null : Arrays.asList(cve.getParameters()).stream().map((Object parameter) -> {

View file

@ -1728,6 +1728,7 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio
}
$scope.changed = false;
$scope.lastVendor = instance.config['vendor'][0];
}
initUserStorageSettings();
@ -1740,7 +1741,7 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio
}
if (!angular.equals($scope.instance.config['vendor'][0], $scope.lastVendor)) {
console.log("LDAP vendor changed");
console.log("LDAP vendor changed. Previous=" + $scope.lastVendor + " New=" + $scope.instance.config['vendor'][0]);
$scope.lastVendor = $scope.instance.config['vendor'][0];
if ($scope.lastVendor === "ad") {
@ -1787,8 +1788,8 @@ module.controller('LDAPUserStorageCtrl', function($scope, $location, Notificatio
$scope.save = function() {
$scope.changed = false;
if (!parseInt($scope.instance.config['batchSizeForSync'[0]])) {
$scope.instance.config['batchSizeForSync'][0] = DEFAULT_BATCH_SIZE;
if (!parseInt($scope.instance.config['batchSizeForSync'][0])) {
$scope.instance.config['batchSizeForSync'] = [ DEFAULT_BATCH_SIZE ];
} else {
$scope.instance.config['batchSizeForSync'][0] = parseInt($scope.instance.config.batchSizeForSync).toString();
}