catalog: rename CatalogResultListItem to CatalogSearchResultListItem

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-02-17 20:38:36 +01:00
parent 209fd128e6
commit a686702dbe
8 changed files with 66 additions and 13 deletions
+5
View File
@@ -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.
+22
View File
@@ -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 (
- <CatalogResultListItem
+ <CatalogSearchResultListItem
key={document.location}
result={document}
/>
```
@@ -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 (
<CatalogResultListItem
<CatalogSearchResultListItem
key={document.location}
result={document}
/>
@@ -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 (
<CatalogResultListItem
<CatalogSearchResultListItem
key={document.location}
result={document}
/>
+9 -3
View File
@@ -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;
}
@@ -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) {
</Link>
);
}
/**
* @public
* @deprecated use {@link CatalogSearchResultListItemProps} instead
*/
export type CatalogResultListItemProps = CatalogSearchResultListItemProps;
/**
* @public
* @deprecated use {@link CatalogSearchResultListItem} instead
*/
export const CatalogResultListItem = CatalogSearchResultListItem;
@@ -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';
+1 -1
View File
@@ -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';