mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 05:31:44 -04:00
Use new platform-admin page
We had kept the original platform-admin page at `/platform-admin` and created a new page, `/platform-admin-new` for the new platform admin page. Now that the numbers on both pages look ok we no longer need both pages, so can replace the original page.
This commit is contained in:
@@ -28,33 +28,6 @@ ZERO_FAILURE_THRESHOLD = 0
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def platform_admin():
|
||||
form = DateFilterForm(request.args)
|
||||
api_args = {'detailed': True,
|
||||
'only_active': False, # specifically DO get inactive services
|
||||
'include_from_test_key': form.include_from_test_key.data,
|
||||
}
|
||||
|
||||
if form.start_date.data:
|
||||
api_args['start_date'] = form.start_date.data
|
||||
api_args['end_date'] = form.end_date.data or datetime.utcnow().date()
|
||||
|
||||
platform_stats = service_api_client.get_aggregate_platform_stats(api_args)
|
||||
|
||||
for stat in platform_stats.values():
|
||||
stat['failure_rate'] = get_formatted_percentage(stat['failed'], stat['requested'])
|
||||
|
||||
return render_template(
|
||||
'views/platform-admin/index.html',
|
||||
include_from_test_key=form.include_from_test_key.data,
|
||||
form=form,
|
||||
global_stats=platform_stats,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/platform-admin-new")
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def platform_admin_new():
|
||||
form = DateFilterForm(request.args, meta={'csrf': False})
|
||||
api_args = {}
|
||||
|
||||
@@ -68,7 +41,7 @@ def platform_admin_new():
|
||||
number_of_complaints = complaint_api_client.get_complaint_count(api_args)
|
||||
|
||||
return render_template(
|
||||
'views/platform-admin/index_new.html',
|
||||
'views/platform-admin/index.html',
|
||||
form=form,
|
||||
global_stats=make_columns(platform_stats, number_of_complaints)
|
||||
)
|
||||
|
||||
@@ -79,7 +79,6 @@ class HeaderNavigation(Navigation):
|
||||
'live_services',
|
||||
'organisations',
|
||||
'platform_admin',
|
||||
'platform_admin_new',
|
||||
'suspend_service',
|
||||
'trial_services',
|
||||
'update_email_branding',
|
||||
@@ -424,7 +423,6 @@ class MainNavigation(Navigation):
|
||||
'organisation_settings',
|
||||
'organisations',
|
||||
'platform_admin',
|
||||
'platform_admin_new',
|
||||
'platform_admin_list_complaints',
|
||||
'pricing',
|
||||
'privacy',
|
||||
@@ -597,7 +595,6 @@ class CaseworkNavigation(Navigation):
|
||||
'organisation_settings',
|
||||
'organisations',
|
||||
'platform_admin',
|
||||
'platform_admin_new',
|
||||
'platform_admin_list_complaints',
|
||||
'pricing',
|
||||
'privacy',
|
||||
@@ -815,7 +812,6 @@ class OrgNavigation(Navigation):
|
||||
'old_using_notify',
|
||||
'organisations',
|
||||
'platform_admin',
|
||||
'platform_admin_new',
|
||||
'platform_admin_list_complaints',
|
||||
'pricing',
|
||||
'privacy',
|
||||
|
||||
@@ -412,9 +412,6 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
}
|
||||
)
|
||||
|
||||
def get_aggregate_platform_stats(self, params_dict=None):
|
||||
return self.get("/service/platform-stats", params=params_dict)
|
||||
|
||||
def get_sms_senders(self, service_id):
|
||||
return self.get(
|
||||
"/service/{}/sms-sender".format(service_id)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
{% from "components/checkbox.html" import checkbox %}
|
||||
{% 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 %}
|
||||
{% from "components/big-number.html" import big_number_simple %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/status-box.html" import status_box %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Platform admin
|
||||
@@ -14,18 +13,46 @@
|
||||
<h1 class="heading-large">
|
||||
Summary
|
||||
</h1>
|
||||
|
||||
<details>
|
||||
<details {% if form.errors %}open{% endif %}>
|
||||
<summary>Apply filters</summary>
|
||||
<form autocomplete="off" method="get">
|
||||
{{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }}
|
||||
{{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
|
||||
{{ checkbox(form.include_from_test_key) }}
|
||||
</br>
|
||||
<button type="submit" class="button">Filter</button>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
{% include "views/platform-admin/_global_stats.html" %}
|
||||
<div class="grid-row bottom-gutter">
|
||||
{% for noti_type in global_stats %}
|
||||
<div class="column-third">
|
||||
{{ big_number_simple(
|
||||
noti_type.black_box.number,
|
||||
message_count_label(noti_type.black_box.number, noti_type.black_box.notification_type)
|
||||
) }}
|
||||
|
||||
{% for item in noti_type.other_data %}
|
||||
{{ status_box(
|
||||
number=item.number,
|
||||
label=item.label,
|
||||
failing=item.failing,
|
||||
percentage=item.percentage,
|
||||
url=item.url)
|
||||
}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="grid-row bottom-gutter">
|
||||
{% for noti_type in global_stats %}
|
||||
<div class="column-third">
|
||||
<div class="bordered-text-box">
|
||||
<span class="big-number-number">{{ "{:,}".format(noti_type.test_data.number) }}</span>
|
||||
{{ noti_type.test_data.label }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/big-number.html" import big_number_simple %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/status-box.html" import status_box %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Platform admin
|
||||
{% endblock %}
|
||||
|
||||
{% block platform_admin_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
Summary
|
||||
</h1>
|
||||
<details {% if form.errors %}open{% endif %}>
|
||||
<summary>Apply filters</summary>
|
||||
<form autocomplete="off" method="get">
|
||||
{{ textbox(form.start_date, hint="Enter start date in format YYYY-MM-DD") }}
|
||||
{{ textbox(form.end_date, hint="Enter end date in format YYYY-MM-DD") }}
|
||||
</br>
|
||||
<button type="submit" class="button">Filter</button>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
<div class="grid-row bottom-gutter">
|
||||
{% for noti_type in global_stats %}
|
||||
<div class="column-third">
|
||||
{{ big_number_simple(
|
||||
noti_type.black_box.number,
|
||||
message_count_label(noti_type.black_box.number, noti_type.black_box.notification_type)
|
||||
) }}
|
||||
|
||||
{% for item in noti_type.other_data %}
|
||||
{{ status_box(
|
||||
number=item.number,
|
||||
label=item.label,
|
||||
failing=item.failing,
|
||||
percentage=item.percentage,
|
||||
url=item.url)
|
||||
}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="grid-row bottom-gutter">
|
||||
{% for noti_type in global_stats %}
|
||||
<div class="column-third">
|
||||
<div class="bordered-text-box">
|
||||
<span class="big-number-number">{{ "{:,}".format(noti_type.test_data.number) }}</span>
|
||||
{{ noti_type.test_data.label }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user