Merge pull request #10530 from julioz/gocd-pagination

Add table pagination to GoCD plugin
This commit is contained in:
Ben Lambert
2022-03-31 12:50:24 +02:00
committed by GitHub
3 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-gocd': patch
---
Add pagination controls to GoCD build table
+3 -1
View File
@@ -18,6 +18,8 @@ import { GoCdApiError, PipelineHistory } from './gocdApi.model';
import { DiscoveryApi } from '@backstage/core-plugin-api';
import { ResponseError } from '@backstage/errors';
const DEFAULT_PAGE_SIZE = 100;
export class GoCdClientApi implements GoCdApi {
constructor(private readonly discoveryApi: DiscoveryApi) {}
@@ -26,7 +28,7 @@ export class GoCdClientApi implements GoCdApi {
): Promise<PipelineHistory | GoCdApiError> {
const baseUrl = await this.discoveryApi.getBaseUrl('proxy');
const pipelineHistoryResponse = await fetch(
`${baseUrl}/gocd/pipelines/${pipelineName}/history`,
`${baseUrl}/gocd/pipelines/${pipelineName}/history?page_size=${DEFAULT_PAGE_SIZE}`,
{
headers: {
Accept: 'application/vnd.go.cd+json',
@@ -244,9 +244,11 @@ export const GoCdBuildsTable = (props: GoCdBuildsProps): JSX.Element => {
search: true,
searchAutoFocus: true,
debounceInterval: 800,
paging: false,
paging: true,
padding: 'dense',
pageSizeOptions: [5, 10, 20, 50],
showFirstLastPageButtons: false,
pageSize: 10,
pageSize: 20,
}}
columns={columns}
data={