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

Add custom stereotypes #51

Closed
Riduidel opened this issue Mar 18, 2020 · 3 comments · Fixed by #107
Closed

Add custom stereotypes #51

Riduidel opened this issue Mar 18, 2020 · 3 comments · Fixed by #107
Milestone

Comments

@Riduidel
Copy link

I would like to add custom stereotypes to Container(...) but the current syntax don't allow that.

My precise use case is two-fold : I have deployment diagrams built with Structurizr-plantuml and I would like to highlight

  1. Containers defined in architecture diagram but not deployed (<missing> containers)
  2. Container version (and the match of this version with the one defined in architecture)

How can I do that if I can't put a stereotype and have a custom rendering done with skinParam ?

@stale
Copy link

stale bot commented Nov 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 22, 2020
@adrianvlupu
Copy link
Member

Hi,

You can create your own stereotypes outside of C4-PlantUML

@startuml
!include https://raw.githubusercontent.com/adrianvlupu/C4-PlantUML/latest/C4_Container.puml

skinparam rectangle<<missing_container>> {
    StereotypeFontColor $ELEMENT_FONT_COLOR
    FontColor $ELEMENT_FONT_COLOR
    BackgroundColor $CONTAINER_BG_COLOR
    BorderColor $CONTAINER_BORDER_COLOR
}
!unquoted procedure Missing($alias, $label, $techn, $descr="", $sprite="")
rectangle "$getContainer($label, $techn, $descr, $sprite)" <<missing_container>> as $alias
!endprocedure


Missing(missing_app, "Web APplication", "C#", "Description text")
Container(web_app, "Web Application", "Java, Spring MVC", "Delivers the static content and the Internet banking SPA")
@enduml

C4_Container Diagram Sample - bigbankplc

@stale stale bot removed the wontfix This will not be worked on label Nov 28, 2020
kirchsth added a commit to kirchsth/C4-PlantUML that referenced this issue Jan 2, 2021
…om tags/stereotypes support; dynamic legend supports custom colors, border and shadow; dynamic legend displays (only) used elements, tags/stereotypes.

New added macros: SHOW_DYNAMIC_LEGEND(), AddTagSupport(), UpdateSkinparamsAndLegendEntry(), elements macros are extended with $tags="..."
kirchsth added a commit to kirchsth/C4-PlantUML that referenced this issue Jan 2, 2021
…om tags/stereotypes support; ... (2 - update macros docu with added $tags="...")
@kirchsth
Copy link
Contributor

kirchsth commented Jan 2, 2021

@Riduidel: I think my PR #107 should solve your requirements. You could check it via my local branch https://github.com/kirchsth/C4-PlantUML.
E.g.
Entities can be decorated with tags and explained via dynamic calculated legends, for example:

@startuml
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml

AddTagSupport("v1.0", $borderColor="#d73027")
AddTagSupport("v1.1", $fontColor="#d73027")

Person(user, "Customer", "People that need products")
Person(admin, "Administrator", "People that administrates the products via the new v1.1 components", $tags="v1.1")
Container(spa, "SPA", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0")
Container(spaAdmin, "Admin SPA", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="v1.1")
Container(api, "API", "java", "Handles all business logic (incl. new v1.1 extensions)", $tags="v1.0+v1.1")
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information")

Rel(user, spa, "Uses", "https")
Rel(spa, api, "Uses", "https")
Rel_R(api, db, "Reads/Writes")
Rel(admin, spaAdmin, "Uses", "https")
Rel(spaAdmin, api, "Uses", "https")

SHOW_DYNAMIC_LEGEND()
@enduml

tags

Best regards
Helmut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
4 participants