Skip to content

Commit

Permalink
Bug fixes for the reports flow (#3630)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Klopper <[email protected]>
  • Loading branch information
Rieven and underdarknl authored Oct 9, 2024
1 parent 6cc813d commit ca5d972
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 523 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h2 id="appendix">{% translate "Appendix" %}</h2>
{% include "aggregate_organisation_report/term_overview.html" %}

<h3 id="selected-oois">{% translate "Selected objects" %} ({{ total_oois }})</h3>
<h3 id="selected-oois">{% translate "Selected objects" %} ({{ oois|length }})</h3>
{% if active_filters %}
<p>
<span class="icon positive"></span><strong>{% translate "Currently filtered on" %}</strong>
Expand All @@ -17,7 +17,7 @@ <h3 id="selected-oois">{% translate "Selected objects" %} ({{ total_oois }})</h3
{% include "summary/ooi_selection.html" %}

</div>
<h3 id="selected-report-types">{% translate "Selected Report Types" %} ({{ data.report_types|length }})</h3>
<h3 id="selected-report-types">{% translate "Selected Report Types" %} ({{ report_types|length }})</h3>
<table>
<caption class="visually-hidden">{% translate "Selected report types" %}</caption>
<thead>
Expand All @@ -27,10 +27,12 @@ <h3 id="selected-report-types">{% translate "Selected Report Types" %} ({{ data.
</tr>
</thead>
<tbody>
{% for report_type in data.report_types %}
{% for report_type in report_types %}
<tr>
<td>
<span class="label tags-color-{{ report_type.label_style }}">{{ report_type.name }}</span>
<ul class="tags horizontal-view">
<li class="label tags-color-{{ report_type.label_style }}">{{ report_type.name }}</li>
</ul>
</td>
<td>{{ report_type.description }}</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ <h1>{{ report_ooi.name }}</h1>
<div>
<p>{% translate "This is the OpenKAT report for organization" %} {{ organization.name }}</p>
<p>
{% translate "Created with data from:" %} <strong>{{ report_ooi.observed_at }} {{ TIME_ZONE }}</strong>
{% translate "Created with data from:" %} <strong>{{ report_ooi.observed_at|date }}</strong>
</p>
<p>
{% translate "Created on:" %} <strong>{{ report_ooi.date_generated }}</strong>
{% translate "Created on:" %} <strong>{{ report_ooi.date_generated|date }}</strong>
</p>
<p>
{% translate "Created by:" %} <strong>{{ organization_member.user.full_name }}</strong>
Expand Down
4 changes: 2 additions & 2 deletions rocky/reports/templates/partials/report_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ <h1>{{ report_ooi.name }}</h1>
{% translate "All selected report types for the selected objects are displayed one below the other." %}
</p>
<p>
{% translate "Created with data from:" %} <strong>{{ report_ooi.observed_at }} {{ TIME_ZONE }}</strong>
{% translate "Created with data from:" %} <strong>{{ report_ooi.observed_at|date }}</strong>
</p>
<p>
{% translate "Created on:" %} <strong>{{ report_ooi.date_generated }}</strong>
{% translate "Created on:" %} <strong>{{ report_ooi.date_generated|date }}</strong>
</p>
<p>
{% translate "Created by:" %} <strong>{{ organization_member.user.full_name }}</strong>
Expand Down
42 changes: 26 additions & 16 deletions rocky/reports/templates/report_overview/report_history_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@
title="{% translate "Shows parent report details" %}">{{ report.parent_report.name }}</a>
</td>
<td>
{% if report.parent_report.report_type == "concatenated-report" or report.parent_report.report_type is None %}
{% for report_type, total_objects in report.report_type_summary.items %}
{% if forloop.counter0 < 2 %}
<span class="label tags-color-{{ report_type|get_report_type_label_style }}">{{ report_type|get_report_type_name }}</span>
{% endif %}
{% if forloop.counter0 == 2 %}
<span class="label tags-color-grey-2">+ {{ report.report_type_summary|length|add:"-2" }}</span>
{% endif %}
{% endfor %}
{% else %}
<span class="label tags-color-{{ report.parent_report.report_type|get_report_type_label_style }}">{{ report.parent_report.report_type|get_report_type_name }}</span>
{% endif %}
<ul class="tags horizontal-view">
{% if report.parent_report.report_type == "concatenated-report" or report.parent_report.report_type is None %}
{% for report_type, total_objects in report.report_type_summary.items %}
{% if forloop.counter0 < 2 %}
<li class="label tags-color-{{ report_type|get_report_type_label_style }}">{{ report_type|get_report_type_name }}</li>
{% endif %}
{% if forloop.counter0 == 2 %}
<li class="label tags-color-grey-2">+ {{ report.report_type_summary|length|add:"-2" }}</li>
{% endif %}
{% endfor %}
{% else %}
<li class="label tags-color-{{ report.parent_report.report_type|get_report_type_label_style }}">
{{ report.parent_report.report_type|get_report_type_name }}
</li>
{% endif %}
</ul>
</td>
<td>
{% if report.parent_report.input_oois|length == 1 %}
Expand Down Expand Up @@ -81,7 +85,9 @@ <h5>{% translate "Report types" %}</h5>
{% for report_type, total_objects in report.report_type_summary.items %}
<tr>
<td>
<span class="label tags-color-{{ report_type|get_report_type_label_style }}">{{ report_type|get_report_type_name }}</span>
<ul class="tags horizontal-view">
<li class="label tags-color-{{ report_type|get_report_type_label_style }}">{{ report_type|get_report_type_name }}</li>
</ul>
</td>
<td>{{ total_objects }}</td>
</tr>
Expand All @@ -97,21 +103,25 @@ <h5>
<tr>
<th scope="col">{% translate "Report type" %}</th>
<th scope="col">{% translate "Object" %}</th>
<th scope="col">{% translate "Report ID" %}</th>
<th scope="col">{% translate "Report name" %}</th>
</tr>
</thead>
<tbody>
{% for child_report in report.children_reports %}
<tr>
<td>
<span class="label tags-color-{{ child_report.report_type|get_report_type_label_style }}">{{ child_report.report_type|get_report_type_name }}</span>
<ul class="tags horizontal-view">
<li class="label tags-color-{{ child_report.report_type|get_report_type_label_style }}">
{{ child_report.report_type|get_report_type_name }}
</li>
</ul>
</td>
<td>
<a href="{% ooi_url 'ooi_detail' child_report.input_oois.0 organization.code %}">{{ child_report.input_oois.0|human_readable }}</a>
</td>
<td>
<a href="{% url "view_report" organization.code %}?report_id={{ child_report }}&observed_at={{ child_report.observed_at|date:"Y-m-d H:i:s:u" }}"
title="{% translate "Shows subreport details" %}">{{ child_report }}</a>
title="{% translate "Shows subreport details" %}">{{ child_report.name }}</a>
</td>
</tr>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
title="{% translate "Shows report details" %}">{{ subreport.name }}</a>
</td>
<td>
<span class="label tags-color-{{ subreport.report_type|get_report_type_label_style }}">{{ subreport.report_type|get_report_type_name }}</span>
<ul class="tags horizontal-view">
<li class="label tags-color-{{ subreport.report_type|get_report_type_label_style }}">
{{ subreport.report_type|get_report_type_name }}
</li>
</ul>
</td>
<td>
<a href="{% ooi_url "ooi_detail" subreport.input_oois.0 organization.code %}">{{ subreport.input_oois.0|human_readable }}</a>
Expand Down
78 changes: 45 additions & 33 deletions rocky/reports/templates/summary/report_asset_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,54 @@
<section id="asset-overview">
<div>
<h2>{% translate "Asset overview" %}</h2>
<h3>{% translate "Selected objects" %} ({{ total_oois }})</h3>
<p>
{% blocktranslate trimmed %}
The objects listed in the table below were used to generate this report.
For each object in the table it additionally shows the clearance level and whether or not the object was
added by a user ('Declared') or indirectly identified through another service or system ('Inherited').
{% endblocktranslate %}
</p>
{% include "summary/ooi_selection.html" %}
{% if oois %}
<h3>{% translate "Selected objects" %} ({{ oois|length }})</h3>
<p>
{% blocktranslate trimmed %}
The objects listed in the table below were used to generate this report.
For each object in the table it additionally shows the clearance level and whether or not the object was
added by a user ('Declared') or indirectly identified through another service or system ('Inherited').
{% endblocktranslate %}
</p>
{% include "summary/ooi_selection.html" %}

<h3>{% translate "Selected Report Types" %} ({{ report_types|length }})</h3>
<p>
{% blocktranslate trimmed %}
The table below shows which reports were chosen to generate this report,
including a report description.
{% endblocktranslate %}
</p>
<table>
<caption class="visually-hidden">{% translate "Selected Report Types" %}</caption>
<thead>
<tr>
<th>{% translate "Report type" %}</th>
<th>{% translate "Description" %}</th>
</tr>
</thead>
<tbody>
{% for report_type in report_types %}
{% else %}
<h3>{% translate "Selected objects" %}</h3>
<p>{% translate "No objects found." %}</p>
{% endif %}
{% if report_types %}
<h3>{% translate "Selected Report Types" %} ({{ report_types|length }})</h3>
<p>
{% blocktranslate trimmed %}
The table below shows which reports were chosen to generate this report,
including a report description.
{% endblocktranslate %}
</p>
<table>
<caption class="visually-hidden">{% translate "Selected Report Types" %}</caption>
<thead>
<tr>
<td>
<span class="label tags-color-{{ report_type.label_style }}">{{ report_type.name }}</span>
</td>
<td>{{ report_type.description }}</td>
<th>{% translate "Report type" %}</th>
<th>{% translate "Description" %}</th>
</tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for report_type in report_types %}
<tr>
<td>
<ul class="tags horizontal-view">
<li class="label tags-color-{{ report_type.label_style }}">{{ report_type.name }}</li>
</ul>
</td>
<td>{{ report_type.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h3>{% translate "Selected Report Types" %}</h3>
<p>{% translate "No report types found." %}</p>
{% endif %}
{{ data }}
{% include "summary/selected_plugins.html" %}

Expand Down
19 changes: 12 additions & 7 deletions rocky/reports/templates/summary/selected_plugins.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}

<h3>{% translate "Plugins" %} ({{ data.plugins|length }})</h3>
{% if data.plugins %}
{% if plugins %}
<h3>{% translate "Plugins" %} ({{ plugins|length }})</h3>
<p>
{% blocktranslate trimmed %}
The table below shows all required or optional plugins for the selected reports.
Expand All @@ -20,20 +20,24 @@ <h3>{% translate "Plugins" %} ({{ data.plugins|length }})</h3>
</tr>
</thead>
<tbody>
{% for plugin in data.plugins %}
{% for plugin in plugins %}
<tr>
<td>
{% if plugin.enabled %}
<span class="icon positive"></span>
<span class="icon positive">{% translate "Enabled." %}</span>
{% else %}
<span class="icon incomplete"></span>
{% if plugin.required %}
<span class="icon failed">{% translate "Disabled" %} {% translate "required" %}</span>
{% else %}
<span class="icon incomplete">{% translate "Disabled" %} {% translate "optional" %}</span>
{% endif %}
{% endif %}
</td>
<td>
{% if plugin.required %}
required
{% translate "required" %}
{% else %}
optional
{% translate "optional" %}
{% endif %}
</td>
<td>{{ plugin.name }}</td>
Expand All @@ -50,5 +54,6 @@ <h3>{% translate "Plugins" %} ({{ data.plugins|length }})</h3>
</tbody>
</table>
{% else %}
<h3>{% translate "Plugins" %}</h3>
{% translate "There are no required or optional plugins needed for the selected report types." %}
{% endif %}
Loading

0 comments on commit ca5d972

Please sign in to comment.