This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push: new 2f6f204 ATLAS-4286:UI - User is taken to incorrect page as you go one page back after reaching page limit. 2f6f204 is described below commit 2f6f20474bc08c9706b26c0a09d6092b69e8590f Author: prasad pawar <prasad.pa...@freestoneinfotech.com> AuthorDate: Mon Jun 21 14:15:13 2021 +0530 ATLAS-4286:UI - User is taken to incorrect page as you go one page back after reaching page limit. --- dashboardv2/public/js/utils/TableLayout.js | 49 +++++++++++++++--------------- dashboardv3/public/js/utils/TableLayout.js | 49 +++++++++++++++--------------- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/dashboardv2/public/js/utils/TableLayout.js b/dashboardv2/public/js/utils/TableLayout.js index 174d443..8322029 100644 --- a/dashboardv2/public/js/utils/TableLayout.js +++ b/dashboardv2/public/js/utils/TableLayout.js @@ -425,31 +425,6 @@ define(['require', dataLength = this.collection.length, goToPage = this.ui.gotoPage.val(); - if (!dataLength && this.offset >= this.limit && ((options && options.next) || goToPage) && (options && !options.fromUrl)) { - /* User clicks on next button and server returns - empty response then disabled the next button without rendering table*/ - - var pageNumber = this.activePage + 1; - if (goToPage) { - pageNumber = goToPage; - this.offset = (this.activePage - 1) * this.limit; - } else { - this.ui.nextData.attr('disabled', true); - this.offset = this.offset - this.limit; - } - if (this.value) { - this.value.pageOffset = this.offset; - if (this.triggerUrl) { - this.triggerUrl(); - } - } - Utils.notifyInfo({ - html: true, - content: Messages.search.noRecordForPage + '<b>' + Utils.getNumberSuffix({ number: pageNumber, sup: true }) + '</b> page' - }); - return; - } - /*Next button check. It's outside of Previous button else condition because when user comes from 2 page to 1 page than we need to check next button.*/ @@ -492,6 +467,30 @@ define(['require', this.ui.activePage.attr('title', "Page " + this.activePage); this.ui.activePage.text(this.activePage); this.ui.showPage.val(this.limit).trigger('change', { "skipViewChange": true }); + + if (!dataLength && this.offset >= this.limit && ((options && options.next) || goToPage) && (options && !options.fromUrl)) { + /* User clicks on next button and server returns + empty response then disabled the next button without rendering table*/ + + var pageNumber = this.activePage; + if (goToPage) { + pageNumber = goToPage; + this.offset = (this.activePage - 1) * this.limit; + } else { + this.ui.nextData.attr('disabled', true); + } + if (this.value) { + this.value.pageOffset = this.offset; + if (this.triggerUrl) { + this.triggerUrl(); + } + } + Utils.notifyInfo({ + html: true, + content: Messages.search.noRecordForPage + '<b>' + Utils.getNumberSuffix({ number: pageNumber, sup: true }) + '</b> page' + }); + return; + } }, /** diff --git a/dashboardv3/public/js/utils/TableLayout.js b/dashboardv3/public/js/utils/TableLayout.js index 174d443..8322029 100644 --- a/dashboardv3/public/js/utils/TableLayout.js +++ b/dashboardv3/public/js/utils/TableLayout.js @@ -425,31 +425,6 @@ define(['require', dataLength = this.collection.length, goToPage = this.ui.gotoPage.val(); - if (!dataLength && this.offset >= this.limit && ((options && options.next) || goToPage) && (options && !options.fromUrl)) { - /* User clicks on next button and server returns - empty response then disabled the next button without rendering table*/ - - var pageNumber = this.activePage + 1; - if (goToPage) { - pageNumber = goToPage; - this.offset = (this.activePage - 1) * this.limit; - } else { - this.ui.nextData.attr('disabled', true); - this.offset = this.offset - this.limit; - } - if (this.value) { - this.value.pageOffset = this.offset; - if (this.triggerUrl) { - this.triggerUrl(); - } - } - Utils.notifyInfo({ - html: true, - content: Messages.search.noRecordForPage + '<b>' + Utils.getNumberSuffix({ number: pageNumber, sup: true }) + '</b> page' - }); - return; - } - /*Next button check. It's outside of Previous button else condition because when user comes from 2 page to 1 page than we need to check next button.*/ @@ -492,6 +467,30 @@ define(['require', this.ui.activePage.attr('title', "Page " + this.activePage); this.ui.activePage.text(this.activePage); this.ui.showPage.val(this.limit).trigger('change', { "skipViewChange": true }); + + if (!dataLength && this.offset >= this.limit && ((options && options.next) || goToPage) && (options && !options.fromUrl)) { + /* User clicks on next button and server returns + empty response then disabled the next button without rendering table*/ + + var pageNumber = this.activePage; + if (goToPage) { + pageNumber = goToPage; + this.offset = (this.activePage - 1) * this.limit; + } else { + this.ui.nextData.attr('disabled', true); + } + if (this.value) { + this.value.pageOffset = this.offset; + if (this.triggerUrl) { + this.triggerUrl(); + } + } + Utils.notifyInfo({ + html: true, + content: Messages.search.noRecordForPage + '<b>' + Utils.getNumberSuffix({ number: pageNumber, sup: true }) + '</b> page' + }); + return; + } }, /**