From cdc860205125f97705087cd47848df1ffcd5db7e Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Sun, 14 Mar 2021 16:26:35 +0100 Subject: [PATCH 1/2] #126: C4 relationships support description, sprite/openIconic and tags (6 - fix PR findings: remove obsolete code, update comments and use https urls) --- C4.puml | 18 +++++++++--------- README.md | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4.puml b/C4.puml index 6c55aa5..e84f622 100644 --- a/C4.puml +++ b/C4.puml @@ -213,17 +213,10 @@ $elementSkin !function $tagRelLegendEntry($tagStereo, $textColor, $lineColor) !$tagEntry = "|" - !$bg = $LEGEND_UNDEFINED_BG_COLOR - ' named colors have to start with # too - !if (%substr($bg, 0, 1) != "#") - !$bg = "#" + $bg - !endif -' !$tagEntry = $tagEntry + "<" + $bg +">" ' ..white line !if ($lineColor!="") !$tagEntry = $tagEntry + " " !else -' !$tagEntry = $tagEntry + " " !$tagEntry = $tagEntry + " " !endif !if ($textColor!="") @@ -244,7 +237,9 @@ $elementSkin !endfunction !unquoted procedure $addTagToLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="") -'' ignore workaround tags with & +'' if a combined element tag is defined (e.g. "v1.0&v1.1") then it is typically a merged color, +'' like a new $fontColor="#fdae61" therefore it should be added to the legend +'' and the & combined tags will be not removed ' !if (%strpos($tagStereo, "&")<0) !$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing) %set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry) @@ -253,7 +248,12 @@ $elementSkin !endprocedure !unquoted procedure $addRelTagToLegend($tagStereo, $textColor="", $lineColor="") -'' ignore workaround tags with & +'' Arrows have a bug with stereotype/skinparams and cannot combine text colors of one stereotype +'' and the line color of another stereotype. Therefore the text color of one tag and the line color +'' of another tag have to be combined via a "workaround" tag ("v1.0&v1.1"). +'' This workaround tag could be theoretically removed in the legend but after that there would +'' be an inconsistency between the element tags and the rel tags and therefore +'' & combined workaround tags are not removed too (and in unlikely cases the color itself could be changed) ' !if (%strpos($tagStereo, "&")<0) !$tagEntry = $tagRelLegendEntry($tagStereo, $textColor, $lineColor) %set_variable_value("$" + $tagStereo + "_LineLegendEntry", $tagEntry) diff --git a/README.md b/README.md index a4692cd..e4909d0 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ If you want to use the always up-to-date version in this repo, use the following Now let's create a C4 Container diagram: -\(If you don't want run PlantUML locally you can use e.g. the [PlantUML Web Server](http://www.plantuml.com/plantuml/uml/ZOxDIWGn48JlUOeufn5qSjcJfvNHsugBFsV99iqcsEc4T0VTjpSCE2AYUAeAgVwgjYosIakevytBBK824bPdaHms3pg85BuofjgtwHWbj4DZg2wJzDpaSZAliRh04ioykToZ9Nc-snbux_yUlEdGkOTj9AXJwJLAxQ5ofh4iSetHyeKUTlO0E7HpNoHcigXlW5sDosiuLojaT9_kn-aJk40Py_7q1-Znn09fv4N-swuU0ByFNbVyZlYQqmbR8DyIVW00) too.) +\(If you don't want run PlantUML locally you can use e.g. the [PlantUML Web Server](https://www.plantuml.com/plantuml/uml/ZOxDIWGn48JlUOeufn5qSjcJfvNHsugBFsV99iqcsEc4T0VTjpSCE2AYUAeAgVwgjYosIakevytBBK824bPdaHms3pg85BuofjgtwHWbj4DZg2wJzDpaSZAliRh04ioykToZ9Nc-snbux_yUlEdGkOTj9AXJwJLAxQ5ofh4iSetHyeKUTlO0E7HpNoHcigXlW5sDosiuLojaT9_kn-aJk40Py_7q1-Znn09fv4N-swuU0ByFNbVyZlYQqmbR8DyIVW00) too.) After you have included `C4_Container.puml` you can use the defined macro definitions for the C4 elements: `Person`, `Person_Ext`, `System`, `System_Ext`, `Container`, `Relationship`, `Boundary`, and `System_Boundary` @@ -488,7 +488,7 @@ Images can be generated in PNG, in SVG or in LaTeX format. PlantUML was created to allow the drawing of UML diagrams, using a simple and human readable text description. Because it does not prevent you from drawing inconsistent diagrams, it is a drawing tool and not a modeling tool. -It is the most used text-based diagram drawing tool with [extensive support into wikis and forums, text editors and IDEs, use by different programming languages and documentation generators](https://en.plantuml.com/running). +It is the most used text-based diagram drawing tool with [extensive support into wikis and forums, text editors and IDEs, use by different programming languages and documentation generators](https://plantuml.com/running). The [C4 model](https://c4model.com/) for software architecture is an "abstraction-first" approach to diagramming, based upon abstractions that reflect how software architects and developers think about and build software. The small set of abstractions and diagram types makes the C4 model easy to learn and use. From f3639ab59f078bed3eb1b755ac2e7980fc347807 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Sun, 14 Mar 2021 16:31:26 +0100 Subject: [PATCH 2/2] #126: C4 relationships support description, sprite/openIconic and tags (6a - fix PR finding: all files should end with empty line) --- C4.puml | 2 +- C4_Component.puml | 2 +- percy/C4_Container Diagram Sample - bigbankplc-icons.puml | 2 +- percy/C4_Container Diagram Sample - bigbankplc.puml | 2 +- percy/C4_Container Diagram Sample - message bus.puml | 2 +- percy/C4_Container Diagram Sample - techtribesjs.puml | 2 +- percy/C4_Context Diagram Sample - enterprise.puml | 2 +- percy/C4_Deployment Diagram Sample - bigbankplc-details.puml | 2 +- percy/C4_Deployment Diagram Sample - bigbankplc.puml | 2 +- percy/C4_Dynamic Diagram Sample - bigbankplc.puml | 2 +- percy/TestLegend.puml | 2 +- percy/TestRelations.puml | 2 +- percy/TestRelationsDynamic.puml | 2 +- samples/C4_Container Diagram Sample - bigbankplc-icons.puml | 2 +- samples/C4_Container Diagram Sample - message bus.puml | 2 +- samples/C4_Container Diagram Sample - techtribesjs.puml | 2 +- samples/C4_Context Diagram Sample - enterprise.puml | 2 +- samples/C4_Deployment Diagram Sample - bigbankplc-details.puml | 2 +- samples/C4_Deployment Diagram Sample - bigbankplc.puml | 2 +- samples/C4_Dynamic Diagram Sample - bigbankplc.puml | 2 +- .../C4_Dynamic Diagram Sample - message bus - old format.puml | 2 +- samples/C4_Dynamic Diagram Sample - message bus.puml | 3 ++- 22 files changed, 23 insertions(+), 22 deletions(-) diff --git a/C4.puml b/C4.puml index e84f622..0564fe8 100644 --- a/C4.puml +++ b/C4.puml @@ -629,4 +629,4 @@ $from -[hidden]R- $to !endprocedure !unquoted procedure Lay_L($from, $to) $from -[hidden]L- $to -!endprocedure \ No newline at end of file +!endprocedure diff --git a/C4_Component.puml b/C4_Component.puml index 2ca30e7..5eeb434 100644 --- a/C4_Component.puml +++ b/C4_Component.puml @@ -86,4 +86,4 @@ database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos( !unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="") queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias -!endprocedure \ No newline at end of file +!endprocedure diff --git a/percy/C4_Container Diagram Sample - bigbankplc-icons.puml b/percy/C4_Container Diagram Sample - bigbankplc-icons.puml index 3e91f36..e41af32 100644 --- a/percy/C4_Container Diagram Sample - bigbankplc-icons.puml +++ b/percy/C4_Container Diagram Sample - bigbankplc-icons.puml @@ -48,4 +48,4 @@ Rel_Back_Neighbor(database, backend_api, "Reads from and writes to", "sync, JDBC Rel_Back(customer, email_system, "Sends e-mails to") Rel_Back(email_system, backend_api, "Sends e-mails using", "sync, SMTP") Rel_Neighbor(backend_api, banking_system, "Uses", "sync/async, XML/HTTPS") -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Container Diagram Sample - bigbankplc.puml b/percy/C4_Container Diagram Sample - bigbankplc.puml index f3cc79a..3857753 100644 --- a/percy/C4_Container Diagram Sample - bigbankplc.puml +++ b/percy/C4_Container Diagram Sample - bigbankplc.puml @@ -37,4 +37,4 @@ Rel_Back_Neighbor(database, backend_api, "Reads from and writes to", "sync, JDBC Rel_Back(customer, email_system, "Sends e-mails to") Rel_Back(email_system, backend_api, "Sends e-mails using", "sync, SMTP") Rel_Neighbor(backend_api, banking_system, "Uses", "sync/async, XML/HTTPS") -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Container Diagram Sample - message bus.puml b/percy/C4_Container Diagram Sample - message bus.puml index cc49d85..7112c7f 100644 --- a/percy/C4_Container Diagram Sample - message bus.puml +++ b/percy/C4_Container Diagram Sample - message bus.puml @@ -51,4 +51,4 @@ Rel(audit_service, audit_store, "Stores events in") Lay_R(reporting_service, audit_service) -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Container Diagram Sample - techtribesjs.puml b/percy/C4_Container Diagram Sample - techtribesjs.puml index 6cf8105..9b5d4ff 100644 --- a/percy/C4_Container Diagram Sample - techtribesjs.puml +++ b/percy/C4_Container Diagram Sample - techtribesjs.puml @@ -50,4 +50,4 @@ Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP") Lay_R(rel_db, filesystem) -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Context Diagram Sample - enterprise.puml b/percy/C4_Context Diagram Sample - enterprise.puml index 034b7ec..ed51d3a 100644 --- a/percy/C4_Context Diagram Sample - enterprise.puml +++ b/percy/C4_Context Diagram Sample - enterprise.puml @@ -42,4 +42,4 @@ Rel_L(taxamo, braintree, "Uses for credit card processing") Lay_D(customer, braintree) -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Deployment Diagram Sample - bigbankplc-details.puml b/percy/C4_Deployment Diagram Sample - bigbankplc-details.puml index 76d135b..b09d4ea 100644 --- a/percy/C4_Deployment Diagram Sample - bigbankplc-details.puml +++ b/percy/C4_Deployment Diagram Sample - bigbankplc-details.puml @@ -67,4 +67,4 @@ Rel(api, db2, "Reads from and writes to", "JDBC", $tags="fallback") Rel_R(db, db2, "Replicates data to") SHOW_LEGEND() -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Deployment Diagram Sample - bigbankplc.puml b/percy/C4_Deployment Diagram Sample - bigbankplc.puml index cac0187..861531a 100644 --- a/percy/C4_Deployment Diagram Sample - bigbankplc.puml +++ b/percy/C4_Deployment Diagram Sample - bigbankplc.puml @@ -55,4 +55,4 @@ Rel(api, db2, "Reads from and writes to", "JDBC", $tags="fallback") Rel_R(db, db2, "Replicates data to") SHOW_LEGEND() -@enduml \ No newline at end of file +@enduml diff --git a/percy/C4_Dynamic Diagram Sample - bigbankplc.puml b/percy/C4_Dynamic Diagram Sample - bigbankplc.puml index 207e4ec..be5676e 100644 --- a/percy/C4_Dynamic Diagram Sample - bigbankplc.puml +++ b/percy/C4_Dynamic Diagram Sample - bigbankplc.puml @@ -17,4 +17,4 @@ Container_Boundary(b, "API Application") { Rel_R(c1, c2, "Submits credentials to", "JSON/HTTPS") Rel(c2, c3, "Calls isAuthenticated() on") Rel_R(c3, c4, "select * from users where username = ?", "JDBC") -@enduml \ No newline at end of file +@enduml diff --git a/percy/TestLegend.puml b/percy/TestLegend.puml index 5a6a2db..fe740cd 100644 --- a/percy/TestLegend.puml +++ b/percy/TestLegend.puml @@ -49,4 +49,4 @@ Rel(allInOne, system2, "line 3+4 cannot be combined without workaround", $tags=" Rel(allInOne, system2, "line 3+4 with workaround", $tags="line3&line4+line3+line4") SHOW_LEGEND(false) -@enduml \ No newline at end of file +@enduml diff --git a/percy/TestRelations.puml b/percy/TestRelations.puml index fc28ea8..df032ba 100644 --- a/percy/TestRelations.puml +++ b/percy/TestRelations.puml @@ -69,4 +69,4 @@ Lay_D(RelFrom, RelShort) Lay_D(RelShort, RelLong) Lay_R(RelLong, BiRelShort) Lay_L(RelLong, BiRelLong) -@enduml \ No newline at end of file +@enduml diff --git a/percy/TestRelationsDynamic.puml b/percy/TestRelationsDynamic.puml index 45e01d7..762493b 100644 --- a/percy/TestRelationsDynamic.puml +++ b/percy/TestRelationsDynamic.puml @@ -68,4 +68,4 @@ Lay_D(RelFrom, RelShort) Lay_D(RelShort, RelLong) Lay_R(RelLong, RelIndexShort) Lay_L(RelLong, RelIndexLong) -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Container Diagram Sample - bigbankplc-icons.puml b/samples/C4_Container Diagram Sample - bigbankplc-icons.puml index e2fdc07..95d0dc8 100644 --- a/samples/C4_Container Diagram Sample - bigbankplc-icons.puml +++ b/samples/C4_Container Diagram Sample - bigbankplc-icons.puml @@ -42,4 +42,4 @@ Rel_Back_Neighbor(database, backend_api, "Reads from and writes to", "sync, JDBC Rel_Back(customer, email_system, "Sends e-mails to") Rel_Back(email_system, backend_api, "Sends e-mails using", "sync, SMTP") Rel_Neighbor(backend_api, banking_system, "Uses", "sync/async, XML/HTTPS") -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Container Diagram Sample - message bus.puml b/samples/C4_Container Diagram Sample - message bus.puml index 5318f45..9d0ce2a 100644 --- a/samples/C4_Container Diagram Sample - message bus.puml +++ b/samples/C4_Container Diagram Sample - message bus.puml @@ -48,4 +48,4 @@ Rel(audit_service, audit_store, "Stores events in") Lay_R(reporting_service, audit_service) -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Container Diagram Sample - techtribesjs.puml b/samples/C4_Container Diagram Sample - techtribesjs.puml index fcbc60a..1b6b058 100644 --- a/samples/C4_Container Diagram Sample - techtribesjs.puml +++ b/samples/C4_Container Diagram Sample - techtribesjs.puml @@ -48,4 +48,4 @@ Rel(updater, blogs, "Gets content using RSS and Atom feeds from", "HTTP") Lay_R(rel_db, filesystem) -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Context Diagram Sample - enterprise.puml b/samples/C4_Context Diagram Sample - enterprise.puml index 629bacd..22db5ca 100644 --- a/samples/C4_Context Diagram Sample - enterprise.puml +++ b/samples/C4_Context Diagram Sample - enterprise.puml @@ -39,4 +39,4 @@ Rel_L(taxamo, braintree, "Uses for credit card processing") Lay_D(customer, braintree) -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Deployment Diagram Sample - bigbankplc-details.puml b/samples/C4_Deployment Diagram Sample - bigbankplc-details.puml index 5ca247a..5c6edb0 100644 --- a/samples/C4_Deployment Diagram Sample - bigbankplc-details.puml +++ b/samples/C4_Deployment Diagram Sample - bigbankplc-details.puml @@ -64,4 +64,4 @@ Rel(api, db2, "Reads from and writes to", "JDBC", $tags="fallback") Rel_R(db, db2, "Replicates data to") SHOW_LEGEND() -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Deployment Diagram Sample - bigbankplc.puml b/samples/C4_Deployment Diagram Sample - bigbankplc.puml index 6f04971..47c946d 100644 --- a/samples/C4_Deployment Diagram Sample - bigbankplc.puml +++ b/samples/C4_Deployment Diagram Sample - bigbankplc.puml @@ -52,4 +52,4 @@ Rel(api, db2, "Reads from and writes to", "JDBC", $tags="fallback") Rel_R(db, db2, "Replicates data to") SHOW_LEGEND() -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Dynamic Diagram Sample - bigbankplc.puml b/samples/C4_Dynamic Diagram Sample - bigbankplc.puml index 4fbaafc..0f5caf2 100644 --- a/samples/C4_Dynamic Diagram Sample - bigbankplc.puml +++ b/samples/C4_Dynamic Diagram Sample - bigbankplc.puml @@ -12,4 +12,4 @@ Container_Boundary(b, "API Application") { Rel_R(c1, c2, "Submits credentials to", "JSON/HTTPS") Rel(c2, c3, "Calls isAuthenticated() on") Rel_R(c3, c4, "select * from users where username = ?", "JDBC") -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Dynamic Diagram Sample - message bus - old format.puml b/samples/C4_Dynamic Diagram Sample - message bus - old format.puml index 9d9b99f..4f4fd86 100644 --- a/samples/C4_Dynamic Diagram Sample - message bus - old format.puml +++ b/samples/C4_Dynamic Diagram Sample - message bus - old format.puml @@ -32,4 +32,4 @@ setIndex(5) RelIndex_R($index-2, message_bus, audit_service, "Sends customer update events to", "async") increment() RelIndex($index-2, audit_service, audit_store, "Stores events in") -@enduml \ No newline at end of file +@enduml diff --git a/samples/C4_Dynamic Diagram Sample - message bus.puml b/samples/C4_Dynamic Diagram Sample - message bus.puml index c38341e..5d88d67 100644 --- a/samples/C4_Dynamic Diagram Sample - message bus.puml +++ b/samples/C4_Dynamic Diagram Sample - message bus.puml @@ -1,3 +1,4 @@ + @startuml !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml @@ -28,4 +29,4 @@ RelIndex(Index()-1, reporting_service, reporting_db, "Stores data in") RelIndex_R(SetIndex(5)-2, message_bus, audit_service, "Sends customer update events to", "async") RelIndex(Index()-2, audit_service, audit_store, "Stores events in") -@enduml \ No newline at end of file +@enduml