GithubHelp home page GithubHelp logo

Comments (31)

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 3

It should be possible to add a feature to do something like this though:

container springPetClinic {
    include "tag:tag 1"
    autoLayout
 }

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 2

That's now available ... this will work:

container springPetClinic "All_Containers_tag1_expectation2" {
    include "element.tag==tag1"
    exclude * -> *
    include "relationship.tag==tag1"
    autoLayout
}

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 2

Correct, it's only available on the demo page at the moment - there should be a new CLI release in the next week or so.

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 2

CLI v1.9.0 is now available -> https://github.com/structurizr/cli/releases/tag/v1.9.0

(the tags functionality still isn't implemented for deployment views, but this will follow)

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 1

Correct, yes ... with your examples, something like this:

container springPetClinic "All_Containers_tag1_expectation" {
    include "element.tag=tag1"
    autoLayout
}

container springPetClinic "All_Containers_tag2_expectation" {
    include "element.tag=tag2"
    autoLayout
}

I'm thinking that a syntax of element.tag= allows for similar features in the future, perhaps relationship.tag=, or element.property.name=value (somebody was asking about this recently).

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 1

This is now available to try at https://structurizr.com/dsl:

workspace "Amazon Web Services Example" "An example AWS deployment architecture." {
    model {
        springPetClinic = softwaresystem "Spring PetClinic" "Allows employees to view and manage information regarding the veterinarians, the clients, and their pets." "Spring Boot Application"{
            app = container "Mobile App" "Show information regarding the veterinarians, the clients, and their pets." "android" "Mobile App, tag1, tag2"
            api1 = container "API 1" "API 2" "Java and Spring Boot" "tag1"
            api2 = container "API 2" "API 2" "Java and Spring Boot" "tag2"
            database = container "Database" "Stores information regarding the veterinarians, the clients, and their pets." "Relational database schema" "Database, tag1"
        }
        thirdPartyApi1 = softwaresystem "Third-Party API 1" "" "tag1"
        thirdPartyApi2 = softwaresystem "Third-Party API 2" "" "tag2"
        
        app -> api1 "manages data" "AWS API Gateway" "tag1"
        app -> api2 "manages data" "AWS API Gateway" "tag2"
        api1 -> database "Reads from and writes to" "JDBC/SSL" "tag1"
        api1 -> thirdPartyApi1 "Get 3rd pary data" "HTTP" "tag1"
        api2 -> thirdPartyApi2 "Get 3rd pary data" "HTTP" "tag2"
    }
         
    views {
        container springPetClinic "All_Containers_tag1_expectation1" {
            include app api1 database thirdPartyApi1
            autoLayout
        }
        
        container springPetClinic "All_Containers_tag2_expectation1" {
            include app api2 thirdPartyApi2
            autoLayout
        }
        
        container springPetClinic "All_Containers_tag1_expectation2" {
            include "element.tag==tag1"
            autoLayout
        }
        
        container springPetClinic "All_Containers_tag2_expectation2" {
            include "element.tag==tag2"
            autoLayout
        }
        
        styles {
            element "Element" {
                shape roundedbox
                background "#ffffff"
            }
            element "Database" {
                shape cylinder
            }
            element "Mobile App" {
                shape MobileDeviceLandscape
            }
            element "Infrastructure Node" {
                shape roundedbox
            }
        }

        themes https://static.structurizr.com/themes/amazon-web-services-2020.04.30/theme.json
    }
}

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 1

It hopefully will be, although it requires a little more thought based upon the way that the current implementation of include for deployment views works (it expects deployment nodes).

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024 1

I've added support for including relationships by tag now too, with the following DSL definition as an example:

workspace {

    model {
        softwareSystem = softwaresystem "Software System" {
            webApplication = container "Web Application" 
            database = container "Database"
        }

        webApplication -> database "Reads from and writes to" "JDBC/SSL" "Tag 1"

        deploymentEnvironment "Live" {
            deploymentNode "Amazon Web Services" {
                route53 = infrastructureNode "Route 53"
                elb = infrastructureNode "Elastic Load Balancer"
                deploymentNode "EC2" {
                    webApplicationInstance = containerInstance webApplication
                    containerInstance database
                }

                route53 -> elb "Forwards requests to" "HTTPS" "Tag 2"
                elb -> webApplicationInstance "Forwards requests to" "HTTPS" "Tag 3"
            }
        }
    }
         
    views {
        deployment * "Live" {
            include "element.type==InfrastructureNode"
            include "element.tag==Container Instance"
            exclude * -> *
            include "relationship.tag==Tag 1"
            include "relationship.tag==Tag 2"
            include "relationship.tag==Tag 3"
            autolayout lr
        }
   }
   
}

Does that work as you'd expect? Also, what's your use case for including relationships by tag?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

That's the intended behaviour. From https://structurizr.com/help/filtered-views:

The benefit of using filtered views is that element and relationship positions are shared between the filtered views.

Filtered views are designed to share the same underlying layout, so that they can be easily compared side-by-side (e.g. before and after, current and future state, etc).

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Thanks for the clarification. Then, is there any way to get the view I want based on element tags?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

Not with tags, I'm afraid.

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

That feature would be great! I would suggest it supporting multiple tags. Thanks

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

I think I'd like to do something like this:

  • include elements that have the specified tag: include "tag:tag 1"
  • include elements that have all of the specified tags: include "tag:tag 1,tag 2"

So these two blocks would potentially yield different results:

container springPetClinic {
    include "tag:tag 1"
    include "tag:tag 2"
    autoLayout
 }
container springPetClinic {
    include "tag:tag 1,tag 2"
    autoLayout
 }

Thoughts?

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Sounds great. So, the first example would include all elements with tag tag1 or tag2, while the second example would include all elements having both tag1 and tag2. Right?

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Awesome! Thanks

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Nice! Thanks for implementing it so fast. Quick one: in case I want to pick both elements and relationships with the same tag 'tag1', should I use "tag==tag1" directly?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

Probably not. For convenience, whenever you add an element to a view, any relationships from/to that element are also added to the view. So you're probably going to end up doing something like this:

include "element.tag==tag1"
exclude * -> *
include "relationship.tag==tag1"

I'll push another version up to the demo page once the relationship.tag== expression is supported.

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Is this feature also supported in deployment views?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

This commit adds support for static views.

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Cool! It is not live yet, right? I was trying including/excluing via relationship tags

from dsl.

dgradl-fl avatar dgradl-fl commented on August 17, 2024

When is this release expected?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

Hopefully next week.

from dsl.

MTomBosch avatar MTomBosch commented on August 17, 2024

Is the tag support available for dynamic views?

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

It's not ... since you're adding instances of relationships from the static model in a specific order, I'm not sure that adding relationships based upon tags is very useful.

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Hi Simon, do you have a ticket for enabling this feature in deployment views? If not, can you share the status? Thank you!

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

I stashed the code to release support for static views, but an initial version is running at https://structurizr.com/dsl ... let me know what you think.

from dsl.

MTomBosch avatar MTomBosch commented on August 17, 2024

It's not ... since you're adding instances of relationships from the static model in a specific order, I'm not sure that adding relationships based upon tags is very useful.

Yes, you are right. Since I am anyway controlling via the relations which elements are shown the inclusion via tags makes no sense at all :)

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

