catalog: use the ownerBy relation to display owners
Co-authored-by: blam <ben@blam.sh>
This commit is contained in:
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
RELATION_OWNED_BY,
|
||||
serializeEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
@@ -139,7 +144,20 @@ export function AboutCard({ entity, variant }: AboutCardProps) {
|
||||
</AboutField>
|
||||
<AboutField
|
||||
label="Owner"
|
||||
value={entity?.spec?.owner as string}
|
||||
value={entity?.relations
|
||||
?.filter(r => r.type === RELATION_OWNED_BY)
|
||||
.map(({ target: { kind, name, namespace } }) =>
|
||||
// TODO(Rugvip): we want to provide some utils for this
|
||||
serializeEntityRef({
|
||||
kind,
|
||||
name,
|
||||
namespace:
|
||||
namespace === ENTITY_DEFAULT_NAMESPACE
|
||||
? undefined
|
||||
: namespace,
|
||||
}),
|
||||
)
|
||||
.join(', ')}
|
||||
gridSizes={{ xs: 12, sm: 6, lg: 4 }}
|
||||
/>
|
||||
<AboutField
|
||||
|
||||
Reference in New Issue
Block a user