#10453 Added options to CatalogTable.tsx to provide a way to pass options config to table.

Signed-off-by: Shailendra Ahir <shailendraahir@hotmail.com>
This commit is contained in:
Shailendra Ahir
2022-03-30 06:28:05 +05:30
parent 05d345f20c
commit 5bd747da33
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -138,6 +138,8 @@ export interface CatalogTableProps {
actions?: TableProps<CatalogTableRow>['actions'];
// (undocumented)
columns?: TableColumn<CatalogTableRow>[];
// (undocumented)
options?: TableProps<CatalogTableRow>['options'];
}
// @public (undocumented)
@@ -50,6 +50,7 @@ import Star from '@material-ui/icons/Star';
export interface CatalogTableProps {
columns?: TableColumn<CatalogTableRow>[];
actions?: TableProps<CatalogTableRow>['actions'];
options?: TableProps<CatalogTableRow>['options'];
}
const YellowStar = withStyles({
@@ -60,7 +61,7 @@ const YellowStar = withStyles({
/** @public */
export const CatalogTable = (props: CatalogTableProps) => {
const { columns, actions } = props;
const { columns, actions, options } = props;
const { isStarredEntity, toggleStarredEntity } = useStarredEntities();
const { loading, error, entities, filters } = useEntityList();
@@ -163,6 +164,8 @@ export const CatalogTable = (props: CatalogTableProps) => {
typeColumn.hidden = !showTypeColumn;
}
const showPagination = rows.length > 20;
const optionsOverride =
options && Object.keys(options).length > 0 ? options : {};
return (
<Table<CatalogTableRow>
@@ -176,6 +179,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
showEmptyDataSourceMessage: !loading,
padding: 'dense',
pageSizeOptions: [20, 50, 100],
...optionsOverride,
}}
title={`${titlePreamble} (${entities.length})`}
data={rows}