Skip to content

Commit

Permalink
demo template improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Feb 28, 2024
1 parent 0969591 commit c9fc1b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,5 @@ dmypy.json

# Cython debug symbols
cython_debug/

node_modules/
3 changes: 2 additions & 1 deletion capella_model_explorer/explorer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import click
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import uvicorn
import capellambse
from pathlib import Path
Expand Down Expand Up @@ -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__":
Expand Down
23 changes: 21 additions & 2 deletions templates/system_capability.j2.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
<h1>{{ object.name }}</h1>
<h1>{{ object.name | capitalize }}</h1>
{% if object.description %}
<p>{{ object.description }}</p>
{% else %}
<p>No description available.</p>
<p style="color:red">No description available.</p>
{% endif %}

<b>Pre-condition</b>:
{% if object.precondition %}
{{ object.precondition.specification['capella:linkedText']|safe }}
{% else %}
<p style="color:red">No pre-condition defined</p>
{% endif %}

<b>Post-condition</b>:
{% if object.postcondition %}
{{ object.postcondition.specification['capella:linkedText']|safe }}
{% else %}
<p style="color:red">No post-condition defined</p>
{% endif %}

<h2>Context Diagram</h2>
<p>The diagram below provides an overview over the entities immediately involved in the Capability and related Capabilities.</p>

{{ object.context_diagram.as_svg|safe}}

0 comments on commit c9fc1b9

Please sign in to comment.