Address PR review feedback from freben
- Consolidate changesets: one for catalog-react (deprecation), one combined for the remaining 5 plugins - Add entity-presentation to microsite/sidebars.ts - Update @deprecated tags to point to useEntityPresentation / entityPresentationApiRef only, not defaultEntityPresentation - Use entityPresentationApiRef with .promise in async loaders (StepPrepareCreatePullRequest, TemplateFormPreviewer) - Add optional entityPresentation?: EntityPresentationApi param to sync column factories and use .snapshot when available (columnFactories, EntityTable/columns, EntityOwnerPicker, CatalogTable) - Rewrite entity-presentation.md to recommend .snapshot/.promise instead of defaultEntityPresentation - Update TSDoc on entityPresentationApiRef, EntityPresentationApi, defaultEntityPresentation, useEntityPresentation, EntityDisplayName - Re-export presentation API types from alpha entry point - Update API reports - Fix test mocks for entityPresentationApiRef Made-with: Cursor Signed-off-by: Marat Dyatko <maratd@spotify.com> Made-with: Cursor
This commit is contained in:
@@ -18,12 +18,13 @@ import { MouseEvent, useState, useCallback } from 'react';
|
||||
import {
|
||||
catalogApiRef,
|
||||
defaultEntityPresentation,
|
||||
entityPresentationApiRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import Autocomplete from '@material-ui/lab/Autocomplete';
|
||||
import useAsync from 'react-use/esm/useAsync';
|
||||
import Popover from '@material-ui/core/Popover';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { useApi, useApiHolder } from '@backstage/core-plugin-api';
|
||||
import { ResponseErrorPanel } from '@backstage/core-components';
|
||||
import { GroupEntity } from '@backstage/catalog-model';
|
||||
import { GroupListPickerButton } from './GroupListPickerButton';
|
||||
@@ -43,6 +44,8 @@ export type GroupListPickerProps = {
|
||||
/** @public */
|
||||
export const GroupListPicker = (props: GroupListPickerProps) => {
|
||||
const catalogApi = useApi(catalogApiRef);
|
||||
const apis = useApiHolder();
|
||||
const entityPresentationApi = apis.get(entityPresentationApiRef);
|
||||
|
||||
const { onChange, groupTypes, placeholder = '', defaultValue = '' } = props;
|
||||
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
||||
@@ -99,7 +102,9 @@ export const GroupListPicker = (props: GroupListPickerProps) => {
|
||||
options={groups ?? []}
|
||||
groupBy={option => option.spec.type}
|
||||
getOptionLabel={option =>
|
||||
defaultEntityPresentation(option).primaryTitle
|
||||
entityPresentationApi
|
||||
? entityPresentationApi.forEntity(option).snapshot.primaryTitle
|
||||
: defaultEntityPresentation(option).primaryTitle
|
||||
}
|
||||
inputValue={inputValue}
|
||||
onInputChange={(_, value) => setInputValue(value)}
|
||||
|
||||
Reference in New Issue
Block a user