Skip to content

Commit 9c92bfa

Browse files
authored
Merge pull request #2764 from port-labs/PORTN-3600-add-matchany-examples
Portn 3600 add matchany examples
2 parents 371a92a + ffabed8 commit 9c92bfa

File tree

6 files changed

+555
-414
lines changed

6 files changed

+555
-414
lines changed

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

Lines changed: 72 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ When looking at the entity page of a certain `Workflow Run`, the related entitie
6767

6868

6969
:::tip Relation path options
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).
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).
7171

7272
Using "All paths" is less performant than selecting a specific path, as it requires the system to evaluate multiple relationship paths.
7373
:::
@@ -174,57 +174,66 @@ If **Deployment Workflow** has multiple relations to **Microservice** (e.g., `de
174174
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.
175175
:::
176176

177-
#### Self relation
177+
#### Self-relation
178178

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.
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.
180180

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
181+
For example, consider a **Team** blueprint where:
182+
- Organizations contain teams.
183+
- Teams can belong to other organizational entities (like groups).
185184

186-
When defining a self relation, you can specify how many "hops" to traverse in the relationship chain.
185+
All entities share the same blueprint but have hierarchical relationships.
186+
187+
When defining a self-relation, you can specify how many "hops" to traverse in the relationship chain.
187188
Hops represent the number of jumps you want to make upstream or downstream through the self-relation.
188189

189-
<h4>Set up self relations</h4>
190+
:::tip Create a self-relation
191+
Before performing the following steps, make sure the desired blueprint has a relation to itself.
192+
193+
<details>
194+
<summary><b>Add self-relation (click to exapnd)</b></summary>
195+
1. Go to the [Builder](https://app.getport.io/settings/data-model) page of your portal.
196+
2. Choose the relevant blueprint.
197+
3. Click the `+ New relation` button.
198+
4. Give the property a `title`, choose the same blueprint in the `Related to` field.
199+
5. Choose the entity limit and whether its required.
200+
6. Click `Save`.
201+
</details>
202+
:::
190203

191-
Follow these steps to set up a self relation in related entities:
204+
**Set up self-relations tab**
192205

193-
1. Click the `+` button above the Related Entities table.
206+
To add a self-relation tab to the related entities:
194207

195-
2. Choose your blueprint as the `Related blueprint`.
208+
1. Click the `+` button in the **Related Entities** table.
196209

197-
3. Select the self relation path from the available paths.
210+
2. Choose your blueprint as the **Related blueprint**.
198211

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-
:::
212+
3. Select the self-relation path from the available paths.
202213

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.
214+
4. If you want to traverse more than one hop, switch to `Json mode`.
206215

216+
In JSON mode you can:
217+
- Specify multiple self-relation identifiers (for fixed hops).
207218
```json showLineNumbers
208-
"relationPath": {
219+
"relationPath": {
209220
"path": [
210221
"self_relation",
211222
"self_relation"
212-
]
213-
}
223+
]
224+
}
214225
```
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
226+
227+
- Use maxHops (for variable hops).
228+
```json showLineNumbers
219229
"relationPath": {
220230
{
221231
"relation": "<SELF_RELATION_IDENTIFIER>",
222232
"maxHops": <number between 1 and 15>
223233
}
224234
}
225235
```
226-
227-
You can also have a mix of fixed and variable hops.
236+
- Combine fixed hops with maxHops for mixed control.
228237

229238
```json showLineNumbers
230239
"relationPath": {
@@ -238,27 +247,28 @@ Follow these steps to set up a self relation in related entities:
238247
}
239248
```
240249

241-
:::info maxHops limitation
242-
You can only use `maxHops` once in a path and it accepts a number between 1 and 15.
250+
:::info `maxHops` limitation
251+
The `maxHops` parameter can only be applied **once** per path, and it accepts values from **1 to 15**.
243252
:::
244253

245-
6. Click on `Save` to save the tab.
254+
5. Click on `Save` to save the tab.
246255

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.
256+
:::info Self-relation identifier
257+
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.
249258
:::
250259

251260

252-
<h4>Examples</h4>
261+
**Examples**
262+
253263
Let's take a look at some examples using the concept of Teams.
254264

255-
<img src='/img/software-catalog/pages/relatedEntitiesTeamExample.png' border='1px' width='100%' />
265+
<img src='/img/software-catalog/pages/relatedEntitiesTeamExample.png' border='1px' width='90%' />
256266

257267
<br /><br />
258268

259-
**Basic self relation with multiple self relations:**
269+
**Basic self-relation with multiple self-relations:**
260270

261-
If you want exactly 2 hops, specify the relation twice:
271+
If you want **exactly 2 hops**, specify the relation twice:
262272

263273
```json showLineNumbers
264274
{
@@ -277,8 +287,9 @@ If you want exactly 2 hops, specify the relation twice:
277287
}
278288
}
279289
```
290+
In this case, the added tab under the `Unit` entity should show the `Group` entity.
280291

281-
**Self relation with maxHops for variable hops:**
292+
**Self-relation with maxHops for variable hops:**
282293

283294
If you want a variable number of hops (between 1 and 15), use maxHops:
284295

@@ -302,24 +313,37 @@ If you want a variable number of hops (between 1 and 15), use maxHops:
302313
}
303314
```
304315

316+
In this case, the added tab under the `Unit` entity should show the `Basic Team`, `Group` and `Office` entities.
317+
305318
**Mixed approach example:**
306319

307320
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`.
308321

309322
```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-
]
323+
{
324+
"title": "Team Hierarchy",
325+
"targetBlueprint": "Team",
326+
"dataset": {
327+
"combinator": "and",
328+
"rules": []
329+
},
330+
"relationPath": {
331+
"path": [
332+
"self_relation", // 1st hop: Unit -> Basic Team
333+
"self_relation", // 2nd hop: Basic Team -> Group
334+
{
335+
"relation": "team_self_relation",
336+
"maxHops": 3 // Continues from Group, adding up to 3 more hops (Group -> Office -> etc.)
337+
}
338+
],
339+
"fromBlueprint": "Team"
340+
}
319341
}
320342
```
321343

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.
344+
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.
345+
346+
In this case, the added tab under the `Unit`entity should show the `Group` and `Office` entities.
323347

324348
**Simple relation path example:**
325349

docs/search-and-query/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 3
2+
sidebar_position: 5
33
---
44

55
import Tabs from "@theme/Tabs"

docs/search-and-query/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 1
2+
sidebar_position: 3
33
---
44

55
import Tabs from "@theme/Tabs"

docs/search-and-query/global-search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 1
2+
sidebar_position: 4
33
---
44

55
import PortTooltip from "/src/components/tooltip/tooltip.jsx"

0 commit comments

Comments
 (0)