created testing for activity page

This commit is contained in:
Beverly Nguyen
2024-07-25 17:09:17 -07:00
parent b37b95cdcf
commit 8461c6156b
4 changed files with 210 additions and 16 deletions

View File

@@ -59,13 +59,9 @@
{% endif %}
{% endset %}
{% block maincolumn_content %}
<div class="margin-bottom-8">
<h1 class="usa-sr-only">All activity</h1>
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
{% include 'views/dashboard/write-first-messages.html' %}
{% endif %}
<h2 class="font-body-2xl line-height-sans-2 margin-0">All activity</h2>
<h2 class="margin-top-4 margin-bottom-1">Sent jobs</h2>
<div class="usa-table-container--scrollable-mobile">
@@ -115,6 +111,9 @@
</tr>
{% endfor %}
{% else %}
<tr class="table-row">
<td class="table-empty-message" colspan="10">No batched job messages found (messages are kept for {{ service_data_retention_days }} days).</td>
</tr>
{% endif %}
</tbody>
</table>

View File

@@ -34,17 +34,10 @@ def generate_previous_next_dict(view, service_id, page, title, url_args):
def generate_pagination_pages(total_items, page_size, current_page):
total_pages = (total_items + page_size - 1) // page_size
pagination = {"current": current_page, "pages": [], "last": total_pages}
if total_pages <= 4:
if total_pages <= 9:
pagination["pages"] = list(range(1, total_pages + 1))
else:
if current_page <= 3:
pagination["pages"] = [1, 2, 3, total_pages]
else:
pagination["pages"] = [
1,
current_page - 1,
current_page,
current_page + 1,
total_pages,
]
start_page = max(1, min(current_page - 4, total_pages - 8))
end_page = min(start_page + 8, total_pages)
pagination["pages"] = list(range(start_page, end_page + 1))
return pagination