diff --git a/templates/logical-component.html.j2 b/templates/logical-component.html.j2 index 825575a..70185b4 100644 --- a/templates/logical-component.html.j2 +++ b/templates/logical-component.html.j2 @@ -1,6 +1,37 @@ +{% macro description(obj) %} + {% if obj.description %} +

{{ obj.description }}

+ {% else %} +

No description available.

+ {% endif %} +{% endmacro %} +

{{ object.name }}

-{% if object.description %} -

{{ object.description }}

-{% else %} -

No description available.

-{% endif %} +{{ description(object) }} + +

Logical Component Context

+ +

+The figure below provides an overview of the logical subsystem and external entities that either require the functionality of {{ object.name }} (expect outputs) or enable it (provide inputs). The figure also identifies the interfaces between the subsystem and its environment. +

+ +{{ object.context_diagram.as_svg|safe }} + +

Logical interface partners of {{object.name}}

+ +{% set lexcs = [] %}{% for port in object.ports %}{% for lexc in port.exchanges %} +{% set _ = lexcs.append([lexc, lexc.source.owner if lexc.source.owner != subsystem else lexc.target.owner]) %} +{% endfor %}{% endfor %} + +{% for partner_cmp_name in lexcs | map(attribute=1) | map(attribute="name") | unique %} + {% set partner = lexcs | map(attribute=1) | selectattr("name", "equalto", partner_cmp_name) | first %} +

{{ partner.name }}

+

{{ description(partner) }}

+ {% set spp = lexcs | map(attribute=0) | selectattr("source.owner", "equalto", partner) | list %} + {% set tpp = lexcs | map(attribute=0) | selectattr("target.owner", "equalto", partner) | list %} + {% for lexc in (spp + tpp) %} +

Logical interface {{ lexc.name }}

+ {{ lexc.context_diagram.as_svg|safe }} + {{ 8/0 }} + {% endfor %} +{% endfor %} diff --git a/templates/logical-component.yaml b/templates/logical-component.yaml index 8adc4c0..7012fda 100644 --- a/templates/logical-component.yaml +++ b/templates/logical-component.yaml @@ -1,6 +1,6 @@ template: logical-component.html.j2 name: Logical Component -description: Specifies a logical component. +description: Specifies a logical component. This is a ported template from a prototype project. variable: name: object type: LogicalComponent