$scope.getServices = function()

in frontend/app/scripts/modules/topology/controllers/topologyCtrl.js [21:68]


        $scope.getServices = function(appId) {
            $(".loader").show();
            $scope.allAppId = [];
            $scope.microServices = [];
            $scope.prosAndCons = [];
            $scope.appId = '';

            var url = apiConstant.api.allServices.url;
            var method = apiConstant.api.allServices.method;
            httpService.apiRequest(url, method).then(function(response) {
                $(".loader").hide();
                if (response && response.data && response.data.allServicesDetail && response.data.allServicesDetail.length > 0) {
                    $scope.allServicesDetail = response.data.allServicesDetail;
                    angular.forEach(response.data.allServicesDetail, function(service) {
                        if (!$scope.allAppId.includes(service.microService.appId) && service.microService.serviceName.toLowerCase() !== 'servicecenter') {
                            $scope.allAppId.push(service.microService.appId);
                        }
                    });
                    if ($scope.allServicesDetail.length > 100){
                        $scope.appId = $scope.allAppId[0];
                    } else {
                        $scope.allAppId.push("All");
                        $scope.appId = appId ? appId : "All";
                    }

                    if ($scope.appId === "All") {
                        $scope.microServices = [];
                        $scope.prosAndCons = [];
                        angular.forEach($scope.allAppId, function(appId) {
                            $scope.getDependencies(appId);
                        });
                        createTopology();
                    } else {
                        $scope.microServices = [];
                        $scope.prosAndCons = [];
                        $scope.getDependencies(appId);
                        createTopology();
                    }
                } else {
                    $scope.allAppId = [];
                    document.getElementById("topology").innerHTML = "";
                }
            }, function(error) {
                $(".loader").hide();
                $scope.allAppId = [];
                document.getElementById("topology").innerHTML = "";
            });
        }