Code Monkey home page Code Monkey logo

Comments (4)

kirchsth avatar kirchsth commented on August 9, 2024 1

Hi @dirkgroot

yes, it works without UpdateElementStyle() too (maybe an export option could be useful)

(but if you want the same structurizr colors, ... then you can use it;
and if you use additional styles/tags in DSL you get automatically matching colors too)

BR Helmut

from export.

kirchsth avatar kirchsth commented on August 9, 2024

Possible solutions:

in plantuml-stdlib/C4-PlantUML#228 I found following problems

  1. update/creates of the required tag definitions (based on the styles) in C4-PlantUML is missing.
  2. add the tags in reverse order that the most detailed is the first one:
    first tag has the highest priority (e.g. if 2 styles/tags define a background color the first wins)
  3. mark "External_xxx" with new "External_xxx" tags

Maybe additional changes could be done (or in another PR?):

  1. activate SHOW_PERSON_OUTLINE()
    4a. and if description of the person is empty add \n\n or <25 char add \n to it that the y-dimension of the shape is higher. If required I could add the \n support in C4-PlantUML itself)

It could be that https://github.com/cloudflightio/structurizr-export-c4plantuml solves most of the problems already and only the PR has to be completed. @klu2: can you please check my assumption?

e.g. with all changes based on following DSL

workspace {
    model {
        enterprise "Customer" {
            dwh_user = person "DWH User" "User of some DWH" "Internal user"
            dwh_developer = person "DWH Developer" "Developer of some DWH" 
        }

        dhw_user = person "DHW User" "User of DataHandwerk Toolkit" "External user"
        // "External_Person" is only used as workaround atm
        dhw_developer = person "DHW Developer" "Developer of DataHandwerk Toolkit" "External_Person"       
    }
    views {
        systemlandscape "SystemLandscape" {
             include *
             autoLayout
        }
        styles {
            element "Person" {
                shape Person
                background #2222CC
            }
            element "External_Person" {
                shape Person
                background #FFCCCC
            }            
            element "Internal user" {
                shape Person
                background #4444FF
            }
            element "External user" {
                shape Person
                background #FF4444
            }            
        }
    }
}

with the new rules the generator would create something like

@startuml
title System Landscape for Customer

top to bottom direction

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml

' additional changes: 4. activate person outline
SHOW_PERSON_OUTLINE()

' additional changes: 1. update existing tags/styles if required
UpdateElementStyle("person", #2222CC, $ELEMENT_FONT_COLOR)
' additional changes: if SHOW_PERSON_OUTLINE() is not used, structurizr sprite could be used too
UpdateElementStyle("external_person", #FFCCCC, $ELEMENT_FONT_COLOR, $sprite="person2")
' additional changes: 1. create new tags/styles if required
AddElementTag("Internal user", "#4444FF", $ELEMENT_FONT_COLOR)
AddElementTag("External user", "#FF4444", $ELEMENT_FONT_COLOR, $sprite="person2")

Enterprise_Boundary(enterprise, "Customer") {
  ' additional changes: 2. invert tag order that most detailed tag wins
  ' additional changes: (as workaround) 4a. add \n
  Person(DWHUser, "DWH User", "Userof some DWH\n", $tags="Internal user+Person+Element")
  Person(DWHDeveloper, "DWH Developer", "Developer of some DWH\n", $tags="Person+Element")
}

' additional changes: 2. invert tag order that most detailed tag wins
' additional changes: 3. use External_Person instead of Person
Person_Ext(DHWDeveloper, "DHW Developer", "Developer of DataHandwerk Toolkit", $tags="External_Person+Element")
Person_Ext(DHWUser, "DHW User", "User of DataHandwerk Toolkit", $tags="External user+External_Person+Element")

SHOW_LEGEND()
@enduml

@simonbrowndotje: can you accept klu2 PR if everything is working?

Thank you and best regards
Helmut

from export.

dirkgroot avatar dirkgroot commented on August 9, 2024

I've been fiddling around with this, and the simplest fixes seem to be to just prefix the $tags for a person with External_Person, or to not use the tags at all and rely on C4-PlantUML defaults.

@kirchsth Customisation using UpdateElementStyle and/or the usage of tags is not necessary if you just want to use the default styling provided by C4-PlantUML, right?

@simonbrowndotje I'm curious: Could you clarify what your purpose is with putting Structurizr tags in the PlantUML files?

from export.

simonbrowndotje avatar simonbrowndotje commented on August 9, 2024

I'm curious: Could you clarify what your purpose is with putting Structurizr tags in the PlantUML files?

It was a response to this issue -> structurizr/java-extensions#51

from export.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.