Merge pull request #20257 from backstage/camilaibs/create-catalog-search-result-item-extension
[DI] Create `Catalog` search result item extension
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Create an experimental `CatalogSearchResultItemExtension` for declarative integration with Backstage; it can be accessed via the `/alpha` import.
|
||||
@@ -5,19 +5,14 @@
|
||||
```ts
|
||||
import { BackstagePlugin } from '@backstage/frontend-plugin-api';
|
||||
import { Extension } from '@backstage/frontend-plugin-api';
|
||||
import { TranslationRef } from '@backstage/core-plugin-api/alpha';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const CatalogApi: Extension<{}>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const catalogTranslationRef: TranslationRef<
|
||||
'catalog',
|
||||
{
|
||||
readonly catalog_page_title: '{{orgName}} Catalog';
|
||||
readonly catalog_page_create_button_title: 'Create';
|
||||
}
|
||||
>;
|
||||
export const CatalogSearchResultListItemExtension: Extension<{
|
||||
noTrack?: boolean | undefined;
|
||||
}>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
const _default: BackstagePlugin;
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./alpha": "./src/alpha.ts",
|
||||
"./alpha": "./src/alpha.tsx",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"alpha": [
|
||||
"src/alpha.ts"
|
||||
"src/alpha.tsx"
|
||||
],
|
||||
"package.json": [
|
||||
"package.json"
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './translation';
|
||||
|
||||
import {
|
||||
createApiFactory,
|
||||
discoveryApiRef,
|
||||
@@ -31,6 +29,7 @@ import {
|
||||
catalogApiRef,
|
||||
starredEntitiesApiRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';
|
||||
import { DefaultStarredEntitiesApi } from './apis';
|
||||
|
||||
/** @alpha */
|
||||
@@ -55,8 +54,23 @@ export const StarredEntitiesApi = createApiExtension({
|
||||
}),
|
||||
});
|
||||
|
||||
/** @alpha */
|
||||
export const CatalogSearchResultListItemExtension =
|
||||
createSearchResultListItemExtension({
|
||||
id: 'catalog',
|
||||
predicate: result => result.type === 'software-catalog',
|
||||
component: () =>
|
||||
import('./components/CatalogSearchResultListItem').then(
|
||||
m => m.CatalogSearchResultListItem,
|
||||
),
|
||||
});
|
||||
|
||||
/** @alpha */
|
||||
export default createPlugin({
|
||||
id: 'catalog',
|
||||
extensions: [CatalogApi, StarredEntitiesApi],
|
||||
extensions: [
|
||||
CatalogApi,
|
||||
StarredEntitiesApi,
|
||||
CatalogSearchResultListItemExtension,
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user