structurizr / dsl

Structurizr DSL
https://docs.structurizr.com/dsl
Apache License 2.0
1.41k stars 266 forks source link

Container view with multiple SoftwareSystems #210

Closed Matthewsre closed 1 year ago

Matthewsre commented 1 year ago

I ran into the same problem as this issue: https://github.com/structurizr/dsl/issues/149

I need a container view that shows the details of the related containers in multiple SoftwareSystems in the same view

In my scenario there are many more software systems and I essentially just want a view that includes the all containers and their relations in the specified softwareSystems instead of just 1 at a time.

workspace {

    !identifiers hierarchical

    model {
        A = softwaresystem "A" {
            app = container "app"
            db = container "db"
        }

        B = softwaresystem "B" {
            app = container "app"
            db = container "db"
        }

        C = softwaresystem "C" {
            app = container "app"
            db = container "db"
        }

        A.app -> B.app
        A.app -> C.app
        A.app -> A.db
        B.app -> B.db
        B.app -> C.app
        C.app -> C.db
    }

    views {
        container A {
            include * 
        }
        container B {
            include * 
        }
        container C {
            include *
        }

        container A {
            include A.app A.db B.app B.db C.app C.db 
        }
    }
}

It looks like could get this to work by adding every single container and the relations between containers. Although I could do this, I don't want to have to remember to add new containers and relationships to a view whenever they are added or shift to using something to generate the DSL for me with this view.

What I would like to be able to do is something like one of the following:

    # Option 1
    views {
        container A,B,C {
            include *
        }
    }

    # Option 2
    views {
        container {
            include A.* B.* C.* 
        }
    }

    # Option 3
    views {
        container {
            include A B C 
        }
    }

I'm also completely open to solving this through other options I might not be aware of. For example if there was a way to create a custom view filtered to all containers and relations of specified software systems. Ideally that would also include the items at the other end of the relation outside of the software system (either viewed as container or softwareSystem at the other end).

simonbrowndotje commented 1 year ago

Have you looked at the expression support?

Matthewsre commented 1 year ago

Have you looked at the expression support?

Thanks, that looks to be exactly what I was after! :)

I am noticing some layout issues where SoftwareSystems boundaries are overlapping and the autolayout is making it appear that the containers from different softwareSystems are are rendering inside other softwareSystems. Is there any type of setting to prevent the overlap and/or expand the canvas to support rendering without the overlap?

simonbrowndotje commented 1 year ago

I am noticing some layout issues where SoftwareSystems boundaries are overlapping and the autolayout is making it appear that the containers from different softwareSystems are are rendering inside other softwareSystems. Is there any type of setting to prevent the overlap and/or expand the canvas to support rendering without the overlap?

It will depend on which product/build you're using (Lite/on-premises/cloud) and which auto-layout algorithm you're using. Feel free to open a new issue with a DSL definition that doesn't work for you.