Files
notifications-admin/app/templates/views/notifications.html

93 lines
3.2 KiB
HTML
Raw Normal View History

{% extends "withnav_template.html" %}
{% from "components/ajax-block.html" import ajax_block %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
2023-08-30 11:07:38 -04:00
{% from "components/components/button/macro.njk" import usaButton %}
{% set page_title = (
2022-12-12 15:15:50 -05:00
(99|message_count_label(message_type, suffix='')) | capitalize
if current_user.has_permissions('view_activity')
else 'Sent messages'
) %}
{% block service_page_title %}
{{ page_title }}
{% endblock %}
{% block maincolumn_content %}
{{ page_header(page_title) }}
2022-12-05 15:33:44 -05:00
{{ ajax_block(
partials,
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status),
'counts'
) }}
<p class="notification-status {{ field_status }}">
Messages will remain in pending state until carrier status is received, typically 5 minutes.
</p>
{% call form_wrapper(
action=url_for('.view_notifications', service_id=current_service.id, message_type=message_type),
class="usa-search margin-bottom-2"
) %}
<div class="grid-col-4 {% if message_type == 'sms' %}extra-tracking{% endif %}">
{{ search_form.to(param_extensions={
"label": {
"text": things_you_can_search_by|formatted_list(
conjunction='or',
before_each='',
after_each='',
prefix='Search by',
prefix_plural='Search by'
)
}
}) }}
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="usa-button" type="submit">
<span class="usa-search__submit-text">Search </span><img src="/assets/img/usa-icons-bg/search--white.svg"
class="usa-search__submit-icon" alt="Search" />
2023-12-13 15:17:04 -08:00
</button>
{% endcall %}
{% call form_wrapper(id="search-form") %}
<input type="hidden" name="to" {% if search_form.to.data %}value="{{ search_form.to.data }}{% endif %}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% endcall %}
{% if current_user.has_permissions('view_activity') %}
<p class="font-body-sm">
2024-06-10 10:15:22 -06:00
<a href="{{ download_link_seven_day }}" download="download" class="usa-link">Download all data last 7 days (<abbr title="Comma separated values">CSV</abbr>)</a>
&emsp;
Data available for {{ partials.service_data_retention_days }} days
</p>
2024-06-10 10:15:22 -06:00
<p class="font-body-sm">
<a href="{{ download_link_five_day }}" download="download" class="usa-link">Download all data last 5 days (<abbr title="Comma separated values">CSV</abbr>)</a>
&emsp;
</p>
<p class="font-body-sm">
<a href="{{ download_link_three_day }}" download="download" class="usa-link">Download all data last 3 days (<abbr title="Comma separated values">CSV</abbr>)</a>
&emsp;
</p>
2024-06-24 10:44:19 -06:00
<p class="font-body-sm">
<a href="{{ download_link_today }}" download="download" class="usa-link">Download all data today (<abbr title="Comma separated values">CSV</abbr>)</a>
&emsp;
2024-06-10 10:15:22 -06:00
</p>
{% endif %}
{{ ajax_block(
partials,
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
'notifications',
Delay AJAX calls if the server is slow to respond By default our AJAX calls were 2 seconds. Then they were 5 seconds because someone reckoned 2 seconds was putting too much load on the system. Then we made them 10 seconds while we were having an incident. Then we made them 20 seconds for the heaviest pages, but back to 5 seconds or 2 seconds for the rest of the pages. This is not a good situation because: - it slows all services down equally, no matter how much traffic they have, or which features they have switched on - it slows everything down by the same amount, no matter how much load the platform is under - the values are set based on our worst performance, until we manually remember to switch them back - we spend time during incidents deploying changes to slow down the dashboard refresh time because it’s a nothing-to-lose change that might relieve some symptoms, when we could be spending time digging into the underlying cause This pull request makes the Javascript smarter about how long it waits until it makes another AJAX call. It bases the delay on how long the server takes to respond (as a proxy for how much load the server is under). It’s based on the square root of the response time, so is more sensitive to slow downs early on, and less sensitive to slow downs later on. This helps us give a more pronounced difference in delay between an AJAX call that is fast (for example the page for a single notification) and one that is slow (for example a dashboard for a service with lots of traffic). *Some examples of what this would mean for various pages* Page | Response time | Wait until next AJAX call ---|---|--- Check a reply to address | 130ms | 1,850ms Brand new service dashboard | 229ms | 2,783ms HM Passport Office dashboard | 634ms | 5,294ms NHS Coronavirus Service dashboard | 779ms | 5,977ms _Example of the kind of slowness we’ve seen during an incident_ | 6,000ms | 18,364ms GOV.UK email dashboard | `HTTP 504` | 😬
2020-04-08 17:55:53 +01:00
form='search-form'
) }}
{% endblock %}