You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2021/06/29 11:36:43 UTC

[atlas] branch branch-2.0 updated: ATLAS-4286:UI - User is taken to incorrect page as you go one page back after reaching page limit.

This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new b67746d  ATLAS-4286:UI -  User is taken to incorrect page as you go one page back after reaching page limit.
b67746d is described below

commit b67746ddcbcdc818eefcae7c555858facdaa004b
Author: prasad pawar <pr...@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.
    
    (cherry picked from commit 2f6f20474bc08c9706b26c0a09d6092b69e8590f)
---
 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;
+                }
             },
 
             /**