Skip to content

Commit 3f37771

Browse files
authored
Merge pull request #2693 from port-labs/PORTN-3487-add-missing-section-to-entity-relation-page-on-special-case
PORTN 3487 add missing section to entity relation page on special case
2 parents 3f0d007 + 2a0bd5a commit 3f37771

File tree

7 files changed

+237
-12
lines changed

7 files changed

+237
-12
lines changed

docs/customize-pages-dashboards-and-plugins/page/entity-page.md

Lines changed: 237 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Additional widgets can be added by clicking on the `+ Widget` button in the top
3232

3333
## Related entities
3434

35-
By default, all related entities in the same direction will automatically appear in this table. This is true for both forward-related and backward-related entities. Indirectly-related entities will not appear.
35+
By default, all related entities in the same direction will automatically appear in this table. This is true for both forward-related and backward-related entities. Indirectly-related entities will not appear but can be added manually,
36+
check out the [indirect relations](#indirect-relation) section on how to add indirectly related entities.
3637

3738
For example:
3839

@@ -45,30 +46,43 @@ When looking at the entity page of a certain `Workflow Run`, the related entitie
4546

4647
### Add a Related entities tab
4748

48-
Click the `+` button above the table to add a custom tab.
49+
1. Click the `+` button above the table to add a custom tab.
4950

50-
1. Set the tab's `Name` and optional `Description`.
51+
<img src='/img/software-catalog/pages/relatedEntitieNewTab.png' border='1px' width='50%' />
52+
<br />
5153

52-
2. Choose the `Related blueprint` you want to display.
54+
2. Fill in the form:
5355

54-
3. Pick a `Relation path`:
56+
<img src='/img/software-catalog/pages/relatedEntitiesDetails.png' border='1px' width='50%' />
5557

56-
- **All paths** – includes all available paths from the current blueprint to the target blueprint.
57-
- **Specific path** – choose one specific relation chain (multi‑hop is supported).
58+
- Set the tab's `Name` and optional `Description`.
59+
60+
- Choose the `Related blueprint` you want to display.
61+
62+
- Pick a `Relation path`:
63+
- **All paths** – includes all available paths from the current blueprint to the target blueprint.
64+
- **Specific path** – choose the specific relation chain.
65+
66+
- (Optional) Add `Additional filters` to restrict the result set.
5867

59-
4. (Optional) Add `Additional filters` to restrict the result set.
6068

6169
:::tip Relation path options
62-
Use "all paths" for a broad overview. Choose a specific path when multiple paths exist to the same blueprint and you want the tab to reflect exactly one path.
70+
The relation path dropdown displays straightforward, acyclic paths. For complex scenarios involving circular relationships, advanced path configurations, multiple self relations, or maxHops, use [JSON mode](#filters-and-edit-json).
71+
72+
Using "All paths" is less performant than selecting a specific path, as it requires the system to evaluate multiple relationship paths.
6373
:::
6474

75+
#### Additional filters
6576

66-
#### Filters and Edit JSON
77+
<img src='/img/software-catalog/pages/jsonTogglerAddTab.png' border='1px' width='50%' />
78+
<br /><br />
6779

6880
Selecting `Filters` opens a dialog where you can build conditions using form controls (property, operator, value).
6981
You can switch to a JSON editor using the `Edit JSON` button to define the dataset directly.
7082

71-
The dataset follows this structure:
83+
The filters visual editor doesn't support nested queries so in the case of nested queries, use the JSON editor to define the dataset.
84+
85+
The dataset follows this structure based on the [search and query syntax](https://docs.port.io/search-and-query):
7286

7387
```json showLineNumbers
7488
{
@@ -83,7 +97,6 @@ The dataset follows this structure:
8397
}
8498
```
8599

86-
87100
Use the JSON editor when you need to copy/paste filter sets, keep them in source control, or express conditions that are faster to author as JSON. You can toggle back to the form at any time.
88101

89102
<h4>Define the tab in JSON mode</h4>
@@ -121,6 +134,218 @@ Other properties will be hidden by default.
121134

122135
You can always customize the table to [hide/show columns](/customize-pages-dashboards-and-plugins/page/catalog-page?create-page=ui#hideshow-columns).
123136

137+
#### Indirect relations
138+
139+
In some scenarios, you may want to display entities that are not directly related but connected through a common blueprint. This is useful when you have multiple services that share relationships with a common entity.
140+
141+
For example, consider this relationship structure:
142+
143+
<img src='/img/software-catalog/pages/relatedEntitiesIndirectRelations.png' border='1px' width='95%' />
144+
145+
<br /><br />
146+
147+
From the diagram, we can see that:
148+
149+
- **Deployment Workflow** has a relation to **Microservice**
150+
- **Deployment** has relations to **Microservice** (including `relation_1` and `relation_2`)
151+
- **Deployment Workflow** and **Deployment** are not directly related, but connected through **Microservice**
152+
153+
When you're on the entity page of a **Deployment Workflow**, the related entity **Microservice** automatically appears, but **Deployment** does not, since its relation is in the other direction. However, you can create a custom tab to show **Deployment** entities by leveraging the indirect relationship through **Microservice**.
154+
155+
156+
<h4>Add a tab for an indirectly related blueprint</h4>
157+
158+
159+
1. Click the `+` button above the Related Entities table.
160+
161+
2. Set the tab name and description.
162+
163+
3. Choose **Deployment** as the `Related blueprint`.
164+
165+
4. For the `Relation or property`, select the specific relation from **Deployment Workflow** to **Microservice** that you want to traverse.
166+
167+
<img src='/img/software-catalog/pages/relatedEntitiesIndirectRelations2.png' border='1px' width='100%' />
168+
169+
This approach allows you to display indirectly related entities while maintaining control over the specific relationship path used for the connection.
170+
171+
:::info Multiple relations scenario
172+
If **Deployment Workflow** has multiple relations to **Microservice** (e.g., `deployment_target` and `monitoring_target`), you can choose which specific relation path to use for more refined and filtered results.
173+
174+
Additionally, when you have an existing relation between blueprints, Port automatically creates a mirror property relation that allows you to traverse the relationship in both directions. This mirror relation will appear as an option in the relation dropdown, enabling you to explore connections from either side of the relationship.
175+
:::
176+
177+
#### Self relation
178+
179+
A self relation allows a blueprint to establish a relationship with itself. This is useful when you want entities of the same blueprint to be related to other entities within that same blueprint.
180+
181+
For example, consider an **Organization** blueprint where:
182+
- Organizations contain teams
183+
- Teams can belong to other organizational entities (like groups)
184+
- All entities share the same blueprint but have hierarchical relationships
185+
186+
When defining a self relation, you can specify how many "hops" to traverse in the relationship chain.
187+
Hops represent the number of jumps you want to make upstream or downstream through the self-relation.
188+
189+
<h4>Set up self relations</h4>
190+
191+
Follow these steps to set up a self relation in related entities:
192+
193+
1. Click the `+` button above the Related Entities table.
194+
195+
2. Choose your blueprint as the `Related blueprint`.
196+
197+
3. Select the self relation path from the available paths.
198+
199+
:::tip How self relation hops work
200+
If you want more than one **hop** then you would have to toggle `Json mode` on to specify more than one self relation blueprint identifier for the number of **hops** you want to make.
201+
:::
202+
203+
4. You can also toggle to `Json mode` in the "Add tab" dialog to define the relationship path with precise control over hops.
204+
205+
For example if we want to make 2 hops then we would have to specify 2 self relation blueprint identifiers in the path array.
206+
207+
```json showLineNumbers
208+
"relationPath": {
209+
"path": [
210+
"self_relation",
211+
"self_relation"
212+
]
213+
}
214+
```
215+
216+
In JSON mode, you can use the `maxHops` feature to control the number of relationship traversals. Path elements can be objects instead of strings, and `maxHops` can only be specified once in the path.
217+
218+
```json showLineNumbers
219+
"relationPath": {
220+
{
221+
"relation": "<RELATION_IDENTIFIER>",
222+
"maxHops": <number between 1 and 15>
223+
}
224+
}
225+
```
226+
227+
You can also have a mix of fixed and variable hops.
228+
229+
```json showLineNumbers
230+
"relationPath": {
231+
"path": [
232+
"self_relation",
233+
{
234+
"relation": "<RELATION_IDENTIFIER>",
235+
"maxHops": <number between 1 and 15>
236+
}
237+
]
238+
}
239+
```
240+
241+
:::info maxHops limitation
242+
You can only use `maxHops` once in a path and it it accepts a number between 1 and 15.
243+
:::
244+
245+
6. Click on `Save` to save the tab.
246+
247+
:::info Self relation identifier
248+
Note that `self_relation` in these examples represents the identifier of the self relation you created in your blueprint. Replace it with your actual self relation identifier.
249+
:::
250+
251+
252+
<h4>Examples</h4>
253+
Let's take a look at some examples using the concept of Teams.
254+
255+
<img src='/img/software-catalog/pages/relatedEntitiesTeamExample.png' border='1px' width='100%' />
256+
257+
<br /><br />
258+
259+
**Basic self relation with multiple self relations:**
260+
261+
If you want exactly 2 hops, specify the relation twice:
262+
263+
```json showLineNumbers
264+
{
265+
"dataset": {
266+
"combinator": "and",
267+
"rules": []
268+
},
269+
"title": "Team Hierarchy",
270+
"targetBlueprint": "Team",
271+
"relationPath": {
272+
"path": [
273+
"self_relation",
274+
"self_relation"
275+
],
276+
"fromBlueprint": "Team"
277+
}
278+
}
279+
```
280+
281+
**Self relation with maxHops for variable hops:**
282+
283+
If you want a variable number of hops (between 1 and 15), use maxHops:
284+
285+
```json showLineNumbers
286+
{
287+
"dataset": {
288+
"combinator": "and",
289+
"rules": []
290+
},
291+
"title": "Team Hierarchy",
292+
"targetBlueprint": "Team",
293+
"relationPath": {
294+
"path": [
295+
{
296+
"relation": "team_self_relation",
297+
"maxHops": 4
298+
}
299+
],
300+
"fromBlueprint": "Team"
301+
}
302+
}
303+
```
304+
305+
**Mixed approach example:**
306+
307+
You can also mix fixed hops with variable hops. For example, if you specify `self_relation` twice followed by a `maxHops` object, the system will start traversing from the 2 hops already made and continue with the additional hops specified in `maxHops`.
308+
309+
```json showLineNumbers
310+
"relationPath": {
311+
"path": [
312+
"self_relation", // 1st hop: Unit -> Basic Team
313+
"self_relation", // 2nd hop: Basic Team -> Group
314+
{
315+
"relation": "team_self_relation",
316+
"maxHops": 3 // Continues from Group, adding up to 3 more hops (Group -> Office -> etc.)
317+
}
318+
]
319+
}
320+
```
321+
322+
In this example, the system will traverse 2 fixed hops (Unit → Basic Team → Group) and then continue with up to 3 additional hops using the `team_self_relation`, starting from where the fixed hops left off. This could represent a complete organizational hierarchy from Unit all the way up to higher-level organizational structures.
323+
324+
**Simple relation path example:**
325+
326+
You can also use regular relations (not self-relations) in your paths:
327+
328+
```json showLineNumbers
329+
{
330+
"dataset": {
331+
"combinator": "and",
332+
"rules": []
333+
},
334+
"title": "Developer",
335+
"targetBlueprint": "developer",
336+
"relationPath": {
337+
"path": [
338+
"member_of"
339+
]
340+
}
341+
}
342+
```
343+
344+
:::info The fromBlueprint property
345+
The `fromBlueprint` property is only needed when the path starts from the current page's blueprint and ends with the entities listed in the tab. For more information about relation paths see the [Relation operators](https://docs.port.io/search-and-query/#relation-operators) documentation.
346+
:::
347+
348+
124349
## Runs
125350

126351
If the entity's blueprint has any [actions](/actions-and-automations/create-self-service-experiences/) configured, the `Runs` tab will display their history log, results, log streams, and more.
116 KB
Loading
106 KB
Loading
150 KB
Loading
181 KB
Loading
159 KB
Loading
239 KB
Loading

0 commit comments

Comments
 (0)