diff --git a/.gitignore b/.gitignore index 6dddc2e..8fa212c 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,5 @@ dmypy.json # Cython debug symbols cython_debug/ + +node_modules/ diff --git a/capella_model_explorer/explorer.py b/capella_model_explorer/explorer.py index ff37956..3d1741d 100644 --- a/capella_model_explorer/explorer.py +++ b/capella_model_explorer/explorer.py @@ -1,5 +1,6 @@ import click from fastapi import FastAPI +from fastapi.responses import HTMLResponse import uvicorn import capellambse from pathlib import Path @@ -76,7 +77,7 @@ def render_template(template_name: str, object_id: str): object = app.model.by_uuid(object_id) # render the template with the object rendered = template.render(object=object) - return rendered + return HTMLResponse(content=rendered, status_code=200) if __name__ == "__main__": diff --git a/templates/system_capability.j2.html b/templates/system_capability.j2.html index f106b7e..14f85d0 100644 --- a/templates/system_capability.j2.html +++ b/templates/system_capability.j2.html @@ -1,6 +1,25 @@ -
{{ object.description }}
{% else %} -No description available.
+No description available.
{% endif %} + +Pre-condition: +{% if object.precondition %} +{{ object.precondition.specification['capella:linkedText']|safe }} +{% else %} +No pre-condition defined
+{% endif %} + +Post-condition: +{% if object.postcondition %} +{{ object.postcondition.specification['capella:linkedText']|safe }} +{% else %} +No post-condition defined
+{% endif %} + +The diagram below provides an overview over the entities immediately involved in the Capability and related Capabilities.
+ +{{ object.context_diagram.as_svg|safe}} \ No newline at end of file