Skip to content

Commit

Permalink
added template support for metadata and stats
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Oct 6, 2023
1 parent 217513d commit 88e979c
Showing 1 changed file with 80 additions and 7 deletions.
87 changes: 80 additions & 7 deletions report.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,91 @@
.created {
color: #00aa00;
}
/* nice table style with borders, bold th*/
table {
border-collapse: collapse;
border: 1px solid #ccc;
}
table tbody th {
font-weight: bold;
border: 1px solid #ccc;
padding: 0.25em;
text-align: right;
}
table td {
border: 1px solid #ccc;
padding: 0.25em;
}
</style>
</head>
<body>
<h1>Model Change Assessment Report</h1>
<p><b>Current model:</b> {{ data["metadata"]["new-revision"] }}</p>
<p><b>Previous model:</b> {{ data["metadata"]["old-revision"] }}</p>
<h1>Object Changes {{ data["objects"].stats }}</h1>
<p>This report provides an analysis of changes to the following model repository:</p>
<p>
<b>Repository: </b>{{ data["metadata"]["model"]["path"] }} <br/>
<b>Entry point: </b>{{ data["metadata"]["model"]["entrypoint"] }}
</p>
<p>The review of changes covers the following commits:</p>
<table>
<thead>
<tr>
<th></th>
<th>Previous</th>
<th>Current</th>
</tr>
</thead>
<tbody>
<tr>
<th>Author</th>
<td>{{ data["metadata"]["old_revision"]["author"] }}</td>
<td>{{ data["metadata"]["new_revision"]["author"] }}</td>
</tr>
<tr>
<th>Revision</th>
<td>{{ data["metadata"]["old_revision"]["revision"] }}</td>
<td>{{ data["metadata"]["new_revision"]["revision"] }}</td>
</tr>
<tr>
<th>Date & time of commit</th>
<td>{{ data["metadata"]["old_revision"]["date"] }}</td>
<td>{{ data["metadata"]["new_revision"]["date"] }}</td>
</tr>
<tr>
<th>Commit message</th>
<td>{{ data["metadata"]["old_revision"]["description"] }}</td>
<td>{{ data["metadata"]["new_revision"]["description"] }}</td>
</tr>
<tr>
<th>Commit ID (hash)</th>
<td>{{ data["metadata"]["old_revision"]["hash"] }}</td>
<td>{{ data["metadata"]["new_revision"]["hash"] }}</td>
</tr>
</tbody>
</table>

{% macro pretty_stats(stats) %}
<span style="font-weight: normal;">(
{% if stats.created %}<span style="color:green">+{{stats["created"]}}</span> / {% endif %}
{% if stats.deleted %}<span style="color:red">-{{stats["deleted"]}}</span> / {% endif %}
{% if stats.modified %}<span style="color:blue">Δ{{stats["modified"]}}</span>{% endif %}
)</span>
{% endmacro %}

<h1>Object Changes {{ pretty_stats(data["objects"].stats) }}</h1>
<p><b>Disclaimer:</b> current version of model comparison engine uses a selected list of objects of interest and will not report object changes for object types that were considered as "out of scope". For the objects of interest however we can assure completness and correctness of comparison.</p>
<div class="section">
{% set LAYER = {"oa": "Operational Analysis", "sa": "System Analysis", "la": "Logical Architecture", "pa": "Physical Architecture"}%}
{% for layer in ["oa", "sa", "la", "pa"] %}
{% set layer_data = data["objects"][layer] %}
{% if layer_data %}
<h2>{{LAYER[layer]}} {{ layer_data.stats }}</h2>
{% endif %}
{% if layer_data and layer_data.stats %}
<h2>{{LAYER[layer]}} {{ pretty_stats(layer_data.stats) }}</h2>


<div class="section">
{% for obj_type in data["objects"][layer] if obj_type != "stats" %}
{% set obj_type_items = data["objects"][layer][obj_type] %}
<h3>{{obj_type}} {{obj_type_items.stats}}</h3>
{% if obj_type_items.stats %}
<h3>{{obj_type}} {{pretty_stats(obj_type_items.stats)}}</h3>
<div class="created-modified-delited">
{% if "created" in obj_type_items %}
<h4 style="color: #009900">Created</h4>
Expand Down Expand Up @@ -93,9 +158,17 @@
</div>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
</div>

<h1>Diagram changes</h1>
<p><b>Disclaimer:</b> this section only looks at content changes to diagrams of interest.</p>
<div class="section">

</div>
</body>
</html>

0 comments on commit 88e979c

Please sign in to comment.