mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
new revised table
This commit is contained in:
@@ -327,6 +327,12 @@ def aggregate_template_usage(template_statistics, sort_key="count"):
|
|||||||
"template_name": template_stats[0]["template_name"],
|
"template_name": template_stats[0]["template_name"],
|
||||||
"template_type": template_stats[0]["template_type"],
|
"template_type": template_stats[0]["template_type"],
|
||||||
"count": sum(s["count"] for s in template_stats),
|
"count": sum(s["count"] for s in template_stats),
|
||||||
|
"last_used": max(s["last_used"] for s in template_stats if s["last_used"]),
|
||||||
|
"created_by": template_stats[0]["created_by"],
|
||||||
|
"created_by_id": template_stats[0]["created_by_id"],
|
||||||
|
"status": template_stats[0]["status"],
|
||||||
|
"template_folder": template_stats[0]["template_folder"],
|
||||||
|
"template_folder_id": template_stats[0]["template_folder_id"],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="aria-live-account" class="usa-sr-only" aria-live="polite"></div>
|
<div id="aria-live-account" class="usa-sr-only" aria-live="polite"></div>
|
||||||
|
|
||||||
{% if current_user.has_permissions('manage_service') %}{% endif %}
|
|
||||||
|
|
||||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
|
||||||
<h2 class="margin-top-4 margin-bottom-1">Recent Batches</h2>
|
<h2 class="margin-top-4 margin-bottom-1">Recent Batches</h2>
|
||||||
<div class="table-overflow-x-auto">
|
<div class="table-overflow-x-auto">
|
||||||
<table class="usa-table usa-table--borderless job-table">
|
<table class="usa-table usa-table--borderless job-table">
|
||||||
@@ -122,7 +120,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Recent templates</h2>
|
<h2>Most Used Templates</h2>
|
||||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,47 @@
|
|||||||
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading, spark_bar_field %}
|
|
||||||
|
|
||||||
<div class="ajax-block-container">
|
<div class="ajax-block-container">
|
||||||
{% if template_statistics|length > 1 %}
|
{% if template_statistics|length > 1 %}
|
||||||
<div class='template-statistics-table table-overflow-x-auto'>
|
<div class="template-statistics-table table-overflow-x-auto">
|
||||||
{% call(item, row_number) list_table(
|
<table class="usa-table width-full">
|
||||||
template_statistics,
|
<caption class="font-body-lg table-heading usa-sr-only">
|
||||||
caption="Messages sent by template",
|
Messages sent by template
|
||||||
caption_visible=False,
|
</caption>
|
||||||
border_visible=True,
|
<thead class="table-field-headings">
|
||||||
empty_message='',
|
<tr>
|
||||||
field_headings=[
|
<th class="table-field-heading-first" width="">
|
||||||
'Template',
|
<span>Template name</span>
|
||||||
'Messages sent'
|
</th>
|
||||||
],
|
<th class="table-field-heading" width="">
|
||||||
field_headings_visible=False
|
<span>Folder</span>
|
||||||
) %}
|
</th>
|
||||||
|
<th class="table-field-heading" width="">
|
||||||
{% call row_heading() %}
|
<span>Last used</span>
|
||||||
|
</th>
|
||||||
|
<th class="table-field-heading" width="">
|
||||||
|
<span>Created by</span>
|
||||||
|
</th>
|
||||||
|
<th class="table-field-heading" width="">
|
||||||
|
<span># Times used</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in template_statistics[:8] %}
|
||||||
|
<tr class="table-row">
|
||||||
|
<td>
|
||||||
<a class="usa-link template-statistics-table-template-name" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a>
|
<a class="usa-link template-statistics-table-template-name" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a>
|
||||||
<span class="template-statistics-table-hint">
|
<span class="template-statistics-table-hint">
|
||||||
{{ 1|message_count_label(item.template_type, suffix='template')|capitalize }}
|
{{ 1|message_count_label(item.template_type, suffix='template')|capitalize }}
|
||||||
</span>
|
</span>
|
||||||
{% endcall %}
|
</td>
|
||||||
|
<td><p>{{ item.template_folder }}</p></td>
|
||||||
{{ spark_bar_field(item.count, most_used_template_count, id=item.template_id) }}
|
<td><p>{{ item.last_used|format_datetime_table}}</p></td>
|
||||||
{% endcall %}
|
<td><p>{{ item.created_by }}</p></td>
|
||||||
<a
|
<td><p>{{ item.count }}</p></td>
|
||||||
href="{{ url_for('.template_usage', service_id=current_service.id) }}"
|
</tr>
|
||||||
class="usa-link show-more-no-border"
|
{% endfor %}
|
||||||
><span>See templates used by month</span></a>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<a href="/services/78409625-0c0a-485e-b82c-b19c8f4b1bdb/template-usage" class="usa-link show-more-no-border"><span>See templates by month</span></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user