(function () {
    "use strict";

    function UsersOverviewController($scope, $location, $timeout, navigationService, localizationService) {

        var vm = this;
        var usersUri = $location.search().subview;
        if (!usersUri) {
            $location.search("subview", "users");
            //exit after this, we don't want to initialize anything further since this
            //is going to change the route
            return;
        }

        //note on the below, we dont assign a view unless it's the right route since if we did that it will load in that controller
        //for the view which is unecessary and will cause extra overhead/requests to occur
        vm.page = {};
        vm.page.labels = {};
        vm.page.name = "";
        vm.page.navigation = [];

        function onInit() {

            loadNavigation();

            setPageName();

            $timeout(function () {
                navigationService.syncTree({ tree: "users", path: "-1" });
            });

        }

        function loadNavigation() {

            var labels = ["sections_users", "general_groups"];

            localizationService.localizeMany(labels).then(function(data){
                vm.page.labels.users = data[0];
                vm.page.labels.groups = data[1];

                vm.page.navigation = [
                    {
                        "name": vm.page.labels.users,
                        "icon": "icon-user",
                        "action": function() {
                          $location.search("subview", "users")
                        },
                        "view": !usersUri || usersUri === "users" ? "views/users/views/users/users.html" : null,
                        "active": !usersUri || usersUri === "users"
                    },
                    {
                        "name": vm.page.labels.groups,
                        "icon": "icon-users",
                        "action": function () {
                          $location.search("subview", "groups")
                        },
                        "view": usersUri === "groups" ? "views/users/views/groups/groups.html" : null,
                        "active": usersUri === "groups"
                    }
                ];
            });
        }

        function setPageName() {
            localizationService.localize("user_userManagement").then(function(data){
                vm.page.name = data;
            })
        }
 
        onInit();

    }

    angular.module("umbraco").controller("Umbraco.Editors.Users.OverviewController", UsersOverviewController);

})();

@@ -1741,32 +1741,74 @@
  %7C%7C usersUri ===
+ %22users%22,%0A                        %22alias%22:
  %22users%22%0A       
@@ -2243,16 +2243,63 @@
 %22groups%22
+,%0A                        %22alias%22: %22userGroups%22
 %0A       

add alias to user subviews to fix broken track by