KEYCLOAK-8250: Save not disabled properly in token settings
This commit is contained in:
1 parent
3be2c35561
commit
94f2ce2eae
1 file changed
+15
-11
@@ -1100,12 +1100,6 @@ module.controller('RealmTokenDetailCtrl', function($scope, Realm, realm, $http,
|
||||
var oldCopy = angular.copy($scope.realm);
|
||||
$scope.changed = false;
|
||||
|
||||
var refresh = function() {
|
||||
Realm.get($scope.realm.realm, function () {
|
||||
$scope.changed = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$watch('realm', function() {
|
||||
if (!angular.equals($scope.realm, oldCopy)) {
|
||||
$scope.changed = true;
|
||||
@@ -1113,16 +1107,26 @@ module.controller('RealmTokenDetailCtrl', function($scope, Realm, realm, $http,
|
||||
}, true);
|
||||
|
||||
$scope.$watch('actionLifespanId', function () {
|
||||
$scope.actionTokenAttribute = TimeUnit2.asUnit($scope.realm.attributes['actionTokenGeneratedByUserLifespan.' + $scope.actionLifespanId]);
|
||||
//Refresh and disable the button if attribute is empty
|
||||
if (!$scope.actionTokenAttribute.toSeconds()) {
|
||||
refresh();
|
||||
// changedActionLifespanId signals other watchers that we were merely
|
||||
// changing the dropdown and we should not enable 'save' button
|
||||
if ($scope.actionTokenAttribute && $scope.actionTokenAttribute.hasOwnProperty('time')) {
|
||||
$scope.changedActionLifespanId = true;
|
||||
}
|
||||
|
||||
$scope.actionTokenAttribute = TimeUnit2.asUnit($scope.realm.attributes['actionTokenGeneratedByUserLifespan.' + $scope.actionLifespanId]);
|
||||
}, true);
|
||||
|
||||
$scope.$watch('actionTokenAttribute', function () {
|
||||
if ($scope.actionLifespanId != null && $scope.actionTokenAttribute != null) {
|
||||
if ($scope.actionLifespanId === null) return;
|
||||
|
||||
if ($scope.changedActionLifespanId) {
|
||||
$scope.changedActionLifespanId = false;
|
||||
return;
|
||||
} else {
|
||||
$scope.changed = true;
|
||||
}
|
||||
|
||||
if ($scope.actionTokenAttribute !== null) {
|
||||
$scope.realm.attributes['actionTokenGeneratedByUserLifespan.' + $scope.actionLifespanId] = $scope.actionTokenAttribute.toSeconds();
|
||||
}
|
||||
}, true);
|
||||
|
||||
Reference in new issue
Block a user