yuzutech / kroki

Creates diagrams from textual descriptions!

Home Page:https://kroki.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Structurizr: "filtered" view is not supported

mgzob opened this issue · comments

The view option in Structurizr results in a 400 error when using the filtered directive in the view fields.

Context:

Structurizr has an option to filter your view to a subset of tags within a workspace. This should function with the current packaged schedulizr version, there are references to this feature back in early '21 - Ref: structurizr/dsl#35

Error:
image

Replication steps:

Execute Kroki with the below Structurizr workspace. This workspace is found in the Structurizr DSL cookbook found here: https://docs.structurizr.com/dsl/cookbook/filtered-view/ .

workspace {

    model {
        a = softwareSystem "A" {
            tags "Tag 1"
        }
        b = softwareSystem "B" {
            tags "Tag 2"
        }
        c = softwareSystem "C" {
            tags "Tag 3"
        }
        
        a -> b
        b -> c
    }
    
    views {
        systemLandscape "landscape" {
            include *
            autolayout lr
        }
        
        filtered "landscape" include "Tag 1,Tag 2,Relationship" "landscape1"
        filtered "landscape" exclude "Tag 1" "landscape2"
    }
        
}

See kroki.io error at url:

https://kroki.io/structurizr/svg/eNp9kcEOgjAMhu97imZHowf1rIl69aS-QBlFFycjbIjE8O4iihYz_A9Lu3Vf_3Wlzc8uQ0VwFwIaXWxMpkngLYQFOJv4EnPaV87TBeRKsoKnPB4dyAMeYSo_B_UnigKM9TBjFmKoAGMzzJiHGOxRkyVEzF-TKvEtbperptKxBq7tusU0dgozAmm68NeGTpUpYoJRbxcLbw1WtvBg8n_uEm085RT3OnTM15TH7ZzGOzLotU3dSWeSlbNfCMLoxmH85nv2zFUtxAPXfYgA

Expected Behavior:

The view should filter and allow you to select a view. Using the view-key option, you can select the "landscape" view without issue. Selecting "landscape1" or "landscape2" does not result in issues.

Using the above snippet at https://www.structurizr.com/dsl produces the expected output. This output can also be visualized in the cookbook link provided above.

This is as expected. Filtered views are designed to work with manual layout (i.e. the Structurizr browser-based diagram renderer ... this is why it works on the demo page you linked to), where multiple filtered views can share that same layout information, hiding/showing elements/relationships as appropriate. For this reason, filtered views are not supported by any of the automatic layout only export formats (e.g. PlantUML and Mermaid), but you can achieve a similar result using DSL expressions (e.g. include element.tag==Tag 1, include relationship.tag==Tag 2, etc) in your view definition.

Thank you for the clear explanation!

In my perspective that is what the view key would help with, from your implementation several moons ago. It feels non-intuitive as that linked location is also running the DSL view. I'd expect behavior parity with the ability to select between those view-key options. I may be missing technical depth there as I don't know where that shared-layout-information lives.

That said, I'd seen but not fully leveraged the include expressions. That completely solves my question and confusion. Thanks again! I'll close this out.