Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

->container-> expression does not work as expected in deployment view #347

Closed
telune opened this issue Oct 9, 2024 · 4 comments
Closed
Labels

Comments

@telune
Copy link

telune commented Oct 9, 2024

Expected

When I define a deployment view, and I use element expressions to include elements, I would expect all element expressions to work.

Actual

If I use element expressions to include the specific element I want, afferent and efferent couplings are not shown; however, they are shown if I include the element I want via a tag.

Steps to reproduce

Here is a sample workspace to illustrate the bug:

workspace "deploymentDiagramBug" {

  !identifiers hierarchical

  model {
    # Software Systems
    ss = softwareSystem "Sample Software System" "" {
      sc1 = container "Sample Container 1" "Does something interesting with 1" "" "TAG1"
      sc2 = container "Sample Container 2" "Does something interesting with 2" "" "TAG2"
    }
    
    # Relationships
    ss.sc1 -> ss.sc2 "Sends data from 1 to 2"
    ss.sc2 -> ss.sc1 "Sends data from 2 to 1"
    
    # Deployment environments
    prod = deploymentEnvironment "Production" {
      softwareSystemNode = deploymentNode "Software System Deployment Infrastructure" {
        sc1_vm = deploymentNode "SC1 VM" "" "" {
          sc1_instance = containerInstance ss.sc1
        }
        sc2_vm = deploymentNode "SC2 VM" "" "" {
          sc2_instance = containerInstance ss.sc2
        }
      }
    }
  }

  views {
    deployment ss prod "SC1DeploymentProdViewBug1" "SC1 Deployment View (BUGGED 1)" {
      include "->ss.sc1->"
      autolayout tb
    }
    deployment ss prod "SC1DeploymentProdViewBug2" "SC1 Deployment View (BUGGED 2)" {
      include "element==->ss.sc1->"
      autolayout tb
    }
    deployment ss prod "SC1DeploymentProdViewWork" "SC1 Deployment View (WORKING)" {
      include "->element.tag==TAG1->"
      autolayout tb
    }

    theme default
  }
}

Both "SC1DeploymentProdViewBug1" and "SC1DeploymentProdViewBug2" do not show afferent and efferent couplings:

image

While "SC1DeploymentProdViewWork" shows afferent and efferent couplings:

image

Version/build information

I am using Structurizr Lite version 2024.09.19, taken from Docker Hub (docker.io/structurizr/lite:2024.09.19)

Severity

Minor

Priority

I have no budget and there's no rush, please fix this for free

More information

No response

@telune telune added the bug label Oct 9, 2024
@telune telune changed the title Some elements are not included in Deployment View when including a specific element Some elements are not included in Deployment View when using certain element expressions Oct 9, 2024
@simonbrowndotje
Copy link
Contributor

simonbrowndotje commented Oct 9, 2024

I can see why this is failing ... a workaround is to specify the container instances rather than the containers:

    deployment ss prod "SC1DeploymentProdViewBug1" "SC1 Deployment View (BUGGED 1)" {
      include "->prod.softwareSystemNode.sc1_vm.sc1_instance->"
      autolayout tb
    }

@simonbrowndotje simonbrowndotje changed the title Some elements are not included in Deployment View when using certain element expressions ->container-> expression does not work as expected in deployment view Oct 9, 2024
@telune
Copy link
Author

telune commented Oct 9, 2024

Thanks @simonbrowndotje, the workaround works perfectly. For some reason, I didn't think of that. Is this expected? I mean, is it expected that in deployment views you should reference container instances? Is this documented somewhere? If not, wouldn't it be better to document this in https://docs.structurizr.com/dsl/expressions#element-expressions?

The thing that bothers me is that, if I use the container, it draws the container instance, but not the couplings. So it seems like something is missing somewhere.

@simonbrowndotje
Copy link
Contributor

The thing that bothers me is that, if I use the container, it draws the container instance, but not the couplings. So it seems like something is missing somewhere.

It was ... I've added some code to make this work as expected (the commit is linked above).

@telune
Copy link
Author

telune commented Oct 9, 2024

Sorry, my bad... I didn't see it was "completed", I thought you closed the issue as the expected behavior was to indicate container instances. I'm not used to such rapid fixes! Kudos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants