ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)
diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html
index 609ec23..1ea6189 100644
--- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html
@@ -21,7 +21,7 @@
<div class="ellipsis"><span class="searchResult" style=" font-size: 16px;"></span></div>
<div class="searchTable">
<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">
<li>
<button class="btn" data-id="previousData" disabled=true>Previous</button>
diff --git a/dashboardv2/public/js/utils/TableLayout.js b/dashboardv2/public/js/utils/TableLayout.js
index c83cf76..96251a2 100644
--- a/dashboardv2/public/js/utils/TableLayout.js
+++ b/dashboardv2/public/js/utils/TableLayout.js
@@ -308,9 +308,9 @@
renderFooterRecords: function(collectionState) {
var collState = collectionState;
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;
- 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;
},
/**
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index f9f82f4..0e62873 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -117,18 +117,13 @@
this.limit = 25;
this.firstFetch = true;
this.fetchList = 0;
- if (options.value.searchType === "dsl" || options.value.type === "dsl") {
- pagination = false;
- this.offset = 0;
- } else {
- pagination = true;
- }
+ this.offset = 0;
this.commonTableOptions = {
collection: this.searchCollection,
includeFilter: false,
- includePagination: pagination,
+ includePagination: false,
includePageSize: false,
- includeFooterRecords: pagination,
+ includeFooterRecords: false,
includeSizeAbleColumns: false,
gridOpts: {
emptyText: 'No Record found!',
@@ -210,10 +205,8 @@
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, { limit: this.limit });
+ this.offset = 0;
}
_.extend(this.searchCollection.queryParams, { 'query': value.query });
}
@@ -246,7 +239,6 @@
that.checkTableFetch();
that.offset = that.offset - that.limit;
if (that.firstFetch) {
- that.ui.paginationDiv.hide();
that.renderTableLayoutView();
}
}
@@ -318,11 +310,6 @@
this.$('.fontLoader').hide();
this.$('.searchTable').show();
this.$('.searchResult').show();
- if (this.value.searchType == "dsl" || this.value.type === "dsl") {
- this.ui.paginationDiv.show();
- } else {
- this.ui.paginationDiv.hide();
- }
}
},
getEntityTableColumns: function() {
@@ -621,11 +608,9 @@
onClicknextData: function() {
var that = this;
this.ui.previousData.removeAttr("disabled");
+ that.offset = that.offset + that.limit;
$.extend(this.searchCollection.queryParams, {
- offset: function() {
- that.offset = that.offset + that.limit;
- return that.offset;
- }
+ offset: that.offset
});
this.previousClick = false;
this.fetchCollection();
@@ -633,11 +618,9 @@
onClickpreviousData: function() {
var that = this;
this.ui.nextData.removeAttr("disabled");
+ that.offset = that.offset - that.limit;
$.extend(this.searchCollection.queryParams, {
- offset: function() {
- that.offset = that.offset - that.limit;
- return that.offset;
- }
+ offset: that.offset
});
this.previousClick = true;
this.fetchCollection();
diff --git a/release-log.txt b/release-log.txt
index 52fd857..5b22771 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@
ALL CHANGES:
+ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)
ATLAS-1006 Paginate full text search results (shwethags)
ATLAS-1046 UI: Search pagination refinements (Kalyanikashikar via sumasai)
ATLAS-1056 Differentiate between tag and term using attribute "taxonomy.namespace" (kevalbhat18 via sumasai)