Repository: incubator-atlas Updated Branches: refs/heads/master a10444d39 -> 65b1dee9f
ATLAS-1001 UI Paginate search APIs (kevalbhatt18 via sumasai) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/65b1dee9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/65b1dee9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/65b1dee9 Branch: refs/heads/master Commit: 65b1dee9f430719d9cfde696bd263e91ad866df4 Parents: a10444d Author: Suma Shivaprasad <[email protected]> Authored: Fri Jul 22 17:26:28 2016 -0700 Committer: Suma Shivaprasad <[email protected]> Committed: Fri Jul 22 17:34:35 2016 -0700 ---------------------------------------------------------------------- .../audit/AuditTableLayoutView_tmpl.html | 4 +- .../search/SearchResultLayoutView_tmpl.html | 15 ++++- .../js/views/audit/AuditTableLayoutView.js | 2 +- .../js/views/search/SearchResultLayoutView.js | 63 ++++++++++++++++++-- release-log.txt | 3 +- 5 files changed, 76 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/65b1dee9/dashboardv2/public/js/templates/audit/AuditTableLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/audit/AuditTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/audit/AuditTableLayoutView_tmpl.html index 2bf3880..533f596 100644 --- a/dashboardv2/public/js/templates/audit/AuditTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/audit/AuditTableLayoutView_tmpl.html @@ -23,10 +23,10 @@ <div id="r_auditTableLayoutView"></div> <ul class="pager"> <li> - <button data-id="previousAuditData">Previous</button> + <button class="btn" data-id="previousAuditData">Previous</button> </li> <li> - <button data-id="nextAuditData">Next</button> + <button class="btn" data-id="nextAuditData">Next</button> </li> </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/65b1dee9/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index e3b3cc9..8e860d8 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -19,5 +19,18 @@ <i class="fa fa-refresh fa-spin-custom"></i> </div> <div class="ellipsis"><span class="searchResult" style=" font-size: 16px;"></span></div> - <div id="r_searchResultTableLayoutView" class="searchTable"></div> + <div class="searchTable"> + <div id="r_searchResultTableLayoutView"> + </div> + <div data-id="paginationDiv" style="display:none"> + <ul class="pager"> + <li> + <button class="btn" data-id="previousData" disabled=true>Previous</button> + </li> + <li> + <button class="btn" data-id="nextData">Next</button> + </li> + </ul> + </div> + </div> </div> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/65b1dee9/dashboardv2/public/js/views/audit/AuditTableLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/audit/AuditTableLayoutView.js b/dashboardv2/public/js/views/audit/AuditTableLayoutView.js index 23cc50d..7e5216d 100644 --- a/dashboardv2/public/js/views/audit/AuditTableLayoutView.js +++ b/dashboardv2/public/js/views/audit/AuditTableLayoutView.js @@ -101,12 +101,12 @@ define(['require', that.$('.auditTable').show(); options.previous.attr('disabled', true); if (that.entityCollection.models.length <= 1) { - that.pervOld.pop(); options.next.attr('disabled', true); } if (that.entityCollection.models.length == 1 && that.next == that.entityCollection.last().get('eventKey')) { options.next.attr('disabled', true); options.previous.removeAttr("disabled"); + that.entityCollection.reset(); } else { if (that.entityCollection.models.length > 0) { that.next = that.entityCollection.last().get('eventKey'); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/65b1dee9/dashboardv2/public/js/views/search/SearchResultLayoutView.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index eb63420..b30de40 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -50,7 +50,10 @@ define(['require', addTag: '[data-id="addTag"]', addTerm: '[data-id="addTerm"]', showMoreLess: '[data-id="showMoreLess"]', - showMoreLessTerm: '[data-id="showMoreLessTerm"]' + showMoreLessTerm: '[data-id="showMoreLessTerm"]', + paginationDiv: '[data-id="paginationDiv"]', + previousData: "[data-id='previousData']", + nextData: "[data-id='nextData']" }, /** ui events hash */ @@ -97,6 +100,8 @@ define(['require', $(e.currentTarget).find('span').text('Show less'); } }; + events["click " + this.ui.nextData] = "onClicknextData"; + events["click " + this.ui.previousData] = "onClickpreviousData"; return events; }, /** @@ -105,15 +110,22 @@ define(['require', */ initialize: function(options) { _.extend(this, _.pick(options, 'globalVent', 'vent', 'value')); + var pagination = ""; this.entityModel = new VEntity(); this.searchCollection = new VSearchList(); + this.limit = 25; this.fetchList = 0; + if (options.value.searchType == "dsl") { + pagination = false; + } else { + pagination = true; + } this.commonTableOptions = { collection: this.searchCollection, includeFilter: false, - includePagination: true, + includePagination: pagination, includePageSize: false, - includeFooterRecords: true, + includeFooterRecords: false, includeSizeAbleColumns: false, gridOpts: { emptyText: 'No Record found!', @@ -162,7 +174,6 @@ define(['require', }, this); }, onRender: function() { - //this.renderTableLayoutView(); var value = {}, that = this; if (this.value) { @@ -171,7 +182,6 @@ define(['require', value = { 'query': '', 'searchType': 'fulltext' - }; } this.fetchCollection(value); @@ -193,14 +203,22 @@ define(['require', if (Globals.searchApiCallRef) { Globals.searchApiCallRef.abort(); } + $.extend(this.searchCollection.queryParams, { limit: this.limit }); if (value) { if (value.searchType) { this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType; + if (value.searchType === "dsl") { + $.extend(this.searchCollection.queryParams, { limit: this.limit }); + this.offset = 0; + } } _.extend(this.searchCollection.queryParams, { 'query': value.query }); } Globals.searchApiCallRef = this.searchCollection.fetch({ success: function() { + if (that.searchCollection.length === 0) { + that.ui.nextData.attr('disabled', true); + } Globals.searchApiCallRef = undefined; if (that.searchCollection.toJSON().length == 0) { that.checkTableFetch(); @@ -264,6 +282,11 @@ define(['require', this.$('.fontLoader').hide(); this.$('.searchTable').show(); this.$('.searchResult').show(); + if (this.value.searchType == "dsl") { + this.ui.paginationDiv.show(); + } else { + this.ui.paginationDiv.hide(); + } } }, getEntityTableColumns: function() { @@ -555,7 +578,35 @@ define(['require', that.fetchCollection(); } }); - } + }, + onClicknextData: function() { + var that = this; + this.ui.previousData.removeAttr("disabled"); + $.extend(this.searchCollection.queryParams, { + offset: function() { + that.offset = that.offset + that.limit; + return that.offset; + } + }); + if (this.offset > this.limit) { + this.ui.nextData.attr('disabled', true); + } + this.fetchCollection(); + }, + onClickpreviousData: function() { + var that = this; + this.ui.nextData.removeAttr("disabled"); + $.extend(this.searchCollection.queryParams, { + offset: function() { + that.offset = that.offset - that.limit; + return that.offset; + } + }); + if (this.offset <= that.limit) { + this.ui.previousData.attr('disabled', true); + } + this.fetchCollection(); + }, }); return SearchResultLayoutView; }); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/65b1dee9/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 9a26e88..79aee37 100644 --- a/release-log.txt +++ b/release-log.txt @@ -6,8 +6,9 @@ INCOMPATIBLE CHANGES: ALL CHANGES: +ATLAS-1001 UI Paginate search APIs (kevalbhatt18 via sumasai) ATLAS-1042 Performance improvement changes for propertykey+typeName based queries (sumasai via shwethags) -ATLAS-1036 Multiple instances of AtlasPluginClassloader getting initialized (sumasai, mneethiraj) +ATLAS-1038 Multiple instances of AtlasPluginClassloader getting initialized (sumasai, mneethiraj) ATLAS-1033 fix for issues flagged by Coverity scan (mneethiraj via sumasai) ATLAS-1036 Compilation error on java 1.8 - GraphBackedDiscoveryService (shwethags via sumasai) ATLAS-1034 Incorrect Falcon hook impl class name in Falcon hook shim (mneethiraj via shwethags)
