NIFI-2840:

- Sorting the templates to ensure that the newest templates are listed first.

This closes #1391.
This commit is contained in:
Matt Gilman 2017-01-04 13:01:31 -05:00 committed by Pierre Villard
parent b1c9f0e764
commit 083d4043e0
1 changed files with 9 additions and 0 deletions

View File

@ -170,6 +170,15 @@ nf.ng.TemplateComponent = function (serviceProvider) {
}).done(function (response) {
var templates = response.templates;
if (nf.Common.isDefinedAndNotNull(templates) && templates.length > 0) {
// sort the templates
templates = templates.sort(function (one, two) {
var oneDate = nf.Common.parseDateTime(one.template.timestamp);
var twoDate = nf.Common.parseDateTime(two.template.timestamp);
// newest templates first
return twoDate.getTime() - oneDate.getTime();
});
var options = [];
$.each(templates, function (_, templateEntity) {
if (templateEntity.permissions.canRead === true) {