chore: update getDocumentText function to also return the displayName if the entity is of type group
Signed-off-by: djamaile <rdjamaile@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
When retrieving the text of a document also check if the entity is of type group. The function will then also return the display name and the description and not only the description.
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
Entity,
|
||||
stringifyEntityRef,
|
||||
UserEntity,
|
||||
GroupEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
@@ -97,9 +98,13 @@ export class DefaultCatalogCollator {
|
||||
return entity.kind.toLocaleUpperCase('en-US') === 'USER';
|
||||
}
|
||||
|
||||
private isGroupEntity(entity: Entity): entity is GroupEntity {
|
||||
return entity.kind.toLocaleUpperCase('en-US') === 'GROUP';
|
||||
}
|
||||
|
||||
private getDocumentText(entity: Entity): string {
|
||||
let documentText = entity.metadata.description || '';
|
||||
if (this.isUserEntity(entity)) {
|
||||
if (this.isUserEntity(entity) || this.isGroupEntity(entity)) {
|
||||
if (entity.spec?.profile?.displayName && documentText) {
|
||||
// combine displayName and description
|
||||
const displayName = entity.spec?.profile?.displayName;
|
||||
|
||||
Reference in New Issue
Block a user