From 6d5a060d1fe292b3fce06bd67d4348114887b801 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 29 Sep 2023 11:59:17 +0200 Subject: [PATCH] feat(explore): migrate search result item extension Signed-off-by: Camila Belo --- plugins/explore/package.json | 1 + plugins/explore/src/alpha.tsx | 20 ++++++++++++++++++++ yarn.lock | 1 + 3 files changed, 22 insertions(+) diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 63e59dd9a8..dcf0b75577 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -50,6 +50,7 @@ "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/errors": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", "@backstage/plugin-explore-common": "workspace:^", "@backstage/plugin-explore-react": "workspace:^", diff --git a/plugins/explore/src/alpha.tsx b/plugins/explore/src/alpha.tsx index eb2f165350..1825af5ddb 100644 --- a/plugins/explore/src/alpha.tsx +++ b/plugins/explore/src/alpha.tsx @@ -13,3 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import { createPlugin } from '@backstage/frontend-plugin-api'; +import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha'; + +/** @alpha */ +export const ExploreSearchResultListItemExtension = + createSearchResultListItemExtension({ + id: 'explore', + predicate: result => result.type === 'tools', + component: () => + import('./components/ToolSearchResultListItem').then( + m => m.ToolSearchResultListItem, + ), + }); + +/** @alpha */ +export default createPlugin({ + id: 'explore', + extensions: [ExploreSearchResultListItemExtension], +}); diff --git a/yarn.lock b/yarn.lock index 3dd3f6315b..c2909aaec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6811,6 +6811,7 @@ __metadata: "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" "@backstage/errors": "workspace:^" + "@backstage/frontend-plugin-api": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" "@backstage/plugin-explore-common": "workspace:^"