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

fix pagination next and previous links for schedules and integrations GET endpoints #2467

Merged

Conversation

joeyorlando
Copy link
Contributor

Which issue(s) this PR fixes

closes #2463

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

for schedules and integrations GET
endpoints
@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Jul 7, 2023
@joeyorlando joeyorlando self-assigned this Jul 7, 2023
@joeyorlando joeyorlando requested a review from a team July 7, 2023 15:06
@@ -219,7 +219,7 @@ def test_get_list_schedules_pagination(
client = APIClient()

schedule_list_url = reverse("api-internal:schedule-list")
absolute_url = create_engine_url(schedule_list_url, override_base="http://testserver")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be fine. override_base has no effect here because the actual absolute URL that is being generated is overriden here on the actual request object itself in PathPrefixedCursorPagination.paginate_queryset:

class PathPrefixedPagination(PageNumberPagination):
    def paginate_queryset(self, queryset, request, view=None):
        request.build_absolute_uri = lambda: create_engine_url(request.get_full_path())
        return super().paginate_queryset(queryset, request, view)

Comment on lines -42 to -49
def paginate_queryset(self, queryset, request, view=None):
"""Override to apply pagination only if ?page= is present in query params
Required for backwards compatibility with older versions
"""
page_number = request.query_params.get(self.page_query_param, None)
if not page_number:
return None
return super().paginate_queryset(queryset, request, view)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this can be removed. @iskhakov wdyt?

This was likely here to handle the transition when the paginated integration's page was release, and to handle the case in Cloud where UI clients running the previous version would've received a different API response.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree

@joeyorlando joeyorlando merged commit 1988ac1 into dev Jul 7, 2023
@joeyorlando joeyorlando deleted the jorlando/fix-schedules-and-integration-pagination-links branch July 7, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

internal api returns 404 for schedules?page=2 which is the page it told me to query next
3 participants