Skip to content

Commit

Permalink
fix: Created Column now shows the correct time
Browse files Browse the repository at this point in the history
  • Loading branch information
shazha committed Mar 22, 2019
1 parent 7f67701 commit f5116e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 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 isTimeInSeconds = isKong1xVersion(env.kong_version);

// appending related resources, if any.
vm.resources.forEach(function(resource) {
if (resource.created_at && isTimeInSeconds) {
resource.created_at *= 1000;
}
if (!resource.api && resource.api_id) {
Kong.get('/apis/' + resource.api_id).then(function(api) {
resource.api = api;
Expand Down Expand Up @@ -226,5 +231,9 @@
});
});
};

function isKong1xVersion(versionStr) {
return versionStr >= "1.0.0" || versionStr.substring(0, 4) === "0.15"
}
}
})();

0 comments on commit f5116e6

Please sign in to comment.