feat: small refactor for the search package
Co-authored-by: Fredrik Adelöw <freben@users.noreply.github.com> Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -6,16 +6,19 @@
|
||||
/// <reference types="react" />
|
||||
|
||||
import { AnyExtensionInputMap } from '@backstage/frontend-plugin-api';
|
||||
import { AnyRouteRefParams } from '@backstage/frontend-plugin-api';
|
||||
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExtensionBlueprint } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
||||
import { PortableSchema } from '@backstage/frontend-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ResolvedExtensionInputs } from '@backstage/frontend-plugin-api';
|
||||
import { ResourcePermission } from '@backstage/plugin-permission-common';
|
||||
import { RouteRef } from '@backstage/frontend-plugin-api';
|
||||
import { TranslationRef } from '@backstage/core-plugin-api/alpha';
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated (undocumented)
|
||||
export const catalogExtensionData: {
|
||||
entityContentTitle: ConfigurableExtensionDataRef<
|
||||
string,
|
||||
@@ -92,7 +95,7 @@ export const catalogReactTranslationRef: TranslationRef<
|
||||
}
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated (undocumented)
|
||||
export function createEntityCardExtension<
|
||||
TConfig extends {
|
||||
filter?: string;
|
||||
@@ -125,7 +128,7 @@ export function createEntityCardExtension<
|
||||
string | undefined
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated (undocumented)
|
||||
export function createEntityContentExtension<
|
||||
TInputs extends AnyExtensionInputMap,
|
||||
>(options: {
|
||||
@@ -164,6 +167,117 @@ export function createEntityContentExtension<
|
||||
string | undefined
|
||||
>;
|
||||
|
||||
// @alpha
|
||||
export const EntityCardBlueprint: ExtensionBlueprint<
|
||||
'entity-card',
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
loader: () => Promise<JSX.Element>;
|
||||
filter?: string | ((entity: Entity) => boolean) | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<React_2.JSX.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
{
|
||||
filterFunction: ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
{}
|
||||
>;
|
||||
filterExpression: ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
{}
|
||||
>;
|
||||
}
|
||||
>;
|
||||
|
||||
// @alpha
|
||||
export const EntityContentBlueprint: ExtensionBlueprint<
|
||||
'entity-content',
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
loader: () => Promise<JSX.Element>;
|
||||
defaultPath: string;
|
||||
defaultTitle: string;
|
||||
routeRef?: RouteRef<AnyRouteRefParams> | undefined;
|
||||
filter?: string | ((entity: Entity) => boolean) | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<React_2.JSX.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<string, 'core.routing.path', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
RouteRef<AnyRouteRefParams>,
|
||||
'core.routing.ref',
|
||||
RouteRef<AnyRouteRefParams> & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<string, 'catalog.entity-content-title', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
{
|
||||
path: string | undefined;
|
||||
title: string | undefined;
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
title?: string | undefined;
|
||||
path?: string | undefined;
|
||||
},
|
||||
{
|
||||
title: ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-content-title',
|
||||
{}
|
||||
>;
|
||||
filterFunction: ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
{}
|
||||
>;
|
||||
filterExpression: ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
{}
|
||||
>;
|
||||
}
|
||||
>;
|
||||
|
||||
// @alpha
|
||||
export function isOwnerOf(owner: Entity, entity: Entity): boolean;
|
||||
|
||||
|
||||
@@ -6,13 +6,35 @@
|
||||
/// <reference types="react" />
|
||||
|
||||
import { AnyExtensionInputMap } from '@backstage/frontend-plugin-api';
|
||||
import { AnyRouteRefParams } from '@backstage/frontend-plugin-api';
|
||||
import { BackstagePlugin } from '@backstage/frontend-plugin-api';
|
||||
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExtensionBlueprint } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionInput } from '@backstage/frontend-plugin-api';
|
||||
import { ExternalRouteRef } from '@backstage/frontend-plugin-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { PortableSchema } from '@backstage/frontend-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import { RouteRef } from '@backstage/frontend-plugin-api';
|
||||
import { TranslationRef } from '@backstage/core-plugin-api/alpha';
|
||||
|
||||
// @alpha
|
||||
export const CatalogFilterBlueprint: ExtensionBlueprint<
|
||||
'catalog-filter',
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
loader: () => Promise<JSX.Element>;
|
||||
},
|
||||
ConfigurableExtensionDataRef<React_2.JSX.Element, 'core.reactElement', {}>,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
never
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const catalogTranslationRef: TranslationRef<
|
||||
'catalog',
|
||||
@@ -98,7 +120,9 @@ export const catalogTranslationRef: TranslationRef<
|
||||
}
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-catalog" does not have an export "CatalogFilterExtensionBlueprint"
|
||||
//
|
||||
// @alpha @deprecated (undocumented)
|
||||
export function createCatalogFilterExtension<
|
||||
TInputs extends AnyExtensionInputMap,
|
||||
TConfig,
|
||||
@@ -141,7 +165,344 @@ const _default: BackstagePlugin<
|
||||
}>;
|
||||
unregisterRedirect: ExternalRouteRef<undefined>;
|
||||
},
|
||||
{}
|
||||
{
|
||||
'entity-card:catalog/about': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'about'
|
||||
>;
|
||||
'entity-card:catalog/links': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'links'
|
||||
>;
|
||||
'entity-card:catalog/labels': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'labels'
|
||||
>;
|
||||
'entity-card:catalog/depends-on-components': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'depends-on-components'
|
||||
>;
|
||||
'entity-card:catalog/depends-on-resources': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'depends-on-resources'
|
||||
>;
|
||||
'entity-card:catalog/has-components': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'has-components'
|
||||
>;
|
||||
'entity-card:catalog/has-resources': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'has-resources'
|
||||
>;
|
||||
'entity-card:catalog/has-subcomponents': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'has-subcomponents'
|
||||
>;
|
||||
'entity-card:catalog/has-subdomains': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'has-subdomains'
|
||||
>;
|
||||
'entity-card:catalog/has-systems': ExtensionDefinition<
|
||||
{
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
filter?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{},
|
||||
'entity-card',
|
||||
undefined,
|
||||
'has-systems'
|
||||
>;
|
||||
'entity-content:catalog/overview': ExtensionDefinition<
|
||||
{
|
||||
[x: string]: any;
|
||||
} & {
|
||||
path: string | undefined;
|
||||
title: string | undefined;
|
||||
filter: string | undefined;
|
||||
},
|
||||
{
|
||||
[x: string]: any;
|
||||
} & {
|
||||
filter?: string | undefined;
|
||||
title?: string | undefined;
|
||||
path?: string | undefined;
|
||||
},
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<string, 'core.routing.path', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
RouteRef<AnyRouteRefParams>,
|
||||
'core.routing.ref',
|
||||
RouteRef<AnyRouteRefParams> & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<string, 'catalog.entity-content-title', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{
|
||||
cards: ExtensionInput<
|
||||
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
|
||||
| ConfigurableExtensionDataRef<
|
||||
(entity: Entity) => boolean,
|
||||
'catalog.entity-filter-function',
|
||||
((entity: Entity) => boolean) & {
|
||||
optional: true;
|
||||
}
|
||||
>
|
||||
| ConfigurableExtensionDataRef<
|
||||
string,
|
||||
'catalog.entity-filter-expression',
|
||||
string & {
|
||||
optional: true;
|
||||
}
|
||||
>,
|
||||
{
|
||||
singleton: false;
|
||||
optional: false;
|
||||
}
|
||||
>;
|
||||
},
|
||||
'entity-content',
|
||||
undefined,
|
||||
'overview'
|
||||
>;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
/// <reference types="react" />
|
||||
|
||||
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionBlueprint } from '@backstage/frontend-plugin-api';
|
||||
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
|
||||
import { ListItemProps } from '@material-ui/core/ListItem';
|
||||
import { PortableSchema } from '@backstage/frontend-plugin-api';
|
||||
@@ -18,7 +19,7 @@ export type BaseSearchResultListItemProps<T = {}> = T & {
|
||||
result?: SearchDocument;
|
||||
} & Omit<ListItemProps, 'button'>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated
|
||||
export function createSearchResultListItemExtension<
|
||||
TConfig extends {
|
||||
noTrack?: boolean;
|
||||
@@ -35,9 +36,9 @@ export function createSearchResultListItemExtension<
|
||||
string | undefined
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated (undocumented)
|
||||
export namespace createSearchResultListItemExtension {
|
||||
const // (undocumented)
|
||||
const // @deprecated (undocumented)
|
||||
itemDataRef: ConfigurableExtensionDataRef<
|
||||
{
|
||||
predicate?: SearchResultItemExtensionPredicate | undefined;
|
||||
@@ -55,7 +56,7 @@ export type SearchResultItemExtensionComponent = <
|
||||
props: P,
|
||||
) => JSX.Element | null;
|
||||
|
||||
// @alpha (undocumented)
|
||||
// @alpha @deprecated (undocumented)
|
||||
export type SearchResultItemExtensionOptions<
|
||||
TConfig extends {
|
||||
noTrack?: boolean;
|
||||
@@ -79,5 +80,48 @@ export type SearchResultItemExtensionPredicate = (
|
||||
result: SearchResult,
|
||||
) => boolean;
|
||||
|
||||
// @alpha
|
||||
export const SearchResultListItemBlueprint: ExtensionBlueprint<
|
||||
'search-result-list-item',
|
||||
undefined,
|
||||
undefined,
|
||||
SearchResultListItemBlueprintParams,
|
||||
ConfigurableExtensionDataRef<
|
||||
{
|
||||
predicate?: SearchResultItemExtensionPredicate | undefined;
|
||||
component: SearchResultItemExtensionComponent;
|
||||
},
|
||||
'search.search-result-list-item.item',
|
||||
{}
|
||||
>,
|
||||
{},
|
||||
{
|
||||
noTrack: boolean;
|
||||
},
|
||||
{
|
||||
noTrack?: boolean | undefined;
|
||||
},
|
||||
{
|
||||
item: ConfigurableExtensionDataRef<
|
||||
{
|
||||
predicate?: SearchResultItemExtensionPredicate | undefined;
|
||||
component: SearchResultItemExtensionComponent;
|
||||
},
|
||||
'search.search-result-list-item.item',
|
||||
{}
|
||||
>;
|
||||
}
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export interface SearchResultListItemBlueprintParams {
|
||||
component: (options: {
|
||||
config: {
|
||||
noTrack?: boolean;
|
||||
};
|
||||
}) => Promise<SearchResultItemExtensionComponent>;
|
||||
predicate?: SearchResultItemExtensionPredicate;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./alpha": "./src/alpha.tsx",
|
||||
"./alpha": "./src/alpha/index.ts",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
@@ -36,7 +36,7 @@
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"alpha": [
|
||||
"src/alpha.tsx"
|
||||
"src/alpha/index.ts"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
|
||||
+6
-1
@@ -27,8 +27,9 @@ import {
|
||||
import {
|
||||
SearchResultListItemExtension,
|
||||
SearchResultListItemExtensionProps,
|
||||
} from '../extensions';
|
||||
} from '../../extensions';
|
||||
|
||||
/** @alpha */
|
||||
export interface SearchResultListItemBlueprintParams {
|
||||
/**
|
||||
* The extension component.
|
||||
@@ -43,6 +44,10 @@ export interface SearchResultListItemBlueprintParams {
|
||||
predicate?: SearchResultItemExtensionPredicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
* Creates SearchResultListItem extensions
|
||||
*/
|
||||
export const SearchResultListItemBlueprint = createExtensionBlueprint({
|
||||
kind: 'search-result-list-item',
|
||||
attachTo: {
|
||||
+2
-4
@@ -23,10 +23,8 @@ import { createExtensionTester } from '@backstage/frontend-test-utils';
|
||||
import { SearchResult } from '@backstage/plugin-search-common';
|
||||
import { screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import {
|
||||
BaseSearchResultListItemProps,
|
||||
createSearchResultListItemExtension,
|
||||
} from './alpha';
|
||||
import { createSearchResultListItemExtension } from './extensions';
|
||||
import { BaseSearchResultListItemProps } from './blueprints';
|
||||
|
||||
describe('createSearchResultListItemExtension', () => {
|
||||
it('Should use the correct result component', async () => {
|
||||
@@ -21,14 +21,12 @@ import {
|
||||
createExtension,
|
||||
createSchemaFromZod,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { SearchResultListItemExtension } from './extensions';
|
||||
import {
|
||||
SearchResultItemExtensionComponent,
|
||||
SearchResultItemExtensionPredicate,
|
||||
searchResultListItemDataRef,
|
||||
} from './blueprints/types';
|
||||
|
||||
export * from './blueprints';
|
||||
} from './blueprints';
|
||||
import { SearchResultListItemExtension } from '../extensions';
|
||||
import { searchResultListItemDataRef } from './blueprints/types';
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
@@ -128,5 +126,8 @@ export function createSearchResultListItemExtension<
|
||||
* @deprecated Use {@link SearchResultListItemBlueprint} instead
|
||||
*/
|
||||
export namespace createSearchResultListItemExtension {
|
||||
/**
|
||||
* @deprecated Use {@link SearchResultListItemBlueprint#dataRefs.item} instead
|
||||
*/
|
||||
export const itemDataRef = searchResultListItemDataRef;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './extensions';
|
||||
export * from './blueprints';
|
||||
Reference in New Issue
Block a user