Merge pull request #10291 from RoadieHQ/allow-customizing-default-catalog-component

Expose initialFiliter from Catalog Page
This commit is contained in:
Fredrik Adelöw
2022-03-23 17:03:36 +01:00
committed by GitHub
3 changed files with 17 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': minor
---
Expose 'initalFilter' through initialKind prop on Catalog Page.
+2
View File
@@ -161,6 +161,8 @@ export interface DefaultCatalogPageProps {
// (undocumented)
columns?: TableColumn<CatalogTableRow>[];
// (undocumented)
initialKind?: string;
// (undocumented)
initiallySelectedFilter?: UserListFilterKind;
}
@@ -48,10 +48,16 @@ export interface DefaultCatalogPageProps {
initiallySelectedFilter?: UserListFilterKind;
columns?: TableColumn<CatalogTableRow>[];
actions?: TableProps<CatalogTableRow>['actions'];
initialKind?: string;
}
export function DefaultCatalogPage(props: DefaultCatalogPageProps) {
const { columns, actions, initiallySelectedFilter = 'owned' } = props;
const {
columns,
actions,
initiallySelectedFilter = 'owned',
initialKind = 'component',
} = props;
const orgName =
useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';
const createComponentLink = useRouteRef(createComponentRouteRef);
@@ -60,7 +66,9 @@ export function DefaultCatalogPage(props: DefaultCatalogPageProps) {
<PageWithHeader title={`${orgName} Catalog`} themeId="home">
<EntityListProvider>
<Content>
<ContentHeader titleComponent={<CatalogKindHeader />}>
<ContentHeader
titleComponent={<CatalogKindHeader initialFilter={initialKind} />}
>
<CreateButton
title="Create Component"
to={createComponentLink && createComponentLink()}