diff --git a/app/components/seek-pagination.hbs b/app/components/seek-pagination.hbs new file mode 100644 index 00000000000..4ae6e0a1650 --- /dev/null +++ b/app/components/seek-pagination.hbs @@ -0,0 +1,7 @@ +{{#if @pagination.nextPage}} + +{{/if}} diff --git a/app/components/seek-pagination.module.css b/app/components/seek-pagination.module.css new file mode 100644 index 00000000000..76cebb05f16 --- /dev/null +++ b/app/components/seek-pagination.module.css @@ -0,0 +1,5 @@ +.seek-pagination { + text-align: center; + font-size: 90%; + margin-bottom: 20px; +} diff --git a/app/controllers/me/pending-invites.js b/app/controllers/me/pending-invites.js index 84fb01091fe..19efd238c7d 100644 --- a/app/controllers/me/pending-invites.js +++ b/app/controllers/me/pending-invites.js @@ -1,14 +1,10 @@ import Controller from '@ember/controller'; -import { tracked } from '@glimmer/tracking'; import { reads } from 'macro-decorators'; -import { pagination } from '../../utils/seek'; +import { pagination } from '../../utils/seek-pagination'; export default class PendingInvitesController extends Controller { - queryParams = ['seek']; - @tracked seek = 'WzEsIDFd'; - - @reads('model.meta.total') totalItems; + @reads('model.meta.next_page') nextPage; @pagination() pagination; } diff --git a/app/routes/me/pending-invites.js b/app/routes/me/pending-invites.js index a1792ebeea4..1cb57350c0d 100644 --- a/app/routes/me/pending-invites.js +++ b/app/routes/me/pending-invites.js @@ -6,7 +6,7 @@ export default class PendingInvitesRoute extends AuthenticatedRoute { @service store; queryParams = { - page: { refreshModel: true }, + seek: { refreshModel: true }, }; model(params) { diff --git a/app/templates/me/pending-invites.hbs b/app/templates/me/pending-invites.hbs index ec21dbdf502..b1c9c762841 100644 --- a/app/templates/me/pending-invites.hbs +++ b/app/templates/me/pending-invites.hbs @@ -10,4 +10,4 @@ {{/each}} - + diff --git a/app/utils/seek-pagination.js b/app/utils/seek-pagination.js new file mode 100644 index 00000000000..01ff59de658 --- /dev/null +++ b/app/utils/seek-pagination.js @@ -0,0 +1,12 @@ +import macro from 'macro-decorators'; + +export function pagination() { + return macro(function () { + let { nextPage, totalItems } = this; + + return { + nextPage, + totalItems, + }; + }); +} diff --git a/app/utils/seek.js b/app/utils/seek.js deleted file mode 100644 index 592c33c501a..00000000000 --- a/app/utils/seek.js +++ /dev/null @@ -1,15 +0,0 @@ -import macro from 'macro-decorators'; - -const VIEWABLE_PAGES = 9; - -export function pagination() { - return macro(function () { - let { page, per_page: perPage, totalItems } = this; - - return { - page, - perPage, - totalItems, - } - }); -} diff --git a/src/controllers/crate_owner_invitation.rs b/src/controllers/crate_owner_invitation.rs index 69eb3ab7c69..1246620d76a 100644 --- a/src/controllers/crate_owner_invitation.rs +++ b/src/controllers/crate_owner_invitation.rs @@ -136,6 +136,7 @@ fn prepare_list( Page::Unspecified => query.load(&*conn)?, Page::Seek(s) => { let seek_key: (i32, i32) = s.decode()?; + println!("{} {}", seek_key.0, seek_key.1); query .filter( crate_owner_invitations::crate_id.gt(seek_key.0).or( @@ -154,15 +155,12 @@ fn prepare_list( raw_invitations.pop(); if let Some(last) = raw_invitations.last() { - let mut params = IndexMap::new(); - params.insert( - "seek".into(), - crate::controllers::helpers::pagination::encode_seek(( - last.crate_id, - last.invited_user_id, - ))?, - ); - Some(req.query_with_params(params)) + let seek_key = crate::controllers::helpers::pagination::encode_seek(( + last.crate_id, + last.invited_user_id, + ))?; + + Some(seek_key) } else { None }