chore: move code because DefaultCatalogCollator is deprecated

Signed-off-by: djamaile <rdjamaile@gmail.com>
This commit is contained in:
djamaile
2022-04-14 10:15:12 +02:00
parent 16a40ac4c0
commit ddfc49bcd2
3 changed files with 4 additions and 9 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@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.
Fix wrong return type of the `isGroupEntity` function.
@@ -22,7 +22,6 @@ import {
Entity,
stringifyEntityRef,
UserEntity,
GroupEntity,
} from '@backstage/catalog-model';
import { Config } from '@backstage/config';
import {
@@ -98,13 +97,9 @@ 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) || this.isGroupEntity(entity)) {
if (this.isUserEntity(entity)) {
if (entity.spec?.profile?.displayName && documentText) {
// combine displayName and description
const displayName = entity.spec?.profile?.displayName;
+2 -2
View File
@@ -14,13 +14,13 @@
* limitations under the License.
*/
import { Entity, UserEntity } from '@backstage/catalog-model';
import { Entity, UserEntity, GroupEntity } from '@backstage/catalog-model';
function isUserEntity(entity: Entity): entity is UserEntity {
return entity.kind.toLocaleUpperCase('en-US') === 'USER';
}
function isGroupEntity(entity: Entity): entity is UserEntity {
function isGroupEntity(entity: Entity): entity is GroupEntity {
return entity.kind.toLocaleUpperCase('en-US') === 'GROUP';
}