KEYCLOAK-1257

This commit is contained in:
Stian Thorgersen 2015-05-05 06:33:13 +02:00
parent ad751e419c
commit 68be5dd12a
3 changed files with 15 additions and 13 deletions

View file

@ -454,8 +454,6 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif
$scope.changed = false;
if ($scope.create) {
UserFederationInstances.save({realm: realm.realm}, $scope.instance, function (data, headers) {
$scope.changed = false;
var l = headers().location;
var id = l.substring(l.lastIndexOf("/") + 1);
@ -479,7 +477,11 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif
};
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/user-federation");
if ($scope.create) {
$location.url("/realms/" + realm.realm + "/user-federation");
} else {
$route.reload();
}
};
$scope.remove = function() {
@ -514,7 +516,7 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif
});
module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, realm, instance, UserFederationInstances, UserFederationSync, RealmLDAPConnectionTester) {
module.controller('LDAPCtrl', function($scope, $location, $route, Notifications, Dialog, realm, instance, UserFederationInstances, UserFederationSync, RealmLDAPConnectionTester) {
console.log('LDAPCtrl');
var DEFAULT_BATCH_SIZE = "1000";
@ -620,9 +622,11 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
}
if ($scope.create) {
UserFederationInstances.save({realm: realm.realm}, $scope.instance, function () {
$scope.changed = false;
$location.url("/realms/" + realm.realm + "/user-federation");
UserFederationInstances.save({realm: realm.realm}, $scope.instance, function (data, headers) {
var l = headers().location;
var id = l.substring(l.lastIndexOf("/") + 1);
$location.url("/realms/" + realm.realm + "/user-federation/providers/" + $scope.instance.providerName + "/" + id);
Notifications.success("The provider has been created.");
});
} else {
@ -630,8 +634,7 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
instance: instance.id
},
$scope.instance, function () {
$scope.changed = false;
$location.url("/realms/" + realm.realm + "/user-federation");
$route.reload();
Notifications.success("The provider has been updated.");
});
@ -639,8 +642,7 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
};
$scope.reset = function() {
initFederationSettings();
$scope.instance = angular.copy(instance);
$route.reload();
};
$scope.cancel = function() {

View file

@ -93,7 +93,7 @@
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="create && access.manageUsers">
<button kc-save data-ng-show="changed">Save</button>
<button kc-save>Save</button>
<button kc-cancel data-ng-click="cancel()">Cancel</button>
</div>
</div>

View file

@ -232,7 +232,7 @@
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="create && access.manageUsers">
<button kc-save data-ng-show="changed">Save</button>
<button kc-save>Save</button>
<button kc-cancel data-ng-click="cancel()">Cancel</button>
</div>
</div>