Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 feature: add cluster icon #1

Merged
merged 2 commits into from
Dec 13, 2023
Merged

🚀 feature: add cluster icon #1

merged 2 commits into from
Dec 13, 2023

Conversation

Anddd7
Copy link
Owner

@Anddd7 Anddd7 commented Dec 13, 2023

Add the icon as part of label in cluster, to visualize the 'VPC' type resources.

Origin PR: mingrammer#853
Others:

Demo:

with Diagram("demo", show=False):
    with Cluster("vpc", icon_node=VPC):
        igw = InternetGateway()
        
        with Cluster("public", icon_node=PublicSubnet):
            nat = NATGateway()
            elb = ElasticLoadBalancing()
        with Cluster("private", icon_node=PrivateSubnet):
            eks = EKS()
        with Cluster("intra", icon_node=PrivateSubnet):
            rds = RDSInstance()

        igw >> elb >> eks >> rds
        eks >> nat >> igw

demo

@Anddd7 Anddd7 changed the title 🚀 feature: redo #853, add cluster icon 🚀 feature: add cluster icon Dec 13, 2023
@Anddd7 Anddd7 merged commit bd27e0d into main Dec 13, 2023
1 check passed
@Anddd7 Anddd7 deleted the feature/add-cluster-icon branch December 13, 2023 09:27
@JobaDiniz
Copy link

JobaDiniz commented Jan 23, 2024

is this in the latest package? I don't see this option on the Cluster.

UPDATE: found it https://github.com/Anddd7/diagrams-ext/releases/tag/0.23.5-alpha3

@JobaDiniz
Copy link

What about using Custom for icons on the Cluster?

@Anddd7
Copy link
Owner Author

Anddd7 commented Jan 24, 2024

is this in the latest package? I don't see this option on the Cluster.

UPDATE: found it https://github.com/Anddd7/diagrams-ext/releases/tag/0.23.5-alpha3

To make it easier to use, i rename it to diagrams-ext and uploaded to pypi, you can download it pip install diagrams-ext.

with Cluster("your-vpc", icon_node=VPC):
  ...

Another way is, I supposed this feature will be merged in upstream oneday🙂, so i don't want to add some customized features here. So i create another repo: https://github.com/Anddd7/diagrams-patterns

I packaged some common component, like private/public subnet, region as cluster, you can check the example https://github.com/Anddd7/diagrams-patterns/blob/main/poc_aws_complex.py

@Anddd7
Copy link
Owner Author

Anddd7 commented Jan 24, 2024

What about using Custom for icons on the Cluster?

I modified to code to accept string path directly, icon_node: Union[Type["Node"], str] = None,


oops, i just tried, url is not working, absolute path can.

 with Cluster("your-vpc", icon_node="/path/to/image.png"):

🔥 got error

 with Cluster("your-vpc", icon_node="https://img.icons8.com/ios-filled/50/share-3.png"):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants