From a686702dbe59ead0957ed9c80b9d65ef186305b8 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 17 Feb 2022 20:38:36 +0100 Subject: [PATCH] catalog: rename CatalogResultListItem to CatalogSearchResultListItem Signed-off-by: Patrik Oldsberg --- .changeset/dry-papayas-melt.md | 5 +++++ .changeset/gentle-buttons-hunt.md | 22 +++++++++++++++++++ .../app/src/components/search/SearchPage.tsx | 4 ++-- .../app/src/components/search/SearchPage.tsx | 4 ++-- plugins/catalog/api-report.md | 12 +++++++--- .../CatalogSearchResultListItem.tsx} | 20 ++++++++++++++--- .../index.ts | 10 +++++++-- plugins/catalog/src/index.ts | 2 +- 8 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 .changeset/dry-papayas-melt.md create mode 100644 .changeset/gentle-buttons-hunt.md rename plugins/catalog/src/components/{CatalogResultListItem/CatalogResultListItem.tsx => CatalogSearchResultListItem/CatalogSearchResultListItem.tsx} (77%) rename plugins/catalog/src/components/{CatalogResultListItem => CatalogSearchResultListItem}/index.ts (72%) diff --git a/.changeset/dry-papayas-melt.md b/.changeset/dry-papayas-melt.md new file mode 100644 index 0000000000..255b2cbc85 --- /dev/null +++ b/.changeset/dry-papayas-melt.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Renamed `CatalogResultListItem` to `CatalogSearchResultListItem` along with its prop type, leaving the old names in place as a deprecations. diff --git a/.changeset/gentle-buttons-hunt.md b/.changeset/gentle-buttons-hunt.md new file mode 100644 index 0000000000..677e8f4e85 --- /dev/null +++ b/.changeset/gentle-buttons-hunt.md @@ -0,0 +1,22 @@ +--- +'@backstage/create-app': patch +--- + +Update the template to reflect the renaming of `CatalogResultListItem` to `CatalogSearchResultListItem` from `@backstage/plugin-catalog`. + +To apply this change to an existing app, make the following change to `packages/app/src/components/search/SearchPage.tsx`: + +```diff +-import { CatalogResultListItem } from '@backstage/plugin-catalog'; ++import { CatalogSearchResultListItem } from '@backstage/plugin-catalog'; +``` + +```diff + case 'software-catalog': + return ( +- +``` diff --git a/packages/app/src/components/search/SearchPage.tsx b/packages/app/src/components/search/SearchPage.tsx index d4e60244d7..fe759c9799 100644 --- a/packages/app/src/components/search/SearchPage.tsx +++ b/packages/app/src/components/search/SearchPage.tsx @@ -24,7 +24,7 @@ import { SidebarPinStateContext, } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; -import { CatalogResultListItem } from '@backstage/plugin-catalog'; +import { CatalogSearchResultListItem } from '@backstage/plugin-catalog'; import { catalogApiRef, CATALOG_FILTER_EXISTS, @@ -136,7 +136,7 @@ const SearchPage = () => { switch (type) { case 'software-catalog': return ( - diff --git a/packages/create-app/templates/default-app/packages/app/src/components/search/SearchPage.tsx b/packages/create-app/templates/default-app/packages/app/src/components/search/SearchPage.tsx index a88e7250e9..469a230ecd 100644 --- a/packages/create-app/templates/default-app/packages/app/src/components/search/SearchPage.tsx +++ b/packages/create-app/templates/default-app/packages/app/src/components/search/SearchPage.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { makeStyles, Theme, Grid, List, Paper } from '@material-ui/core'; -import { CatalogResultListItem } from '@backstage/plugin-catalog'; +import { CatalogSearchResultListItem } from '@backstage/plugin-catalog'; import { catalogApiRef, CATALOG_FILTER_EXISTS, @@ -116,7 +116,7 @@ const SearchPage = () => { switch (type) { case 'software-catalog': return ( - diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index 608f7a8515..c2c09755f8 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -104,13 +104,19 @@ const catalogPlugin: BackstagePlugin< export { catalogPlugin }; export { catalogPlugin as plugin }; +// @public @deprecated (undocumented) +export const CatalogResultListItem: typeof CatalogSearchResultListItem; + +// @public @deprecated (undocumented) +export type CatalogResultListItemProps = CatalogSearchResultListItemProps; + // @public (undocumented) -export function CatalogResultListItem( - props: CatalogResultListItemProps, +export function CatalogSearchResultListItem( + props: CatalogSearchResultListItemProps, ): JSX.Element; // @public -export interface CatalogResultListItemProps { +export interface CatalogSearchResultListItemProps { // (undocumented) result: IndexableDocument; } diff --git a/plugins/catalog/src/components/CatalogResultListItem/CatalogResultListItem.tsx b/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx similarity index 77% rename from plugins/catalog/src/components/CatalogResultListItem/CatalogResultListItem.tsx rename to plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx index 3800618539..54cfe43364 100644 --- a/plugins/catalog/src/components/CatalogResultListItem/CatalogResultListItem.tsx +++ b/plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx @@ -38,16 +38,18 @@ const useStyles = makeStyles({ }); /** - * Props for {@link CatalogResultListItem}. + * Props for {@link CatalogSearchResultListItem}. * * @public */ -export interface CatalogResultListItemProps { +export interface CatalogSearchResultListItemProps { result: IndexableDocument; } /** @public */ -export function CatalogResultListItem(props: CatalogResultListItemProps) { +export function CatalogSearchResultListItem( + props: CatalogSearchResultListItemProps, +) { const result = props.result as any; const classes = useStyles(); @@ -71,3 +73,15 @@ export function CatalogResultListItem(props: CatalogResultListItemProps) { ); } + +/** + * @public + * @deprecated use {@link CatalogSearchResultListItemProps} instead + */ +export type CatalogResultListItemProps = CatalogSearchResultListItemProps; + +/** + * @public + * @deprecated use {@link CatalogSearchResultListItem} instead + */ +export const CatalogResultListItem = CatalogSearchResultListItem; diff --git a/plugins/catalog/src/components/CatalogResultListItem/index.ts b/plugins/catalog/src/components/CatalogSearchResultListItem/index.ts similarity index 72% rename from plugins/catalog/src/components/CatalogResultListItem/index.ts rename to plugins/catalog/src/components/CatalogSearchResultListItem/index.ts index 68f6c8cd0c..0396117825 100644 --- a/plugins/catalog/src/components/CatalogResultListItem/index.ts +++ b/plugins/catalog/src/components/CatalogSearchResultListItem/index.ts @@ -14,5 +14,11 @@ * limitations under the License. */ -export { CatalogResultListItem } from './CatalogResultListItem'; -export type { CatalogResultListItemProps } from './CatalogResultListItem'; +export { + CatalogSearchResultListItem, + CatalogResultListItem, +} from './CatalogSearchResultListItem'; +export type { + CatalogSearchResultListItemProps, + CatalogResultListItemProps, +} from './CatalogSearchResultListItem'; diff --git a/plugins/catalog/src/index.ts b/plugins/catalog/src/index.ts index 10da3c9d6d..ed98395687 100644 --- a/plugins/catalog/src/index.ts +++ b/plugins/catalog/src/index.ts @@ -22,7 +22,7 @@ export * from './components/AboutCard'; export * from './components/CatalogKindHeader'; -export * from './components/CatalogResultListItem'; +export * from './components/CatalogSearchResultListItem'; export * from './components/CatalogTable'; export * from './components/CatalogTable/columns'; export * from './components/EntityLayout';