Merge pull request #28449 from Andy2003/bugfix/harmonize-catalog-tables

Harmonize `CatalogTable`
This commit is contained in:
Fredrik Adelöw
2025-05-07 12:01:39 +02:00
committed by GitHub
4 changed files with 9 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Show the pagination text for the offset-paginated catalog table, and remove the pagination bar from the top of the `CatalogTable` when pagination is enabled.
@@ -47,7 +47,7 @@ import { OffsetPaginatedCatalogTable } from './OffsetPaginatedCatalogTable';
import { CursorPaginatedCatalogTable } from './CursorPaginatedCatalogTable';
import { defaultCatalogTableColumnsFunc } from './defaultCatalogTableColumnsFunc';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { catalogTranslationRef } from '../../alpha/translation';
import { catalogTranslationRef } from '../../alpha';
import { FavoriteToggleIcon } from '@backstage/core-components';
/**
@@ -194,7 +194,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
.join(' ');
const actions = props.actions || defaultActions;
const options = {
const options: TableProps['options'] = {
actionsColumnIndex: -1,
loadingType: 'linear' as const,
showEmptyDataSourceMessage: !loading,
@@ -35,7 +35,6 @@ export function CursorPaginatedCatalogTable(props: PaginatedCatalogTableProps) {
columns={columns}
data={data}
options={{
paginationPosition: 'both',
...options,
// These settings are configured to force server side pagination
pageSizeOptions: [],
@@ -47,7 +47,6 @@ export function OffsetPaginatedCatalogTable(
columns={columns}
data={data}
options={{
paginationPosition: 'both',
pageSizeOptions: [5, 10, 20, 50, 100],
pageSize: limit,
emptyRowsWhenPaging: false,
@@ -57,14 +56,9 @@ export function OffsetPaginatedCatalogTable(
Toolbar: CatalogTableToolbar,
}}
page={page}
onPageChange={newPage => {
setPage(newPage);
}}
onRowsPerPageChange={pageSize => {
setLimit(pageSize);
}}
onPageChange={setPage}
onRowsPerPageChange={setLimit}
totalCount={totalItems}
localization={{ pagination: { labelDisplayedRows: '' } }}
{...restProps}
/>
);