I stashed the code to release support for static views, but an initial version is running at https://structurizr.com/dsl ... let me know what you think.

Almost perfect! Including elements by tag is working, but I cannot include relationship by tags. Can you check? Thanks!

from dsl.

simonbrowndotje avatar simonbrowndotje commented on August 17, 2024

Unfortunately it's not almost perfect ... on writing the unit tests, I found the initial version of include element.tag==X support for deployment views didn't work in all situations. For example, the previous expression could be interpreted to include:

  • software system instances that have a tag of X
  • instances of software systems that have a tag of X

These are very different, and there's no way to distinguish what the user was really looking for. So I've made some enhancements. By default, include element.tag==X will include both the cases above, as I think this is more likely the functionality that people would expect.

But you can override it by specifying the type of the element you're interested in, for example:

  • include "element.type==Container && element.tag==X"
  • include "element.type==ContainerInstance && element.tag==X"

This is running at https://structurizr.com/dsl ... please take a look and let me know if it still works for you.

from dsl.

juanrferia avatar juanrferia commented on August 17, 2024

Hi Simon. Looks great!
My usecase for including relationships: I found some of my deployment diagrams difficult to read beacuse they included too many relationships. I decided to hide all relationships between containers and systems and, instead, I created just a few simple relationships bettween deployments nodes to represent them as an abstaction and make it clear.
Thanks a lot!

from dsl.

AndreiPashkin avatar AndreiPashkin commented on August 17, 2024

For future readers - syntax has changed, now you have to write exclude "* -> *" and not exclude * -> *.

from dsl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.