Show Tag / Taxonomy Listing in sorted order (cherry picked from commit c1efcf061d39d46ae184cd180455b001e0a33b75)
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/7d819153 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/7d819153 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/7d819153 Branch: refs/heads/0.7-incubating Commit: 7d819153545c2cbd6c1b0bbab4ad9ddb4d7cd5f6 Parents: f8bdac0 Author: kalyanikk <[email protected]> Authored: Thu Aug 11 14:54:19 2016 +0530 Committer: Madhan Neethiraj <[email protected]> Committed: Thu Dec 22 15:13:52 2016 -0800 ---------------------------------------------------------------------- .../js/views/business_catalog/TreeLayoutView.js | 5 ++++- .../public/js/views/search/SearchLayoutView.js | 2 +- dashboardv2/public/js/views/tag/TagLayoutView.js | 17 +++++++---------- dashboardv2/public/js/views/tag/addTagModalView.js | 6 +++++- 4 files changed, 17 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7d819153/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js index d9fc621..be47725 100644 --- a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js +++ b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js @@ -403,7 +403,10 @@ define(['require', } function createTerm() { - _.each(that.childCollection.fullCollection.models, function(model, key) { + that.childCollection.fullCollection.comparator = function(model) { + return model.get('name').toLowerCase(); + } + that.childCollection.fullCollection.sort().each(function(model, key) { var name = Utils.checkTagOrTerm(model.get('name'), true); var hrefUrl = "/api" + model.get('href').split("/api")[1]; if (name.name) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7d819153/dashboardv2/public/js/views/search/SearchLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index 7f5e364..f2b8a38 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -118,7 +118,7 @@ define(['require', this.ui.typeLov.empty(); var str = '<option></option>'; this.typecollection.fullCollection.comparator = function(model) { - return model.get('tags'); + return model.get('tags').toLowerCase(); } this.typecollection.fullCollection.sort().each(function(model) { str += '<option>' + model.get("tags") + '</option>'; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7d819153/dashboardv2/public/js/views/tag/TagLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 16c69c4..b1cb6cc 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -51,11 +51,7 @@ define(['require', events: function() { var events = {}; events["click " + this.ui.createTag] = 'onClickCreateTag'; - /* events["dblclick " + this.ui.tags] = function(e) { - this.onTagList(e, true); - }*/ events["click " + this.ui.tags] = 'onTagList'; - // events["click " + this.ui.referesh] = 'refereshClick'; events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag'; events["click " + this.ui.deleteTerm] = 'onDeleteTerm'; events['click ' + this.ui.refreshTag] = 'fetchCollections'; @@ -69,7 +65,6 @@ define(['require', _.extend(this, _.pick(options, 'globalVent', 'tag')); this.tagCollection = new VTagList(); this.collection = new Backbone.Collection(); - this.json = { "enumTypes": [], "traitTypes": [], @@ -157,16 +152,18 @@ define(['require', tagsAndTypeGenerator: function(collection, searchString) { var that = this, str = ''; - _.each(this[collection].fullCollection.models, function(model) { - var tagName = model.get("tags"); + that.tagCollection.fullCollection.comparator = function(model) { + return model.get('tags').toLowerCase(); + } + that.tagCollection.fullCollection.sort().each(function(model) { if (searchString) { - if (tagName.search(new RegExp(searchString, "i")) != -1) { - str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '" data-name="`' + tagName + '`" >' + tagName + '</a></li>' + str; + if (model.get('tags').search(new RegExp(searchString, "i")) != -1) { + str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name="`' + model.get('tags') + '`" >' + model.get('tags') + '</a></li>'; } else { return; } } else { - str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '" data-name="`' + tagName + '`">' + tagName + '</a></li>' + str; + str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + model.get('tags') + '" data-name="`' + model.get('tags') + '`">' + model.get('tags') + '</a></li>'; } }); this.ui.tagsParent.empty().html(str); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/7d819153/dashboardv2/public/js/views/tag/addTagModalView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js index 83a7ab0..2a0b004 100644 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ b/dashboardv2/public/js/views/tag/addTagModalView.js @@ -95,8 +95,12 @@ define(['require', }, this); }, tagsCollection: function() { + this.collection.fullCollection.comparator = function(model) { + return model.get('tags').toLowerCase(); + } + var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>'; - _.each(this.collection.fullCollection.models, function(obj, key) { + this.collection.fullCollection.sort().each(function(obj, key) { str += '<option>' + obj.get('tags') + '</option>'; }); this.ui.addTagOptions.html(str);
