Commit 05277c27 by Shwetha GS

ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)

parent 4bc3e738
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="ellipsis"><span class="searchResult" style=" font-size: 16px;"></span></div> <div class="ellipsis"><span class="searchResult" style=" font-size: 16px;"></span></div>
<div class="searchTable"> <div class="searchTable">
<span class="labelShowRecord pull-left" data-id="pageRecordText"></span> <span class="labelShowRecord pull-left" data-id="pageRecordText"></span>
<div data-id="paginationDiv" style="display:none"> <div data-id="paginationDiv">
<ul class="pager pull-right"> <ul class="pager pull-right">
<li> <li>
<button class="btn" data-id="previousData" disabled=true>Previous</button> <button class="btn" data-id="previousData" disabled=true>Previous</button>
......
...@@ -308,9 +308,9 @@ define(['require', ...@@ -308,9 +308,9 @@ define(['require',
renderFooterRecords: function(collectionState) { renderFooterRecords: function(collectionState) {
var collState = collectionState; var collState = collectionState;
var totalRecords = collState.totalRecords || 0; var totalRecords = collState.totalRecords || 0;
var pageStartIndex = totalRecords ? (collState.currentPage * collState.pageSize) : 1; var pageStartIndex = totalRecords ? (collState.currentPage * collState.pageSize) : 0;
var pageEndIndex = pageStartIndex + this.collection.length; var pageEndIndex = pageStartIndex + this.collection.length;
this.$('[data-id="r_footerRecords"]').html('<h5>Showing ' + (totalRecords ? pageStartIndex + 1 : 0) + ' - ' + pageEndIndex + '</h5>'); this.$('[data-id="r_footerRecords"]').html('<h5>Showing ' + (totalRecords ? pageStartIndex + 1 : 1) + ' - ' + pageEndIndex + '</h5>');
return this; return this;
}, },
/** /**
......
...@@ -117,18 +117,13 @@ define(['require', ...@@ -117,18 +117,13 @@ define(['require',
this.limit = 25; this.limit = 25;
this.firstFetch = true; this.firstFetch = true;
this.fetchList = 0; this.fetchList = 0;
if (options.value.searchType === "dsl" || options.value.type === "dsl") {
pagination = false;
this.offset = 0; this.offset = 0;
} else {
pagination = true;
}
this.commonTableOptions = { this.commonTableOptions = {
collection: this.searchCollection, collection: this.searchCollection,
includeFilter: false, includeFilter: false,
includePagination: pagination, includePagination: false,
includePageSize: false, includePageSize: false,
includeFooterRecords: pagination, includeFooterRecords: false,
includeSizeAbleColumns: false, includeSizeAbleColumns: false,
gridOpts: { gridOpts: {
emptyText: 'No Record found!', emptyText: 'No Record found!',
...@@ -210,11 +205,9 @@ define(['require', ...@@ -210,11 +205,9 @@ define(['require',
if (value) { if (value) {
if (value.searchType) { if (value.searchType) {
this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType; this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType;
if (value.searchType === "dsl") {
$.extend(this.searchCollection.queryParams, { limit: this.limit }); $.extend(this.searchCollection.queryParams, { limit: this.limit });
this.offset = 0; this.offset = 0;
} }
}
_.extend(this.searchCollection.queryParams, { 'query': value.query }); _.extend(this.searchCollection.queryParams, { 'query': value.query });
} }
Globals.searchApiCallRef = this.searchCollection.fetch({ Globals.searchApiCallRef = this.searchCollection.fetch({
...@@ -246,7 +239,6 @@ define(['require', ...@@ -246,7 +239,6 @@ define(['require',
that.checkTableFetch(); that.checkTableFetch();
that.offset = that.offset - that.limit; that.offset = that.offset - that.limit;
if (that.firstFetch) { if (that.firstFetch) {
that.ui.paginationDiv.hide();
that.renderTableLayoutView(); that.renderTableLayoutView();
} }
} }
...@@ -318,11 +310,6 @@ define(['require', ...@@ -318,11 +310,6 @@ define(['require',
this.$('.fontLoader').hide(); this.$('.fontLoader').hide();
this.$('.searchTable').show(); this.$('.searchTable').show();
this.$('.searchResult').show(); this.$('.searchResult').show();
if (this.value.searchType == "dsl" || this.value.type === "dsl") {
this.ui.paginationDiv.show();
} else {
this.ui.paginationDiv.hide();
}
} }
}, },
getEntityTableColumns: function() { getEntityTableColumns: function() {
...@@ -621,11 +608,9 @@ define(['require', ...@@ -621,11 +608,9 @@ define(['require',
onClicknextData: function() { onClicknextData: function() {
var that = this; var that = this;
this.ui.previousData.removeAttr("disabled"); this.ui.previousData.removeAttr("disabled");
$.extend(this.searchCollection.queryParams, {
offset: function() {
that.offset = that.offset + that.limit; that.offset = that.offset + that.limit;
return that.offset; $.extend(this.searchCollection.queryParams, {
} offset: that.offset
}); });
this.previousClick = false; this.previousClick = false;
this.fetchCollection(); this.fetchCollection();
...@@ -633,11 +618,9 @@ define(['require', ...@@ -633,11 +618,9 @@ define(['require',
onClickpreviousData: function() { onClickpreviousData: function() {
var that = this; var that = this;
this.ui.nextData.removeAttr("disabled"); this.ui.nextData.removeAttr("disabled");
$.extend(this.searchCollection.queryParams, {
offset: function() {
that.offset = that.offset - that.limit; that.offset = that.offset - that.limit;
return that.offset; $.extend(this.searchCollection.queryParams, {
} offset: that.offset
}); });
this.previousClick = true; this.previousClick = true;
this.fetchCollection(); this.fetchCollection();
......
...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES: ALL CHANGES:
ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)
ATLAS-1006 Paginate full text search results (shwethags) ATLAS-1006 Paginate full text search results (shwethags)
ATLAS-1046 UI: Search pagination refinements (Kalyanikashikar via sumasai) ATLAS-1046 UI: Search pagination refinements (Kalyanikashikar via sumasai)
ATLAS-1056 Differentiate between tag and term using attribute "taxonomy.namespace" (kevalbhat18 via sumasai) ATLAS-1056 Differentiate between tag and term using attribute "taxonomy.namespace" (kevalbhat18 via sumasai)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment