Merge pull request #2532 from stianst/KEYCLOAK-2762
KEYCLOAK-2762 Renaming a realm without saving the form affects all li…
This commit is contained in:
commit
f2dd556323
2 changed files with 9 additions and 2 deletions
|
@ -203,6 +203,7 @@ module.controller('ObjectModalCtrl', function($scope, object) {
|
||||||
module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, serverInfo, $http, $location, Dialog, Notifications, Auth) {
|
module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, serverInfo, $http, $location, Dialog, Notifications, Auth) {
|
||||||
$scope.createRealm = !realm.realm;
|
$scope.createRealm = !realm.realm;
|
||||||
$scope.serverInfo = serverInfo;
|
$scope.serverInfo = serverInfo;
|
||||||
|
$scope.realmName = realm.realm;
|
||||||
|
|
||||||
if (Current.realm == null || Current.realm.realm != realm.realm) {
|
if (Current.realm == null || Current.realm.realm != realm.realm) {
|
||||||
for (var i = 0; i < Current.realms.length; i++) {
|
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;
|
$scope.changed = true;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
$scope.$watch('realmName', function() {
|
||||||
|
if (!angular.equals($scope.realmName, oldCopy.realm)) {
|
||||||
|
$scope.changed = true;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
var realmCopy = angular.copy($scope.realm);
|
var realmCopy = angular.copy($scope.realm);
|
||||||
|
realmCopy.realm = $scope.realmName;
|
||||||
$scope.changed = false;
|
$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 () {
|
Realm.update({ id : oldCopy.realm}, realmCopy, function () {
|
||||||
var data = Realm.query(function () {
|
var data = Realm.query(function () {
|
||||||
Current.realms = data;
|
Current.realms = data;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label" for="name"><span class="required">*</span> {{:: 'name' | translate}}</label>
|
<label class="col-md-2 control-label" for="name"><span class="required">*</span> {{:: 'name' | translate}}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input class="form-control" type="text" id="name" name="name" data-ng-model="realm.realm" autofocus required>
|
<input class="form-control" type="text" id="name" name="name" data-ng-model="realmName" autofocus required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue