Merge pull request #20265 from backstage/camilaibs/search-plugin-di-adjustments
[DI] Search plugin refinements
This commit is contained in:
@@ -48,7 +48,7 @@ export type SearchResultItemExtensionOptions<
|
||||
},
|
||||
> = {
|
||||
id: string;
|
||||
at: string;
|
||||
at?: string;
|
||||
configSchema?: PortableSchema<TConfig>;
|
||||
component: (options: {
|
||||
config: TConfig;
|
||||
|
||||
@@ -65,7 +65,7 @@ export type SearchResultItemExtensionOptions<
|
||||
/**
|
||||
* The extension attachment point (e.g., search modal or page).
|
||||
*/
|
||||
at: string;
|
||||
at?: string;
|
||||
/**
|
||||
* Optional extension config schema.
|
||||
*/
|
||||
@@ -97,7 +97,7 @@ export function createSearchResultListItemExtension<
|
||||
) as PortableSchema<TConfig>);
|
||||
return createExtension({
|
||||
id: `plugin.search.result.item.${options.id}`,
|
||||
at: options.at,
|
||||
at: options.at ?? 'plugin.search.page/items',
|
||||
configSchema,
|
||||
output: {
|
||||
item: searchResultItemExtensionData,
|
||||
|
||||
@@ -200,14 +200,16 @@ export const SearchPage = createPageExtension({
|
||||
<SearchResults>
|
||||
{({ results }) =>
|
||||
results.map((result, index) => {
|
||||
const { noTrack } = config;
|
||||
const { document, ...rest } = result;
|
||||
const SearchResultListItem =
|
||||
getResultItemComponent(result);
|
||||
return (
|
||||
<SearchResultListItem
|
||||
{...rest}
|
||||
key={index}
|
||||
rank={result.rank}
|
||||
result={result.document}
|
||||
noTrack={config.noTrack}
|
||||
result={document}
|
||||
noTrack={noTrack}
|
||||
/>
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user