Repository: ambari Updated Branches: refs/heads/branch-2.5 08a998455 -> 0a9ae7544
AMBARI-19317. Specific group names cause some admin view menu items to be shown as selected (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8c875cf0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c875cf0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c875cf0 Branch: refs/heads/branch-2.5 Commit: 8c875cf07a1f449733d5088e8a8dc4e1d55fa6fc Parents: 08a9984 Author: Alex Antonenko <[email protected]> Authored: Thu Dec 29 16:33:51 2016 +0200 Committer: Alex Antonenko <[email protected]> Committed: Thu Dec 29 16:33:51 2016 +0200 ---------------------------------------------------------------------- .../ui/admin-web/app/scripts/controllers/NavbarCtrl.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8c875cf0/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js index cbf38e8..fe1d0c5 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/NavbarCtrl.js @@ -100,7 +100,12 @@ angular.module('ambariAdminConsole') angular.forEach(path.split('.'), function(routeObj) { route = route[routeObj]; }); - var r = new RegExp( route.url.replace(/(:\w+)/, '\\w+')); - return r.test($location.path()); + + // We should compare only root location part + var r = new RegExp( route.url.replace(/(:\w+)/, '\\w+')), + secondSlashUrlIndex = $location.path().indexOf('/', 1), + locationIsRoot = !~secondSlashUrlIndex, + location = locationIsRoot ? $location.path() : $location.path().slice(0, secondSlashUrlIndex); + return r.test(location); }; }]);
