Skip to content

Commit 7ca40bf

Browse files
authored
Merge pull request #603 from zihanKuang/edge-guide
Enhance Embed Shortcode and Add "Understanding Edge Styles" Guide
2 parents 4243d65 + e5a0cf1 commit 7ca40bf

5 files changed

Lines changed: 434 additions & 9 deletions

File tree

content/en/kanvas/designer/understanding-edges/images/embedded-design-edge-annotation-relationship-copy.js

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

content/en/kanvas/designer/understanding-edges/images/embedded-design-untitled-design.js

Lines changed: 150 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.13 MB
Loading
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Understanding Edge Styles
3+
description: >
4+
Learn how to use and customize edge styles in Kanvas to create clear and meaningful designs.
5+
weight: 2
6+
categories: [Designer]
7+
tags: [designs]
8+
---
9+
10+
When you connect components in [Kanvas](https://kanvas.new/), the line you draw is called an **edge**. Each edge visually represents a [relationship](https://docs.layer5.io/kanvas/concepts/relationships/) between your components. This guide explains how to use different edge styles to create clear and effective infrastructure designs.
11+
12+
![Examples of changing edge styles in Kanvas](images/style-edge.gif)
13+
14+
## Understanding Edge Types
15+
16+
In Kanvas, there are two main types of edges, each serving a different purpose:
17+
18+
### Semantic Edges: Representing Real Infrastructure
19+
20+
These edges represent real infrastructure relationships that Kanvas can understand and manage. For example:
21+
- Network connections between services
22+
- Volume mounts between containers
23+
- Dependencies between components
24+
25+
What makes semantic edges special is their ability to automatically configure components in real-time as you design. When you draw a semantic edge, Kanvas immediately interprets the relationship and updates the components' configurations - for instance, a TCP connection edge automatically configures port bindings, while a volume mount edge updates container specifications. This real-time configuration makes semantic edges not just visual connectors, but active configuration tools that shape your infrastructure as you build it.
26+
27+
> For detailed information about each relationship type and their configuration effects, visit [Relationships Documentation](https://docs.layer5.io/kanvas/concepts/relationships/)
28+
29+
### Non-semantic Edges: Annotating Your Designs
30+
31+
These are visual aids that help you document and explain your design. They are useful for:
32+
- Adding explanatory notes
33+
- Showing conceptual relationships
34+
- Highlighting important connections
35+
36+
Kanvas ignores these edges during deployment as they are purely for documentation.
37+
38+
## Working with Edge Styles
39+
40+
### Default Styles
41+
42+
To help you quickly understand your designs, Kanvas uses specific default styles for each type of edge:
43+
44+
**For Semantic Edges**:
45+
- Style: Dotted line with an arrowhead
46+
- Color: Grey/Blue
47+
- Use: For all real infrastructure connections
48+
49+
{{< meshery-design-embed src="../understanding-edges/images/embedded-design-untitled-design.js" id="embedded-design-d0a031d0-b4d7-4d60-be17-c4b5d2480ee6" size="half" >}}
50+
51+
**For Non-semantic Edges**:
52+
- Style: Solid line with an arrowhead
53+
- Color: Green
54+
- Use: For all visual annotations and notes
55+
56+
{{< meshery-design-embed src="../understanding-edges/images/embedded-design-edge-annotation-relationship-copy.js" id="embedded-design-daecd14f-6c65-45d9-b74a-4fc536a7868f" size="half" >}}
57+
58+
### Customizing Edge Styles
59+
60+
While the default styles are designed to be clear and consistent, Kanvas gives you the flexibility to customize any edge to better suit your needs. Simply click an edge to reveal the styling toolbar.
61+
62+
#### Choosing a Line Type
63+
- Dashed Line: For proposed or optional connections
64+
- Wave Line: For asynchronous or non-continuous connections
65+
- Zigzag Line: For disrupted or unreliable connections
66+
- Tree Line: For hierarchical relationships (parent-child, system-subsystem)
67+
- Line with Circles: For weak or indirect associations
68+
- Bezier Curve: For non-linear or indirect connections
69+
70+
#### Defining Connection Points
71+
- Arrow Head (Default): Shows general direction or flow
72+
- Filled Diamond: For "whole-part" relationships (aggregation)
73+
- Filled Square: For strong ownership relationships (composition)
74+
- Filled Triangle: For inheritance or "is-a" relationships
75+
- Filled Circle: For loose containment relationships
76+
77+
> **Note**: While Kanvas supports these UML-style relationships, the most commonly used styles are straight lines, dotted lines, and arrow heads. Use other styles when you need to express specific types of relationships in your designs.
78+
79+
#### Using Color for Visual Cues
80+
81+
Colors help you create a visual language in your designs. While Kanvas has default colors, you can use any color to convey meaning:
82+
83+
**Default Colors**
84+
- Green: For non-semantic annotations
85+
- Grey/Blue: For semantic relationships
86+
87+
**Suggested Color Meanings**
88+
- Yellow: For connections that need review
89+
- Red: For issues or breaking changes
90+
91+
#### Adding Labels
92+
93+
You can add text directly to edges to provide more information. This is especially useful for:
94+
- Describing traffic flow (e.g., "User Traffic → API Gateway")
95+
- Adding process steps (e.g., "Requires Manual Review")
96+
- Noting important details (e.g., "Backup Route (Low Priority)")
97+
- Specifying protocols (e.g., "gRPC / 50051")
98+
99+
#### Applying Visual Effects
100+
101+
The "Marching-ants" animation effect can be added to any edge to:
102+
- Highlight specific connections in team reviews
103+
- Emphasize critical paths
104+
105+
{{< alert title="Learn More About Interpreting Designs" type="info" >}}
106+
To learn how to interpret and understand designs in practice, including how components work together in a design, visit our comprehensive guide in the [Layer5 Academy](https://cloud.layer5.io/academy/learning-paths/mastering-meshery/introduction-to-meshery?chapter=interpreting-meshery-designs).
107+
{{< /alert >}}

layouts/shortcodes/meshery-design-embed.html

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
to visualize, explore, and collaborate on service mesh designs.
77
88
-- Usage:
9-
{{/*< meshery-design-embed src="path/to/embed.js" id="unique-id" style="custom-styles" >*/}}
9+
{{/*< meshery-design-embed src="path/to/embed.js" id="unique-id" size="full|half" >*/}}
10+
size: "full" for full-width (default), "half" for half-width display
1011
1112
More Information:
1213
Learn more about embedding Meshery designs at:
@@ -28,10 +29,31 @@
2829
{{ $id := .Get "id" }}
2930

3031
<!--
31-
Retrieve optional custom styles for the embedding container.
32-
If not provided, a default style will be applied to ensure proper rendering.
32+
Retrieve the size for the embedding container.
33+
If not provided, "full" is used as default.
3334
-->
34-
{{ $style := .Get "style" }}
35+
{{ $size := .Get "size" | default "full" }}
36+
37+
<style>
38+
.meshery-embed-container {
39+
border: 1px solid #eee;
40+
border-radius: 4px;
41+
margin: 1rem auto;
42+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
43+
}
44+
.meshery-embed-container.full {
45+
width: 100%;
46+
height: 30rem;
47+
}
48+
.meshery-embed-container.half {
49+
width: 50%;
50+
height: 30rem;
51+
}
52+
.meshery-embed-container .cy-container {
53+
width: 100%;
54+
height: 100%;
55+
}
56+
</style>
3557

3658
<!--
3759
Embedding Container:
@@ -45,11 +67,7 @@
4567
-->
4668
<div
4769
id="{{ $id }}"
48-
{{ if $style }}
49-
style="{{ $style }}"
50-
{{ else }}
51-
style="height: 30rem; width: 100%; border: 1px solid #eee"
52-
{{ end }}
70+
class="meshery-embed-container {{ $size }}"
5371
></div>
5472

5573
<!--

0 commit comments

Comments
 (0)