Merge pull request #3151 from alphagov/history-page-tidy-up

Bring the service history page up to our current coding standards
This commit is contained in:
Chris Hill-Scott
2019-10-22 13:48:16 +01:00
committed by GitHub
8 changed files with 46 additions and 22 deletions

View File

@@ -15,6 +15,7 @@ from app.main.views import ( # noqa isort:skip
find_services,
find_users,
forgot_password,
history,
inbound_number,
index,
invites,

View File

@@ -38,19 +38,6 @@ from app.utils import (
)
# This is a placeholder view method to be replaced
# when product team makes decision about how/what/when
# to view history
@main.route("/services/<service_id>/history")
@user_has_permissions()
def temp_service_history(service_id):
data = service_api_client.get_service_history(service_id)['data']
return render_template('views/temp-history.html',
services=data['service_history'],
api_keys=data['api_key_history'],
events=data['events'])
@main.route("/services/<service_id>/dashboard")
@user_has_permissions('view_activity', 'send_messages')
def old_service_dashboard(service_id):

17
app/main/views/history.py Normal file
View File

@@ -0,0 +1,17 @@
from flask import render_template
from app import current_service
from app.main import main
from app.utils import user_has_permissions
@main.route("/services/<service_id>/history")
@user_has_permissions('manage_service')
def history(service_id):
return render_template(
'views/temp-history.html',
services=current_service.history['service_history'],
api_keys=current_service.history['api_key_history'],
events=current_service.history['events']
)

View File

@@ -631,3 +631,7 @@ class Service(JSONModel):
):
if test:
yield BASE + '_incomplete' + tag
@cached_property
def history(self):
return service_api_client.get_service_history(self.id)['data']

View File

@@ -191,6 +191,7 @@ class HeaderNavigation(Navigation):
'get_example_csv',
'get_notifications_as_json',
'go_to_dashboard_after_tour',
'history',
'inbound_sms_admin',
'inbox',
'inbox_download',
@@ -301,7 +302,6 @@ class HeaderNavigation(Navigation):
'start_tour',
'styleguide',
'submit_request_to_go_live',
'temp_service_history',
'template_history',
'template_usage',
'trial_mode',
@@ -505,6 +505,7 @@ class MainNavigation(Navigation):
'get_example_csv',
'get_notifications_as_json',
'go_to_dashboard_after_tour',
'history',
'how_to_pay',
'inbound_sms_admin',
'inbox_download',
@@ -577,7 +578,6 @@ class MainNavigation(Navigation):
'styleguide',
'support',
'suspend_service',
'temp_service_history',
'template_history',
'terms',
'thanks',
@@ -729,6 +729,7 @@ class CaseworkNavigation(Navigation):
'get_example_csv',
'get_notifications_as_json',
'go_to_dashboard_after_tour',
'history',
'how_to_pay',
'inbound_sms_admin',
'inbox_download',
@@ -854,7 +855,6 @@ class CaseworkNavigation(Navigation):
'submit_request_to_go_live',
'support',
'suspend_service',
'temp_service_history',
'template_history',
'template_usage',
'terms',
@@ -1016,6 +1016,7 @@ class OrgNavigation(Navigation):
'get_example_csv',
'get_notifications_as_json',
'go_to_dashboard_after_tour',
'history',
'how_to_pay',
'inbound_sms_admin',
'inbox',
@@ -1137,7 +1138,6 @@ class OrgNavigation(Navigation):
'submit_request_to_go_live',
'support',
'suspend_service',
'temp_service_history',
'template_history',
'template_usage',
'terms',

View File

@@ -1,5 +1,5 @@
{% extends "withoutnav_template.html" %}
{% from "components/page-footer.html" import page_footer %}
{% extends "withnav_template.html" %}
{% from "components/page-header.html" import page_header %}
{% from "components/table.html" import list_table, field %}
{% block service_page_title %}
@@ -8,9 +8,7 @@ Service and API key history
{% block maincolumn_content %}
<h1 class="heading-large">
{{ "Service and API key history" }}
</h1>
{{ page_header("Service and API key history") }}
<div class="grid-row">
{% call(item, row_number) list_table(