You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2017/01/04 18:24:54 UTC

nifi git commit: NIFI-2840: - Sorting the templates to ensure that the newest templates are listed first.

Repository: nifi
Updated Branches:
  refs/heads/master b1c9f0e76 -> 083d4043e


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

This closes #1391.


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/083d4043
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/083d4043
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/083d4043

Branch: refs/heads/master
Commit: 083d4043e06ce5bdab56131515e2213cf33fad67
Parents: b1c9f0e
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Jan 4 13:01:31 2017 -0500
Committer: Pierre Villard <pi...@gmail.com>
Committed: Wed Jan 4 19:24:37 2017 +0100

----------------------------------------------------------------------
 .../nf/canvas/header/components/nf-ng-template-component.js | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/083d4043/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-template-component.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-template-component.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-template-component.js
index 61b9c03..c671a1c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-template-component.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-template-component.js
@@ -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) {