Skip to content

Commit

Permalink
feat: added template for physical function
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Jun 19, 2024
1 parent c00fbde commit 78ab0c9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
27 changes: 22 additions & 5 deletions templates/functional.html.j2
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
{#
Copyright DB InfraGO AG and contributors
SPDX-License-Identifier: Apache-2.0
#}

{% from "common_macros.html.j2" import linked_name, linked_name_with_icon, display_property_values, display_traceability, render_requirements_table, draw_icon, first_upper %}

{% macro list_unused_ports(ports_list) %}
{% set unused_ports = ports_list | rejectattr("exchanges") | list %}
{% if unused_ports %}
<p>The following ports are not connected to any exchange:</p>
<p style="color: red;">The following ports are not connected to any exchange:</p>
<ul>
{% for port in unused_ports %}
<li><span style="color:red">{{ linked_name_with_icon(port) | safe }}</span></li>
<li>{{ linked_name_with_icon(port) | safe }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}

{% macro list_related_exchange_items(exchange) %}
{% if exchange.exchange_items %}
<p>This interaction is further specified via the following Exchange Items:</p>
<ul>
{% for item in exchange.exchange_items %}
<li>{{ linked_name_with_icon(item) | safe }}</li>
{% endfor %}
{% endif %}
{% endmacro %}

{% macro describe_inputs(object) %}
{% if object.inputs %}
{% set owner_name = '<span style="color:red">Unallocated entity</span>' %}
Expand All @@ -34,7 +49,8 @@
<tr>
<td>FEX-{{ exchange.uuid[-5:] | upper}}</td>
<td>
While performing {{ linked_name_with_icon(exchange.source.owner) | safe }} activity {{ source_owner | safe }} may provide {{ linked_name_with_icon(exchange) | safe }} to {{ owner | safe }} so that {{ owner_name }} could {{ object.name }}.
While performing {{ linked_name_with_icon(exchange.source.owner) | safe }} activity {{ source_owner | safe }} may provide {{ linked_name_with_icon(exchange) | safe }} to {{ owner | safe }} so that {{ owner_name | safe }} could {{ object.name }}.
{{ list_related_exchange_items(exchange) | safe }}
</td>
</tr>
{% endfor %}
Expand Down Expand Up @@ -68,7 +84,8 @@
{% set target_owner_name = exchange.target.owner.owner.name %}
{% set target_owner = linked_name_with_icon(exchange.target.owner.owner) %}
{% endif %}
While performing {{ object.name }} activity {{ owner | safe }} may provide {{ linked_name_with_icon(exchange) | safe }} to {{ target_owner | safe }} so that {{ target_owner_name }} could {{ linked_name_with_icon(exchange.target.owner) | safe }}.
While performing {{ object.name }} activity {{ owner_name | safe }} may provide {{ linked_name_with_icon(exchange) | safe }} to {{ target_owner | safe }} so that {{ target_owner_name | safe }} could {{ linked_name_with_icon(exchange.target.owner) | safe }}.
{{ list_related_exchange_items(exchange) | safe }}
</td>
</tr>
{% endfor %}
Expand Down Expand Up @@ -129,4 +146,4 @@
<p>The following requirement objects are linked to "{{ object.name}}"</p>
{{ render_requirements_table(object.requirements) | safe }}
{% endif%}
{% endmacro %}
{% endmacro %}
2 changes: 1 addition & 1 deletion templates/logical-architecture/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ templates:
- template: logical-architecture/logical-function.html.j2
idx: logical-function
name: Logical Functions
description: Defines function of a system component or an actor
description: Defines function of a logical system component or an actor
category: la
variable:
name: object
Expand Down
4 changes: 4 additions & 0 deletions templates/logical-architecture/logical-interface.html.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{#
Copyright DB InfraGO AG and contributors
SPDX-License-Identifier: Apache-2.0
#}

{% from 'common_macros.html.j2' import show_other_attributes, linked_name %}

Expand Down
10 changes: 10 additions & 0 deletions templates/physical-architecture/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ templates:
name: object
type: PhysicalComponent
below: pa

- template: physical-architecture/physical-function.html.j2
idx: physical-function
name: Physical Functions
description: Defines function of a physical component or an actor
category: pa
variable:
name: object
type: PhysicalFunction
below: pa
12 changes: 12 additions & 0 deletions templates/physical-architecture/physical-function.html.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{#
Copyright DB InfraGO AG and contributors
SPDX-License-Identifier: Apache-2.0
#}
{% from 'common_macros.html.j2' import show_other_attributes %}
{% from 'functional.html.j2' import describe_function %}

{{ describe_function(object) | safe }}

<h2>Other properties of "{{ object.name }}"</h2>
{% set excluded = ["context_diagram", "description", "name", "owner", "xtype", "inputs", "outputs", "parent", "related_exchanges", "validate", "applied_property_value_groups", "property_value_groups", "realization_view"] %}
{{ show_other_attributes(object, excluded) | safe}}

0 comments on commit 78ab0c9

Please sign in to comment.