structurizr / dsl

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

Remove container border #119

Closed jeffabailey closed 2 years ago

jeffabailey commented 2 years ago

I've dug around quite a bit, but it appears Structurizr won't allow us to remove a container border. Is that true?

https://structurizr.com/dsl

https://github.com/structurizr/dsl/blob/master/docs/language-reference.md#styles

I might be using the DSL wrong, but I'm trying to share components between views, so I want to remove the border for that purpose.

If there's a better way, I'm all ears.

simonbrowndotje commented 2 years ago

I'm not quite sure what you mean by "remove a container border" ... can you elaborate, perhaps with an example of what you're trying to achieve?

jeffabailey commented 2 years ago

Sure thing, I'm looking to set the border length to zero on this dotted line represented by this code.

        3Dto2DRenderer = softwareSystem "3D to 2D Renderer" "" "customization,tools3d,solution" {
            3Dto2DRenderingSolutionHubble = container "3D to 2D Rendering Solution (Hubble)" "" "" "Customization,Customization Tools and 3D,Solution" {
                GPUOptimizedInstances = component "GPU Optimized Instances" "Either G4dn (NVIDIA), g5 (NVIDIA), G4ad (AMD) instances. - Amazon has stated that the G5 instance is cheaper with better performance." "" "Customization,Customization Tools and 3D,Vendor,AWS" 
                ...more code...
image
simonbrowndotje commented 2 years ago

I'm guessing this is a component diagram for the "3D to 2D Rendering Solution (Hubble)" container ... so that dark dotted line represents the container boundary, and cannot be removed. It's possible to remove the light grey dotted line, but that doesn't seem to be what you're asking, as I don't see it represented in the code fragment you posted.

jeffabailey commented 2 years ago

Thanks for confirming that it's not possible to remove the border.

I haven't seen an example of model reuse that works for my use case.

Can we scope relationships so they only show up in specific views?

I'm looking at this issue, which is an interesting example of includes, but it's not meeting my use case. My use case may not exist based on Structrizr's current design.

Please bear with me, as I still have a limited understanding of the Structurizr DSL and the C4 Model.

To describe what I'm looking for as simple as I can, here is some code:

workspace "Reuse model with different relationships?" "Incorrectly Demonstrate Model Reuse, is something like this possible?" {

    model {
        customer = person "Customer" "Customer" "Customer"
        website = softwareSystem "Website" "Website" "Website"

        system1 = softwareSystem "system1" "" "" {
            customer -> website "Relationship scoped to system1"  
        }

        system2 = softwareSystem "system2" "" ""  {
            website -> customer "Relationship scoped to system2"
        }
    }

    views {
        systemContext system1 {
            include customer
            include website
            autoLayout
        }

        systemContext system2 {
            include customer
            include website
            autoLayout
        }
    }
}

As it stands, the relationships show up in both systemContext views, and I want them to only show up on one of them.

simonbrowndotje commented 2 years ago

You could just exclude the relationships, either by identifier (as in the example below), or by tag.

workspace "Reuse model with different relationships?" "Incorrectly Demonstrate Model Reuse, is something like this possible?" {

    model {
        customer = person "Customer" "Customer" "Customer"
        website = softwareSystem "Website" "Website" "Website"

        system1 = softwareSystem "system1" "" "" {
            rel1 = customer -> website "Relationship scoped to system1"  
        }

        system2 = softwareSystem "system2" "" ""  {
            rel2 = website -> customer "Relationship scoped to system2"
        }
    }

    views {
        systemContext system1 {
            include customer
            include website
            exclude rel2
            autoLayout
        }

        systemContext system2 {
            include customer
            include website
            exclude rel1
            autoLayout
        }
    }
}
jeffabailey commented 2 years ago

Thank you!