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

feat(xo-web/home): allow to change the number of items per page #4708

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

Rajaa-BARHTAOUI
Copy link
Contributor

@Rajaa-BARHTAOUI Rajaa-BARHTAOUI commented Dec 16, 2019

See #4535

Screenshots

Capture d’écran de 2019-12-17 15-16-56

Capture d’écran de 2019-12-17 15-17-00

Check list

Check if done, if not relevant leave unchecked.

  • PR reference the relevant issue (e.g. Fixes #007 or See xoa-support#42)
  • if UI changes, a screenshot has been added to the PR
  • documentation updated
  • CHANGELOG.unreleased.md:
    • enhancement/bug fix entry added
    • list of packages to release updated (${name} v${new version})
  • I have tested added/updated features (and impacted code)

Process

  1. create a PR as soon as possible
  2. mark it as WiP: (Work in Progress) if not ready to be merged
  3. when you want a review, add a reviewer (and only one)
  4. if necessary, update your PR, and re- add a reviewer

From the Four Agreements:

  1. Be impeccable with your word.
  2. Don't take anything personally.
  3. Don't make assumptions.
  4. Always do your best.

@Rajaa-BARHTAOUI Rajaa-BARHTAOUI force-pushed the rajaa-show-more-items branch 2 times, most recently from dc790c0 to c08d790 Compare December 17, 2019 14:30
pathname,
query: { ...query, n: nItems },
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be interesting to save this in cookies.

@Rajaa-BARHTAOUI Rajaa-BARHTAOUI force-pushed the rajaa-show-more-items branch 3 times, most recently from c2f9750 to d2e36ef Compare December 17, 2019 16:03
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
@badrAZ badrAZ requested a review from pdonias December 19, 2019 09:04
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
CHANGELOG.unreleased.md Outdated Show resolved Hide resolved
@@ -5,6 +5,7 @@ import ActionButton from 'action-button'
import Button from 'button'
import CenterPanel from 'center-panel'
import classNames from 'classnames'
import cookies from 'cookies-js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it sorted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird because if it's case sensitive, then CenterPanel and Component should be grouped and if it isn't, then cookies should be after Component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my fault. it's not sorted.
To avoid unrelated changes, I will import it after Component.

packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
@badrAZ badrAZ requested a review from pdonias January 21, 2020 09:04
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
CHANGELOG.unreleased.md Outdated Show resolved Hide resolved
@@ -5,6 +5,7 @@ import ActionButton from 'action-button'
import Button from 'button'
import CenterPanel from 'center-panel'
import classNames from 'classnames'
import cookies from 'cookies-js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird because if it's case sensitive, then CenterPanel and Component should be grouped and if it isn't, then cookies should be after Component.

packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
@@ -1154,6 +1182,7 @@ export default class Home extends Component {
isPoolAdmin,
noResourceSets,
} = this.props
const nItemsPerPage = this._getnItemsPerPage()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline.

@@ -979,7 +997,7 @@ export default class Home extends Component {
})}
</span>
</Col>
<Col mediumSize={8} className='text-xs-right hidden-sm-down'>
<Col mediumSize={6} className='text-xs-right hidden-sm-down'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if all the sizes work fine with all the widths? If not, we can take some space from the 1st column, I think.

Copy link
Member

@pdonias pdonias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the issue open since it mentions adding a user preference for this?

@@ -517,6 +519,18 @@ export default class Home extends Component {
identity,
])

_getNItemsPerPage = () =>
+defined(
this.state.homeItemsPerPage,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to also store it in the state? Can't we only rely on the cookies?

@@ -683,7 +697,7 @@ export default class Home extends Component {
_getVisibleItems = createPager(
this._getFilteredItems,
() => this._getPage(),
ITEMS_PER_PAGE
() => this._getNItemsPerPage()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._getNItemsPerPage

packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
packages/xo-web/src/xo-app/home/index.js Outdated Show resolved Hide resolved
@Rajaa-BARHTAOUI
Copy link
Contributor Author

Should we keep the issue open since it mentions adding a user preference for this?

Yes.

@pdonias pdonias changed the title feat(xo-web/home): allow to switch the number of items per page feat(xo-web/home): allow to change the number of items per page Jan 27, 2020
@pdonias pdonias merged commit 70f8f96 into master Jan 27, 2020
@pdonias pdonias deleted the rajaa-show-more-items branch January 27, 2020 16:12
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.

4 participants