reuse format logic from serializeEntityRef

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-02-11 15:03:04 +01:00
committed by Fredrik Adelöw
parent d08b6d035d
commit 854ef5ddff
@@ -18,7 +18,6 @@ import {
Entity,
EntityName,
ENTITY_DEFAULT_NAMESPACE,
stringifyEntityRef,
} from '@backstage/catalog-model';
export function formatEntityRefTitle(
@@ -45,13 +44,9 @@ export function formatEntityRefTitle(
}
kind = kind.toLocaleLowerCase('en-US');
return `${stringifyEntityRef({
kind:
defaultKind && defaultKind.toLocaleLowerCase('en-US') === kind
? ''
: kind,
name,
namespace,
})}`;
kind =
defaultKind && defaultKind.toLocaleLowerCase('en-US') === kind
? undefined
: kind;
return `${kind ? `${kind}:` : ''}${namespace ? `${namespace}/` : ''}${name}`;
}