From 61ae15cf56f066e5324d1e7fde6e6a82fae2e932 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 7 Apr 2016 06:59:21 +0200 Subject: [PATCH] KEYCLOAK-2762 Renaming a realm without saving the form affects all links in Console --- .../theme/base/admin/resources/js/controllers/realm.js | 9 ++++++++- .../base/admin/resources/partials/realm-detail.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index 060f08fbff..539401643f 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -203,6 +203,7 @@ module.controller('ObjectModalCtrl', function($scope, object) { module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, serverInfo, $http, $location, Dialog, Notifications, Auth) { $scope.createRealm = !realm.realm; $scope.serverInfo = serverInfo; + $scope.realmName = realm.realm; if (Current.realm == null || Current.realm.realm != realm.realm) { for (var i = 0; i < Current.realms.length; i++) { @@ -228,11 +229,17 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, ser $scope.changed = true; } }, true); + $scope.$watch('realmName', function() { + if (!angular.equals($scope.realmName, oldCopy.realm)) { + $scope.changed = true; + } + }, true); $scope.save = function() { var realmCopy = angular.copy($scope.realm); + realmCopy.realm = $scope.realmName; $scope.changed = false; - var nameChanged = !angular.equals($scope.realm.realm, oldCopy.realm) + var nameChanged = !angular.equals($scope.realmName, oldCopy.realm); Realm.update({ id : oldCopy.realm}, realmCopy, function () { var data = Realm.query(function () { Current.realms = data; diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html b/themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html index 19561ea5d6..6a694f1f11 100755 --- a/themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html @@ -5,7 +5,7 @@
- +