mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 01:38:25 -04:00
Remove list of services from platform admin index
We have two new pages for live and trial services that: - are faster loading - are now linked to So the list of services doesn’t need to be on the platform admin index page any more.
This commit is contained in:
@@ -33,11 +33,7 @@ def platform_admin():
|
||||
'views/platform-admin/index.html',
|
||||
include_from_test_key=form.include_from_test_key.data,
|
||||
form=form,
|
||||
**get_statistics(sorted(
|
||||
services,
|
||||
key=lambda service: (service['active'], sum_service_usage(service), service['created_at']),
|
||||
reverse=True
|
||||
))
|
||||
global_stats=create_global_stats(services),
|
||||
)
|
||||
|
||||
|
||||
@@ -79,18 +75,6 @@ def sum_service_usage(service):
|
||||
return total
|
||||
|
||||
|
||||
def get_statistics(services):
|
||||
return {
|
||||
'global_stats': create_global_stats(services),
|
||||
'live_services': format_stats_by_service(
|
||||
service for service in services if not service['restricted']
|
||||
),
|
||||
'trial_mode_services': format_stats_by_service(
|
||||
service for service in services if service['restricted']
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def filter_and_sort_services(services, trial_mode_services=False):
|
||||
return (
|
||||
service for service in sorted(
|
||||
|
||||
@@ -5,80 +5,6 @@
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/table.html" import mapping_table, field, stats_fields, row_group, row, right_aligned_field_heading, hidden_field_heading, text_field %}
|
||||
|
||||
{% macro stats_fields(channel, data) -%}
|
||||
|
||||
{% call field(border=False) %}
|
||||
<span class="heading-medium">{{ channel.title() }}</span>
|
||||
{% endcall %}
|
||||
|
||||
{% call field(align='right', border=False) %}
|
||||
{{ big_number(data[channel]['sending'], smaller=True) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call field(align='right', border=False) %}
|
||||
{{ big_number(data[channel]['delivered'], smaller=True) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call field(align='right', status='error' if data[channel]['failed'], border=False) %}
|
||||
{{ big_number(data[channel]['failed'], smaller=True) }}
|
||||
{% endcall %}
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro services_table(services, caption) %}
|
||||
{% call(item, row_number) mapping_table(
|
||||
caption=caption,
|
||||
caption_visible=True,
|
||||
field_headings=[
|
||||
'Service',
|
||||
hidden_field_heading('Type'),
|
||||
right_aligned_field_heading('Sending'),
|
||||
right_aligned_field_heading('Delivered'),
|
||||
right_aligned_field_heading('Failed')
|
||||
],
|
||||
field_headings_visible=True
|
||||
) %}
|
||||
|
||||
{% for service in services %}
|
||||
|
||||
{% call row_group() %}
|
||||
|
||||
{% call row() %}
|
||||
{% call field(border=False) %}
|
||||
<a href="{{ url_for('main.service_dashboard', service_id=service['id']) }}" class="browse-list-link">{{ service['name'] }}</a>
|
||||
{% endcall %}
|
||||
|
||||
{{ stats_fields('email', service['stats']) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call row() %}
|
||||
{% if not service['active'] %}
|
||||
{% call field(status='default') %}
|
||||
<span class="heading-medium">archived</span>
|
||||
{% endcall %}
|
||||
{% elif service['research_mode'] %}
|
||||
{% call field(border=False) %}
|
||||
<span class="research-mode">research mode</span>
|
||||
{% endcall %}
|
||||
{% elif not service['restricted'] %}
|
||||
{% call field(status='error') %}
|
||||
<span class="heading-medium">Live</span>
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{{ text_field('') }}
|
||||
{% endif %}
|
||||
|
||||
{{ stats_fields('sms', service['stats']) }}
|
||||
{% endcall %}
|
||||
|
||||
{% endcall %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endcall %}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% block per_page_title %}
|
||||
Platform admin
|
||||
{% endblock %}
|
||||
@@ -98,8 +24,4 @@
|
||||
|
||||
{% include "views/platform-admin/_global_stats.html" %}
|
||||
|
||||
{{ services_table(live_services, 'Live services') }}
|
||||
|
||||
{{ services_table(trial_mode_services, 'Trial mode services') }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user