Skip to content

Commit

Permalink
Merge pull request #3 from shazha/fix/PGBI#196
Browse files Browse the repository at this point in the history
Fix timestamps
  • Loading branch information
luserx0 authored Feb 13, 2020
2 parents f2fe4e2 + 975390b commit 70bd013
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/index_resources/index_resources.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
.module('app')
.controller('IndexResources', IndexResources);

IndexResources.$inject = ["resourceType", "resourceName", "Kong", "Alert", "parentType", "parent"];
IndexResources.$inject = ["resourceType", "resourceName", "Kong", "env", "Alert", "parentType", "parent"];

function IndexResources(resourceType, resourceName, Kong, Alert, parentType, parent) {
function IndexResources(resourceType, resourceName, Kong, env, Alert, parentType, parent) {
var vm = this;

vm.resources = null;
Expand Down Expand Up @@ -156,8 +156,13 @@
nextPage = response.offset ? fetchEndpoint + '&offset=' + encodeURIComponent(response.offset) : null;
nextPageLoading = false;

var isTimestampInSeconds = env.kong_version >= "0.14";

// appending related resources, if any.
vm.resources.forEach(function(resource) {
if (isTimestampInSeconds && resource.created_at) {
resource.created_at *= 1000;
}
if (!resource.api && resource.api_id) {
Kong.get('/apis/' + resource.api_id).then(function(api) {
resource.api = api;
Expand Down

0 comments on commit 70bd013

Please sign in to comment.