Skip to main content

Entity Relations Picker

Overview

This picker can be used to let the user choose a value among a list of entities, that are related to another entity selected in a previous parameter.

Configuration

Here you can find a list of all the possible configurations for this picker:

propertydescriptionpossible values
returnFormatdefines what kind of value will be returned by the picker: - "ref": the picker will return a reference to the selected value (e.g. "component:default/finance.my-dp.0.my-workload") - "urn": the picker will return the URN representing the selected value (e.g. "urn:dmb:cmp:finance:my-dp:0:my-workload"). If not set, the default value is "urn""urn" | "ref"
relationdefines the relation between the main entity and the relates ones. As an example, if we want to extract all components of a system, the relation should be "partOf"<string>
ui:fieldNameindicates the name of the field from which we will extract the related entities<string>
ui:propertyoptional path of the ui:fieldName entity. If defined, the main entity will not be the one referenced by ui:fieldName directly, but rather it will be the entity found at this path in the entity<string>
ui:filtersoptional set of filters. If defined, the loaded entities will be filtered based on the values defined here.an array of objects with structure { key: string, value: string }
note

This picker replaces the deprecated EntityComponentsPicker. That picker is just an EntityRelationsPicker with relation hasPart, and a filter on spec.type if the ui:componentsFilter is set.

Example Use Cases

Let's see how we can use this picker in a couple of use cases:

  1. We want to select a component of a certain kind (e.g. a storage) belonging to the selected data product:
title: Storage belonging to the Data Product
description: Select one of the storages of the Data Product
type: string
ui:field: EntityRelationsPicker
ui:filters:
- key: spec.type
value: storage
ui:fieldName: dataproduct
relation: hasPart

In this case, the picker will show to the user only the components of type "storage" of the selected data product. For every component, it will the return their URN.

  1. We want to select a user belonging to a group. The group can be found in the spec.mesh.ownerGroup field of the selected domain:
title: Data Product Owner
description: Select a user from the owners of the domain
type: string
ui:field: EntityRelationsPicker
ui:fieldName: domain
ui:property: spec.mesh.ownerGroup
relation: hasMember
returnFormat: ref

In this case, the picker will present a list of users belonging to the group defined inside the selected domain. For example, if the spec.mesh.ownerGroup of the domain is group:my-group, the picker will list only users belonging to the my-group group. For every user their reference is returned (e.g. user:default/john.doe_company.com).