From defa93809a901cef8bf06a4a9eb8b314e96075a0 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Fri, 4 Nov 2016 16:27:27 +0000 Subject: [PATCH] show archived label on platform admin page, and sort last --- app/main/views/platform_admin.py | 13 +++++++------ app/templates/views/platform-admin.html | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/main/views/platform_admin.py b/app/main/views/platform_admin.py index 7c883d7e9..74c9ef3be 100644 --- a/app/main/views/platform_admin.py +++ b/app/main/views/platform_admin.py @@ -20,7 +20,7 @@ def platform_admin(): 'views/platform-admin.html', **get_statistics(sorted( services, - key=lambda service: service['created_at'], + key=lambda service: (service['active'], service['created_at']), reverse=True )) ) @@ -29,12 +29,12 @@ def platform_admin(): def get_statistics(services): return { 'global_stats': create_global_stats(services), - 'live_services': format_stats_by_service([ + 'live_services': format_stats_by_service( service for service in services if not service['restricted'] - ]), - 'trial_mode_services': format_stats_by_service([ + ), + 'trial_mode_services': format_stats_by_service( service for service in services if service['restricted'] - ]), + ), } @@ -72,5 +72,6 @@ def format_stats_by_service(services): 'failed': sum(stat['failed'] for stat in stats), 'restricted': service['restricted'], 'research_mode': service['research_mode'], - 'created_at': service['created_at'] + 'created_at': service['created_at'], + 'active': service['active'] } diff --git a/app/templates/views/platform-admin.html b/app/templates/views/platform-admin.html index 38902bc7d..bc5ecbbe6 100644 --- a/app/templates/views/platform-admin.html +++ b/app/templates/views/platform-admin.html @@ -23,7 +23,11 @@ {{ item['name'] }} {% endcall %} - {% if item['research_mode'] %} + {% if not item['active'] %} + {% call field(status='default') %} + archived + {% endcall %} + {% elif item['research_mode'] %} {% call field() %} research mode {% endcall %}