mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 23:08:07 -04:00
Count of orgs and live services for platform admin
This makes it consistent that an option which contains more options has
a hint about how many options it contains.
Also adds a formatter to get us ready for 1,000 services 🎉
This commit is contained in:
@@ -345,6 +345,10 @@ def format_delta(date):
|
||||
)
|
||||
|
||||
|
||||
def format_thousands(number):
|
||||
return "{:,.0f}".format(number)
|
||||
|
||||
|
||||
def valid_phone_number(phone_number):
|
||||
try:
|
||||
validate_phone_number(phone_number)
|
||||
@@ -688,6 +692,7 @@ def add_template_filters(application):
|
||||
formatted_list,
|
||||
nl2br,
|
||||
format_phone_number_human_readable,
|
||||
format_thousands,
|
||||
id_safe,
|
||||
]:
|
||||
application.add_template_filter(fn)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from flask import redirect, render_template, session, url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app import status_api_client
|
||||
from app.main import main
|
||||
from app.models.organisation import Organisations
|
||||
from app.utils import PermanentRedirect, user_is_logged_in
|
||||
|
||||
|
||||
@@ -18,9 +20,17 @@ def services_or_dashboard():
|
||||
@main.route("/accounts")
|
||||
@user_is_logged_in
|
||||
def choose_account():
|
||||
org_count, live_service_count = None, None
|
||||
if current_user.platform_admin:
|
||||
org_count, live_service_count = (
|
||||
len(Organisations()),
|
||||
status_api_client.get_count_of_live_services_and_organisations()['services'],
|
||||
)
|
||||
return render_template(
|
||||
'views/choose-account.html',
|
||||
can_add_service=current_user.is_gov_user,
|
||||
org_count=org_count,
|
||||
live_service_count=live_service_count,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@
|
||||
<ul class="column-three-quarters">
|
||||
<li class="browse-list-item">
|
||||
<a href="{{ url_for('.organisations') }}" class="browse-list-link">All organisations</a>
|
||||
<p class="browse-list-hint">
|
||||
{{ org_count|format_thousands }} organisations, {{ live_service_count|format_thousands }} live services
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -120,12 +120,12 @@
|
||||
<div class="grid-row bottom-gutter">
|
||||
<div class="column-half">
|
||||
<h3 class="visually-hidden">Services</h3>
|
||||
<div class="product-page-big-number">{{ counts.services }}</div>
|
||||
<div class="product-page-big-number">{{ counts.services|format_thousands }}</div>
|
||||
services
|
||||
</div>
|
||||
<div class="column-half">
|
||||
<h3 class="visually-hidden">Organisations</h3>
|
||||
<div class="product-page-big-number">{{ counts.organisations }}</div>
|
||||
<div class="product-page-big-number">{{ counts.organisations|format_thousands }}</div>
|
||||
organisations
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user