(function ()()

in src/Sfx/App/Scripts/Services/RoutesService.ts [139:286]


    (function () {

        /**
         * This will create two routes per path in the RouteService; One route that maps to route, and another that maps to route/tab/.
         * @param $routeProvider
         * @param paths
         * @param route
         */
        function whenWithTabs($routeProvider, paths, route) {
            // We'll change search parameters on the fly (for theme etc.), should not reload the page.
            route.reloadOnSearch = false;

            // We don't need to conditional here; ADAL is set at a more global level, so, if it's enabled, treat each route as ADAL enabled.
            route.requireADLogin = true;

            if (!_.isArray(paths)) {
                paths = [paths];
            }

            _.each(paths, (path: string) => {
                $routeProvider
                    .when(path, route)
                    .when(_.trimEnd(path, "/") + "/tab/:tabId", route);
            });
        };

        let module = angular.module("routes", ["ngRoute"]);

        module.factory("routes", ["$interval", "$location", ($interval, $location) => new RoutesService($interval, $location)]);

        module.config(["$routeProvider", "$httpProvider", function ($routeProvider, $httpProvider) {
            whenWithTabs($routeProvider, "/", {
                templateUrl: "partials/cluster.html",
                controller: "ClusterViewController",
                controllerAs: "clusterCtrl"
            });
            whenWithTabs($routeProvider, "/apps", {
                templateUrl: "partials/apps.html",
                controller: "AppsViewController",
                controllerAs: "appsCtrl"
            });
            whenWithTabs($routeProvider, "/system/apps", {
                templateUrl: "partials/system-apps.html",
                controller: "SystemAppsViewController",
                controllerAs: "systemAppsCtrl"
            });
            whenWithTabs($routeProvider, "/nodes", {
                templateUrl: "partials/nodes.html",
                controller: "NodesViewController",
                controllerAs: "nodesCtrl"
            });
            whenWithTabs($routeProvider, "/node/:nodeName", {
                templateUrl: "partials/node.html",
                controller: "NodeViewController",
                controllerAs: "nodeCtrl"
            });
            whenWithTabs($routeProvider, "/node/:nodeName/deployedapp/:appId", {
                templateUrl: "partials/deployed-app.html",
                controller: "DeployedAppViewController",
                controllerAs: "deployedAppCtrl"
            });
            whenWithTabs($routeProvider, "/networks", {
                templateUrl: "partials/networks.html",
                controller: "NetworksViewController",
                controllerAs: "networksCtrl"
            });
            whenWithTabs($routeProvider, "/network/:networkName", {
                templateUrl: "partials/network.html",
                controller: "NetworkViewController",
                controllerAs: "networkCtrl"
            });
            whenWithTabs($routeProvider,
                [
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId",
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/activationid/:activationId"
                ], {
                    templateUrl: "partials/deployed-service-package.html",
                    controller: "DeployedServiceViewController",
                    controllerAs: "deployedServicePackageCtrl"
                });
            whenWithTabs($routeProvider,
                [
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/codepackages",
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/activationid/:activationId/codepackages"
                ], {
                    templateUrl: "partials/deployed-code-packages.html",
                    controller: "DeployedServiceCodePackagesViewController",
                    controllerAs: "deployedCodePackagesCtrl"
                });
            whenWithTabs($routeProvider,
                [
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/replicas",
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/activationid/:activationId/replicas"
                ], {
                    templateUrl: "partials/deployed-replicas.html",
                    controller: "DeployedServiceReplicasViewController",
                    controllerAs: "deployedReplicasCtrl"
                });
            whenWithTabs($routeProvider,
                [
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/partition/:partitionId/replica/:replicaId",
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/activationid/:activationId/partition/:partitionId/replica/:replicaId"
                ], {
                    templateUrl: "partials/deployed-replica.html",
                    controller: "DeployedReplicaViewController",
                    controllerAs: "deployedReplicaCtrl"
                });
            whenWithTabs($routeProvider,
                [
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/codepackage/:codePackageName",
                    "/node/:nodeName/deployedapp/:appId/deployedservice/:serviceId/activationid/:activationId/codepackage/:codePackageName"
                ], {
                    templateUrl: "partials/deployed-code-package.html",
                    controller: "DeployedCodePackageViewController",
                    controllerAs: "codePackageCtrl"
                });
            whenWithTabs($routeProvider, "/apptype/:appTypeName", {
                templateUrl: "partials/app-type.html",
                controller: "AppTypeViewController",
                controllerAs: "appTypeCtrl"
            });
            whenWithTabs($routeProvider, "/apptype/:appTypeName/app/:appId", {
                templateUrl: "partials/app.html",
                controller: "AppViewController",
                controllerAs: "appCtrl"
            });
            whenWithTabs($routeProvider, "/apptype/:appTypeName/app/:appId/service/:serviceId", {
                templateUrl: "partials/service.html",
                controller: "ServiceViewController",
                controllerAs: "serviceCtrl"
            });
            whenWithTabs($routeProvider, "/apptype/:appTypeName/app/:appId/service/:serviceId/partition/:partitionId", {
                templateUrl: "partials/partition.html",
                controller: "PartitionViewController",
                controllerAs: "partitionCtrl"
            });
            whenWithTabs($routeProvider, "/apptype/:appTypeName/app/:appId/service/:serviceId/partition/:partitionId/replica/:replicaId", {
                templateUrl: "partials/replica.html",
                controller: "ReplicaViewController",
                controllerAs: "replicaCtrl"
            });
            $routeProvider.otherwise({
                templateUrl: "partials/cluster.html",
                controller: "ClusterViewController",
                controllerAs: "clusterCtrl"
            });
        }]);
    })();