structurizr / dsl

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

Container view for multiple containers at the same time #149

Closed arieltorti closed 2 years ago

arieltorti commented 2 years ago

I have a use case were we can to show to software systems in the container view like so:

I know this is not entirely aligned with the C4 model but it's a use case that I have.

When using container and system landscape views I haven't found a way to make it work, only one of the software systems is expanded, even when listing all containers instead of using include *.

Is there a workaround to make this work ? I was checking custom views but I haven't found much information about them.

Example DSL:

workspace {

    !identifiers hierarchical

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

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

        A.app -> B.app
    }

    views {
        container A {
            include *
            autolayout
        }

        theme default
    }
}

Actual result:

image

Expected result: image

simonbrowndotje commented 2 years ago

even when listing all containers instead of using include *

That should work, for example:

        container A {
            include A.app A.db B.app B.db
        }
arieltorti commented 2 years ago

Ahhh I see, I was also including the software systems:

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

Which resulted in: image

On a separate note, is there a way to show relations between software systems in container views ? Take the same example and add a new relation A -> B, when using the container view it's not displayed:

image

Generated from:

workspace {

    !identifiers hierarchical

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

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

        A -> B
    }

    views {
        container A {
            include A.app A.db B.app B.db
        }
    }
}
simonbrowndotje commented 2 years ago

On a separate note, is there a way to show relations between software systems in container views

No, it's the containers that are the focus of the diagram.

arieltorti commented 2 years ago

Is the ordering in the include statement important ?

When switching the order of the elements I get different diagrams:

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

Renders: image

But when the software systems are at the beginning:

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

It renders: image

Is that intended ?

simonbrowndotje commented 2 years ago

Is that intended ?

Yes.

arieltorti commented 2 years ago

Could we add that to the language reference documentation ?

Explain that ordering matters and how it impacts rendering ?