-
Notifications
You must be signed in to change notification settings - Fork 299
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
augment API response pagination attributes #2471
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main change for the backend
@@ -527,8 +527,8 @@ def heartbeat_module(self): | |||
return getattr(heartbeat, self.INTEGRATIONS_TO_REVERSE_URL_MAP[self.integration], None) | |||
|
|||
# Demo alerts | |||
def send_demo_alert(self, force_route_id=None, payload=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force_route_id
seemed to only be passed in when this method was called from ChannelFilter. send_demo_alert
(which was already deprecated and is now removed in this PR)
def get_paginated_response_with_matched_users_count(self, data, matched_users_count): | ||
return Response( | ||
OrderedDict( | ||
[ | ||
("count", self.page.paginator.count), | ||
("matched_users_count", matched_users_count), | ||
("next", self.get_next_link()), | ||
("previous", self.get_previous_link()), | ||
("results", data), | ||
] | ||
) | ||
) | ||
return self.get_paginated_response(data, len(cloud_identities)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HundredPageSizePaginator
inherits from PathPrefixedPagePagination
and therefore all of these attributes, except for matched_users_count
would be set. matched_users_count
is being set above in the new CloudUsersPagination
paginator class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
What this PR does
This PR:
With the new paginated API response schema, the web UI will no longer need to:
ITEMS_PER_PAGE
for each table(these two things ☝️ will be done in #2476)
For
GET /api/internal/v1/alertgroups
the response will now look like this:{ "next": <url> | None, "previous": <url> | None, "results": [], ++ "page_size": <int> }
For all other paginated API responses, the response will now look like:
TODO
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)