diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
index cfda116..311175d 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js
@@ -297,7 +297,8 @@ module.config([ '$routeProvider', function($routeProvider) {
controller : 'ApplicationListCtrl'
})
.when('/', {
- templateUrl : 'partials/home.html'
+ templateUrl : 'partials/home.html',
+ controller : 'HomeCtrl'
})
.otherwise({
templateUrl : 'partials/notfound.html'
@@ -332,6 +333,8 @@ module.factory('errorInterceptor', function($q, $window, $rootScope, $location,
console.log('session timeout?');
Auth.loggedIn = false;
window.location = '/auth-server/rest/saas/login?path=' + $location.path();
+ } else if (response.status == 404) {
+ Notifications.error("Not found");
} else if (response.status) {
if (response.data && response.data.errorMessage) {
Notifications.error(response.data.errorMessage);
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
index f2b1632..5fd7365 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js
@@ -20,8 +20,25 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location
});
});
-module.controller('HomeCtrl', function($scope, Realm, Current) {
- console.debug("home");
+module.controller('HomeCtrl', function(Realm, $location) {
+ Realm.query(null, function(realms) {
+ var realm;
+ if (realms.length == 1) {
+ realm = realms[0].id;
+ } else if (realms.length == 2) {
+ if (realms[0].realm == 'Keycloak Administration') {
+ realm = realms[1].id;
+ } else if (realms[1].realm == 'Keycloak Administration') {
+ realm = realms[0].id;
+ }
+ }
+
+ if (realm) {
+ $location.url('/realms/' + realm);
+ } else {
+ $location.url('/realms');
+ }
+ });
});
module.controller('RealmListCtrl', function($scope, Realm, Current) {
@@ -145,9 +162,9 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
$scope.remove = function() {
Dialog.confirmDelete($scope.realm.realm, 'realm', function() {
Realm.remove({ id : $scope.realm.id }, function() {
- Current.realms = Realm.get();
- $location.url("/realms");
+ Current.realms = Realm.query();
Notifications.success("The realm has been deleted.");
+ $location.url("/");
});
});
};
diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html
index 8b8c017..8593ba0 100755
--- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html
+++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html
@@ -1,7 +1,7 @@
<div class="header rcue">
<div class="navbar utility">
<div class="navbar-inner clearfix container">
- <h1><a href="#/realms/{{realm.id}}"><strong>Keycloak</strong> Central Login</a></h1>
+ <h1><a href="#/"><strong>Keycloak</strong> Central Login</a></h1>
<ul class="nav pull-right" data-ng-hide="auth.loggedIn">
<li><a href="/auth-server/rest/saas/login?path={{fragment}}">Login</a></li>
<li><a href="/auth-server/rest/saas/registrations">Register</a></li>