diff --git a/src/js/controllers/targets.js b/src/js/controllers/targets.js index 5cadb33..b59f586 100644 --- a/src/js/controllers/targets.js +++ b/src/js/controllers/targets.js @@ -1,10 +1,14 @@ -angular.module('app').controller("TargetsController", ["$scope", "Kong", "$routeParams", "upstream", function ($scope, Kong, $routeParams, upstream) { +angular.module('app').controller("TargetsController", ["$scope", "Kong", "$routeParams", "upstream",'env', function ($scope, Kong, $routeParams, upstream, env) { $scope.targets = []; $scope.total = null; $scope.offset = null; $scope.searchResults = {}; $scope.searching = false; $scope.upstream = upstream; + + //To reduce confusion, the /upstreams/:upstream_name_or_id/targets/ has been updated to not show the full list of Targets anymore, but only the ones that are currently active in the load balancer. + //To retrieve the full history of Targets, you can now query /upstreams/:upstream_name_or_id/targets/all. The /upstreams/:upstream_name_or_id/targets/active endpoint has been removed. + //https://github.com/Kong/kong/pull/3049 $scope.active = true; $scope.title = ''; @@ -18,8 +22,14 @@ angular.module('app').controller("TargetsController", ["$scope", "Kong", "$route $scope.loadMore = function() { var page = '/upstreams/' + upstream.id + '/targets'; - if ($scope.active) { - page += "/active"; + if (env.kong_version.indexOf("0.12.")==-1) {//<0.12 + if ($scope.active){ + page += "/active"; + } + }else{//>=0.12 + if (!$scope.active){ + page += "/all"; + } } if ($scope.offset) { page += '?offset=' + $scope.offset + '&';