Skip to content

Commit

Permalink
fix /upstream/targets/active api
Browse files Browse the repository at this point in the history
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. Thanks @hbagdi for tackling this backlog item! Kong/kong#3049
  • Loading branch information
Bruce committed Jan 27, 2018
1 parent fc49c66 commit de802d0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/js/controllers/targets.js
Original file line number Diff line number Diff line change
@@ -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 = '';

Expand All @@ -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 + '&';
Expand Down

0 comments on commit de802d0

Please sign in to comment.