Skip to content

Support paging on the link-list page. #4

@1egoman

Description

@1egoman

Currently, the dashboard only fetches the first page of links to display on the link-list page. The goal would be to support an arbitrary number of pages, since any links not on the first page are never displayed on the backstroke dashboard.

Here's an example response of GET https://api.backstroke.co/v1/links?page=3, the endpoint that fetches all links:

{
  "page": 3,
  "data": [
    {
      "id": 248,
      "name": "My fork of nicss",
      "enabled": true,
      "webhook": "59305a11edee18001c240d58",
      "createdAt": "2017-10-07T19:01:21.914Z",
      "lastSyncedAt": "2017-10-08T19:07:36.304Z",
      "fork": {
        "type": "repo",
        "owner": "1egoman",
        "repo": "nicss",
        "isFork": true,
        "branches": [
          "contributing-doc",
          "master",
          "npm-publish-on-push"
        ],
        "branch": "master"
      },
      "upstream": {
        "type": "repo",
        "owner": "densityco",
        "repo": "nicss",
        "branches": [
          "contributing-doc",
          "master",
          "npm-publish-on-push"
        ],
        "branch": "master"
      }
    },
    (other links here...)
  ]
}

I see two possible ways of approaching this:

  1. The easier of the two, the COLLECTION_LINKS_FETCH action could fetch all pages of links by recursively calling fetch until response.data's length is 0.
  2. Another possibility would be to update the COLLECTION_LINKS_FETCH action to accept a page number as one of its arguments, and only fetch that page of data. Then, some sort of ui component would need to be created to allow the user to page through the data that the server returns.

If you have a different idea not related to 1 or 2 above, I'm open to it! Those are just the two ideas that I thought of. Thanks for contributing to Backstroke!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions