From 22b28cb0236ae09cdd156bcf0ffe75f61d0d7508 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Sun, 4 Aug 2013 20:52:03 -0400 Subject: [PATCH 1/2] nav improvements --- .../main/webapp/saas/admin/js/controllers.js | 26 +++++++++++-------- .../main/webapp/saas/admin/partials/menu.html | 4 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js index c8474fd796..dbcf2807c7 100755 --- a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js +++ b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js @@ -5,7 +5,7 @@ var module = angular.module('keycloak.controllers', [ 'keycloak.services' ]); var realmslist = {}; -module.controller('GlobalCtrl', function($scope, $http, Auth, $location, Notifications) { +module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location, Notifications) { $scope.addMessage = function() { Notifications.success("test"); }; @@ -19,6 +19,7 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, $location, Notific }); $http.get('/auth-server/rest/saas/admin/realms').success(function(data) { + Current.realms = data; var count = 0; var showrealm = false; var id = null; @@ -34,6 +35,7 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, $location, Notific if (showrealm) { console.log('redirecting'); + Current.realm = Current.realms[id]; $location.url("/realms/" + id); } else { console.log('not redirecting'); @@ -158,22 +160,28 @@ module.controller('RealmListCtrl', function($scope, Realm, Current) { Current.realms = $scope.realms; }); -module.controller('RealmDropdownCtrl', function($scope, Realm, Current, $location) { - console.log('test log writing'); - Current.realms = Realm.get(); +module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $location) { +// Current.realms = Realm.get(); $scope.current = Current; $scope.changeRealm = function() { - console.log('select box changed'); for (var id in Current.realms) { var val = Current.realms[id]; - console.log('checking: ' + val); if (val == Current.realm) { - console.log("redirect to: /realms/" + id); $location.url("/realms/" + id); break; } } }; + $scope.showNav = function() { + var show = false; + for (var key in Current.realms) { + if (typeof Current.realms[key] != "function") { + show = true; + break; + } + } + return Auth.loggedIn && show; + } }); module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $location, Dialog, Notifications) { @@ -275,10 +283,6 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $lo var data = Realm.get(function() { Current.realms = data; Current.realm = Current.realms[id]; - console.log('Current.realms[id]: ' + Current.realms[id]); - console.log('data[id]: ' + data[id]); - console.log('Current.realm.name: ' + Current.realm.name); - }); $location.url("/realms/" + id); Notifications.success("Created realm"); diff --git a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html index 6d6423d49f..f0e52ac84b 100755 --- a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html +++ b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html @@ -12,8 +12,8 @@ --> -

Realm:

- From 37348fce3a1af5a5ac1e1d74af921d8be61fee43 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Sun, 4 Aug 2013 21:53:26 -0400 Subject: [PATCH 2/2] small improvents --- .../src/main/webapp/saas/admin/js/controllers.js | 6 ++++-- .../src/main/webapp/saas/admin/partials/menu.html | 6 ++++-- .../webapp/saas/admin/partials/realm-menu.html | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js index dbcf2807c7..7335234f09 100755 --- a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js +++ b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/js/controllers.js @@ -176,10 +176,12 @@ module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $l var show = false; for (var key in Current.realms) { if (typeof Current.realms[key] != "function") { + if (Current.realms[key] == Current.realm) { + $scope.currentRealmId = key; + } show = true; - break; } - } + } return Auth.loggedIn && show; } }); diff --git a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html index f0e52ac84b..a7b51ae686 100755 --- a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html +++ b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/menu.html @@ -12,7 +12,9 @@ --> -

Realm:

+ @@ -30,7 +32,7 @@ diff --git a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/realm-menu.html b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/realm-menu.html index bfdbbe5bf0..32bd251998 100755 --- a/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/realm-menu.html +++ b/examples/as7-eap-demo/server/src/main/webapp/saas/admin/partials/realm-menu.html @@ -1,11 +1,21 @@
\ No newline at end of file