show archived label on platform admin page, and sort last

This commit is contained in:
Leo Hemsted
2016-11-04 16:27:27 +00:00
parent 7a48e25dbb
commit defa93809a
2 changed files with 12 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ def platform_admin():
'views/platform-admin.html', 'views/platform-admin.html',
**get_statistics(sorted( **get_statistics(sorted(
services, services,
key=lambda service: service['created_at'], key=lambda service: (service['active'], service['created_at']),
reverse=True reverse=True
)) ))
) )
@@ -29,12 +29,12 @@ def platform_admin():
def get_statistics(services): def get_statistics(services):
return { return {
'global_stats': create_global_stats(services), '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'] 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'] 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), 'failed': sum(stat['failed'] for stat in stats),
'restricted': service['restricted'], 'restricted': service['restricted'],
'research_mode': service['research_mode'], 'research_mode': service['research_mode'],
'created_at': service['created_at'] 'created_at': service['created_at'],
'active': service['active']
} }

View File

@@ -23,7 +23,11 @@
<a href="{{ url_for('main.service_dashboard', service_id=item['id']) }}" class="browse-list-link">{{ item['name'] }}</a> <a href="{{ url_for('main.service_dashboard', service_id=item['id']) }}" class="browse-list-link">{{ item['name'] }}</a>
</div> </div>
{% endcall %} {% endcall %}
{% if item['research_mode'] %} {% if not item['active'] %}
{% call field(status='default') %}
<span class="heading-medium">archived</span>
{% endcall %}
{% elif item['research_mode'] %}
{% call field() %} {% call field() %}
<span class="research-mode">research mode</span> <span class="research-mode">research mode</span>
{% endcall %} {% endcall %}