[Github Pull Requests Board] Show more than 10 PRs at one time
Signed-off-by: Jake Crews <jake.crews@daveramsey.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-github-pull-requests-board': patch
|
||||
---
|
||||
|
||||
The PR dashboard will now show more than 10 pull requests at one time.
|
||||
@@ -26,27 +26,41 @@ export const useGetPullRequestsFromRepository = () => {
|
||||
async (repo: string): Promise<PullRequestsNumber[]> => {
|
||||
const [organisation, repositoryName] = repo.split('/');
|
||||
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
query ($name: String!, $owner: String!) {
|
||||
repository(name: $name, owner: $owner) {
|
||||
pullRequests(states: OPEN, first: 10) {
|
||||
edges {
|
||||
node {
|
||||
number
|
||||
const pullRequestEdges = [];
|
||||
let result: GraphQlPullRequests<PullRequestsNumber[]> | undefined =
|
||||
undefined;
|
||||
do {
|
||||
result = await graphql(
|
||||
`
|
||||
query ($name: String!, $owner: String!, $endCursor: String) {
|
||||
repository(name: $name, owner: $owner) {
|
||||
pullRequests(states: OPEN, first: 100, after: $endCursor) {
|
||||
edges {
|
||||
node {
|
||||
number
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
name: repositoryName,
|
||||
owner: organisation,
|
||||
},
|
||||
);
|
||||
`,
|
||||
{
|
||||
name: repositoryName,
|
||||
owner: organisation,
|
||||
endCursor: result
|
||||
? result.repository.pullRequests.pageInfo.endCursor
|
||||
: undefined,
|
||||
},
|
||||
);
|
||||
|
||||
return repository.pullRequests.edges;
|
||||
pullRequestEdges.push(...result.repository.pullRequests.edges);
|
||||
} while (result.repository.pullRequests.pageInfo.hasNextPage);
|
||||
|
||||
return pullRequestEdges;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ export type GraphQlPullRequests<T> = {
|
||||
repository: {
|
||||
pullRequests: {
|
||||
edges: T;
|
||||
pageInfo: {
|
||||
hasNextPage: boolean;
|
||||
endCursor?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user