Merge pull request #18770 from philips-forks/master

Add email to index for user entity
This commit is contained in:
Patrik Oldsberg
2023-08-15 12:04:04 +02:00
committed by GitHub
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-module-catalog': patch
---
Add User Entity email to the search index so that users can be found by their email.
@@ -42,6 +42,7 @@ const userEntity = {
spec: {
profile: {
displayName: 'User 1',
email: 'test@test.com',
},
},
};
@@ -94,7 +95,7 @@ describe('DefaultCatalogCollatorEntityTransformer', () => {
expect(document).toMatchObject({
title: userEntity.metadata.name,
text: `${userEntity.metadata.description} : ${userEntity.spec.profile.displayName}`,
text: `${userEntity.metadata.description} : ${userEntity.spec.profile.displayName} : ${userEntity.spec.profile.email}`,
namespace: 'default',
componentType: 'other',
lifecycle: '',
@@ -27,6 +27,12 @@ const getDocumentText = (entity: Entity): string => {
}
}
if (isUserEntity(entity)) {
if (entity.spec?.profile?.email) {
documentTexts.push(entity.spec.profile.email);
}
}
return documentTexts.join(' : ');
};