Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor pagination: change pager params #674

Closed
wants to merge 3 commits into from
Closed

refactor pagination: change pager params #674

wants to merge 3 commits into from

Conversation

enkodellc
Copy link
Contributor

change paginationMaxBlocks/paginationMinBlocks to use pager settings pager {minBlocks: 5, maxBlocks: 11} to allow future enhancements of pager. Set defaults to 5,11 if they are undefined.

BREAKING CHANGE tableParams paginationMaxBlocks/paginationMinBlocks are updated to use pager {minBlocks: YY, maxBlocks: XX}

PR 1 as suggested in #656 by @christianacca

change paginationMaxBlocks/paginationMinBlocks to use pager settings  pager {minBlocks: 5, maxBlocks: 11} to allow future enhancements of pager. Set defaults to 5,11 if they are undefined.

BREAKING CHANGE tableParams paginationMaxBlocks/paginationMinBlocks are updated to use pager {minBlocks: YY, maxBlocks: XX}
@christianacca
Copy link
Collaborator

Couple of pointers about the commit:

  1. You don't need to update the CHANGELOG.md as part of this commit
    • the content of that file is code generated from the commit messages
    • the file is updated only as part of creating a release, which usually happens after a bunch of committs
  2. The commit message itself should follow our conventions

Have a read of the following to make sure you got all the details:

@christianacca
Copy link
Collaborator

Actually Keith can you:

  1. amend your commit:
    • remove the CHANGELOG.md change you made
    • change the commit message to follow conventions. Here is an example to follow: 6bb2aba
  2. push this to your fork
    • this will automatically update this PR

@christianacca
Copy link
Collaborator

I've been thinking about the counts field:

Is counts only purpose just to configure the pager?

I think a reasonable test is to consider infinite scrolling. If infinite scrolling (#560) was added would it use the counts value.

Looking at the #560, it does not.

Therefore I conclude that the counts field should also be moved into the new pager settings object you're creating.

So this gives use:

var setttings = {
    /* snip */,
    pager: {
        counts: [10, 25, 50, 100],
        maxBlocks: 11,
        minBlocks: 5
    }
}

Can you add this to the current PR (#674). It should be a separate commit once you've amended your previous one.

@christianacca
Copy link
Collaborator

BTW, we're doing significant breaking changes here... that's acceptable in this case as we're pushing to get to a 1.0 release and the api needs tidying up...

Revert edits to CHANGELOG.md
…bject

Restructure of NgTableParams pager settings to be an object to allow for future enhancements counts, minBlocks, maxBlocks

BREAKING CHANGE:

 Previously:
````
$scope.tableParams = new NgTableParams({
                    page: 1,            // show first page
                    count: 5,          // count per page
                    sorting: {
                        name: 'asc'     // initial sorting
                    }
                }, {
                    counts: [5, 10, 15],
                    paginationMaxBlocks: 9,
                    paginationMinBlocks: 5
                });
````

 Now:
 ````
$scope.tableParams = new NgTableParams({
                    page: 1,            // show first page
                    count: 5,          // count per page
                    sorting: {
                        name: 'asc'     // initial sorting
                    }
                }, {
                    pager: {
                      counts: [5, 10, 15],
                      maxBlocks: 9,
                      minBlocks: 5
                    }
                });

 ````
@enkodellc
Copy link
Contributor Author

@ccrowhurstram Read the docs, made most of the suggested changes, changing pushed commit messages looks messy. If every commit / commit message needs to be perfect then I will have to bow out from making further PR's. I understand the need for consistency but it seems like you know exactly what you want and I am not sure if my edits will be sufficient as I am fairly new to git / Angular / JS.

@christianacca
Copy link
Collaborator

OK, but shame as my time is going to run out shortly at least for the next couple of months so this change might not make it in.

It can get fiddly for sure to amend a previous commit already pushed. However, it's definitely a good tool to have in your toolbox...

@enkodellc enkodellc closed this Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants