Skip to content

Conversation

@kceb
Copy link

@kceb kceb commented Aug 19, 2021

https://www.pivotaltracker.com/story/show/177614355

Context
I would like to be able to set custom top level meta attributes. Current jsonapi-utils does not support it out of the box. jsonapi-resources has some support for it w/custom operation processors, however, based on experimentation, these custom operation processors are not yet compatible with jsonapi-utils. Rather than doing extensive changes to this forked version of jsonapi utils to support custom operation processors, I figure it would be easier to allow custom meta declaration.

Inspiration: tiagopog#91

Why?
We have an admin portal page for admin events. The admin events live on the SP events DB (separate from SP core).

We need pagination on this admin index page. ActiveAdmin supports two types of pagination

  1. With total count -- slow for large tables b/c of COUNT(*)
  2. Without total count -- faster for large tables b/c lack of COUNT(*)

Option 2 makes most sense for this table, however the way ActiveAdmin determines this is by seeing if there is a result on the next page. I could make two requests to determine this or I could provide a custom meta attribute saying has_next_page: true. I tested the former locally with ~21 million records and it takes ~20 seconds to render a page. The latter has the opportunity to be more performant b/c it can be done in one request.

Meta would be declared in admin events index action

@kceb kceb force-pushed the feature/create-admin-facing-audit-log-for-login-as-user-feature branch from 7c9479c to dab8c5e Compare August 19, 2021 20:27
@kceb kceb marked this pull request as ready for review August 19, 2021 20:29
@kceb
Copy link
Author

kceb commented Aug 20, 2021

Talked with Noah, we are going an alternate route

@kceb kceb closed this Aug 20, 2021
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.

2 participants