Skip to content

Commit

Permalink
feat: update colors to support hide_id for nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsypuk committed Jan 12, 2024
1 parent f5842b1 commit 358e853
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/docs/core-components/colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,20 @@ When specifying ``gradient fill`` it is mandatory to set 3 style params:
{: .no_toc }

![layers](output/jpg/color_table.jpg)

## Hiding NODE ID information when rendering

{: .highlight }
Extra parameter, **hide_id = true** allows to render only node name avoiding any additional information.

## Code Snippet:
{: .no_toc }

```python
{% root_include_snippet ../tests/core/test_colors.py no_id%}
```

## Rendering
{: .no_toc }

![layers](output/jpg/color_no_id.jpg)
13 changes: 13 additions & 0 deletions docs/docs/core-components/output/drawio/color_no_id.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<mxfile host="multicloud-diagrams" agent="PIP package multicloud-diagrams. Generate resources in draw.io compatible format for Cloud infrastructure. Copyrights @ Roman Tsypuk 2023. MIT license." type="MultiCloud">
<diagram id="diagram_1" name="AWS components">
<mxGraphModel dx="1015" dy="661" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="vertex:sns:arn:aws:sns:eu-west-1:123456789012:internal.fifo" value="&lt;b&gt;Name&lt;/b&gt;: internal.fifo" style="sketch=0;outlineConnect=0;fontColor=#232F3E;gradientColor=#FF4F8B;gradientDirection=north;fillColor=#BC1356;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.sns;" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions tests/core/test_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,23 @@ def test_color_table(self):
# then
# docs
self.mcd = mcd

def test_no_id(self):
# docs
self.node_type = 'color_no_id'

# given
mcd = MultiCloudDiagrams()

# when
sns_arn = 'arn:aws:sns:eu-west-1:123456789012:internal.fifo'
metadata = {
"Owner": 123456789012,
"SubscriptionsConfirmed": 3,
"SubscriptionsPending": 0
}
mcd.add_vertex(node_id=sns_arn, node_name='internal.fifo', node_type='sns', metadata=metadata, hide_id=True)

# then
# docs
self.mcd = mcd

0 comments on commit 358e853

Please sign in to comment.