diff --git a/.changeset/wicked-dragons-brush.md b/.changeset/wicked-dragons-brush.md new file mode 100644 index 0000000000..737451f1fd --- /dev/null +++ b/.changeset/wicked-dragons-brush.md @@ -0,0 +1,14 @@ +--- +'@backstage/plugin-techdocs': minor +--- + +Use the same initial filter `owned` for the `TechDocsIndexPage` as for the `CatalogPage`. + +If you prefer to keep the previous behavior, you can change the default for the initial filter +to `all` (or `starred` if you rather prefer that). + +``` + +``` + +In general, with this change you will be able to set props at `TechDocsIndexPage`. diff --git a/plugins/techdocs/api-report.md b/plugins/techdocs/api-report.md index d4ec65ed53..9a6c902f61 100644 --- a/plugins/techdocs/api-report.md +++ b/plugins/techdocs/api-report.md @@ -45,15 +45,11 @@ export type ContentStateTypes = // @public export const DefaultTechDocsHome: ( - props: DefaultTechDocsHomeProps, + props: TechDocsIndexPageProps, ) => JSX.Element; -// @public -export type DefaultTechDocsHomeProps = { - initialFilter?: UserListFilterKind; - columns?: TableColumn[]; - actions?: TableProps['actions']; -}; +// @public @deprecated +export type DefaultTechDocsHomeProps = TechDocsIndexPageProps; // @public export const DocsCardGrid: (props: DocsCardGridProps) => JSX.Element | null; @@ -256,7 +252,14 @@ export type TechDocsCustomHomeProps = { export type TechDocsEntityMetadata = TechDocsEntityMetadata_2; // @public -export const TechDocsIndexPage: () => JSX.Element; +export const TechDocsIndexPage: (props: TechDocsIndexPageProps) => JSX.Element; + +// @public +export type TechDocsIndexPageProps = { + initialFilter?: UserListFilterKind; + columns?: TableColumn[]; + actions?: TableProps['actions']; +}; // @public @deprecated (undocumented) export type TechDocsMetadata = TechDocsMetadata_2; diff --git a/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx b/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx index bdbb4877ac..9b9b79ef66 100644 --- a/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx +++ b/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx @@ -19,39 +19,34 @@ import { Content, ContentHeader, SupportButton, - TableColumn, - TableProps, } from '@backstage/core-components'; import { CatalogFilterLayout, EntityListProvider, EntityOwnerPicker, EntityTagPicker, - UserListFilterKind, UserListPicker, } from '@backstage/plugin-catalog-react'; import { TechDocsPageWrapper } from './TechDocsPageWrapper'; import { TechDocsPicker } from './TechDocsPicker'; -import { DocsTableRow, EntityListDocsTable } from './Tables'; +import { EntityListDocsTable } from './Tables'; +import { TechDocsIndexPageProps } from './TechDocsIndexPage'; /** * Props for {@link DefaultTechDocsHome} * * @public + * @deprecated Please use `TechDocsIndexPageProps` instead. */ -export type DefaultTechDocsHomeProps = { - initialFilter?: UserListFilterKind; - columns?: TableColumn[]; - actions?: TableProps['actions']; -}; +export type DefaultTechDocsHomeProps = TechDocsIndexPageProps; /** * Component which renders a default documentation landing page. * * @public */ -export const DefaultTechDocsHome = (props: DefaultTechDocsHomeProps) => { - const { initialFilter = 'all', columns, actions } = props; +export const DefaultTechDocsHome = (props: TechDocsIndexPageProps) => { + const { initialFilter = 'owned', columns, actions } = props; return ( diff --git a/plugins/techdocs/src/home/components/TechDocsIndexPage.tsx b/plugins/techdocs/src/home/components/TechDocsIndexPage.tsx index 4467baf2a1..743f3e05d6 100644 --- a/plugins/techdocs/src/home/components/TechDocsIndexPage.tsx +++ b/plugins/techdocs/src/home/components/TechDocsIndexPage.tsx @@ -16,10 +16,24 @@ import React from 'react'; import { useOutlet } from 'react-router'; +import { TableColumn, TableProps } from '@backstage/core-components'; +import { UserListFilterKind } from '@backstage/plugin-catalog-react'; import { DefaultTechDocsHome } from './DefaultTechDocsHome'; +import { DocsTableRow } from './Tables'; -export const TechDocsIndexPage = () => { +/** + * Props for {@link TechDocsIndexPage} + * + * @public + */ +export type TechDocsIndexPageProps = { + initialFilter?: UserListFilterKind; + columns?: TableColumn[]; + actions?: TableProps['actions']; +}; + +export const TechDocsIndexPage = (props: TechDocsIndexPageProps) => { const outlet = useOutlet(); - return outlet || ; + return outlet || ; }; diff --git a/plugins/techdocs/src/home/components/index.ts b/plugins/techdocs/src/home/components/index.ts index d21f992cef..75053cd3c1 100644 --- a/plugins/techdocs/src/home/components/index.ts +++ b/plugins/techdocs/src/home/components/index.ts @@ -24,5 +24,6 @@ export type { TabsConfig, TechDocsCustomHomeProps, } from './TechDocsCustomHome'; +export type { TechDocsIndexPageProps } from './TechDocsIndexPage'; export * from './TechDocsPageWrapper'; export * from './TechDocsPicker';