mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
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:
@@ -15,6 +15,7 @@ from app.main.views import ( # noqa isort:skip
|
|||||||
find_services,
|
find_services,
|
||||||
find_users,
|
find_users,
|
||||||
forgot_password,
|
forgot_password,
|
||||||
|
history,
|
||||||
inbound_number,
|
inbound_number,
|
||||||
index,
|
index,
|
||||||
invites,
|
invites,
|
||||||
|
|||||||
@@ -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")
|
@main.route("/services/<service_id>/dashboard")
|
||||||
@user_has_permissions('view_activity', 'send_messages')
|
@user_has_permissions('view_activity', 'send_messages')
|
||||||
def old_service_dashboard(service_id):
|
def old_service_dashboard(service_id):
|
||||||
|
|||||||
17
app/main/views/history.py
Normal file
17
app/main/views/history.py
Normal 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']
|
||||||
|
)
|
||||||
@@ -631,3 +631,7 @@ class Service(JSONModel):
|
|||||||
):
|
):
|
||||||
if test:
|
if test:
|
||||||
yield BASE + '_incomplete' + tag
|
yield BASE + '_incomplete' + tag
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def history(self):
|
||||||
|
return service_api_client.get_service_history(self.id)['data']
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ class HeaderNavigation(Navigation):
|
|||||||
'get_example_csv',
|
'get_example_csv',
|
||||||
'get_notifications_as_json',
|
'get_notifications_as_json',
|
||||||
'go_to_dashboard_after_tour',
|
'go_to_dashboard_after_tour',
|
||||||
|
'history',
|
||||||
'inbound_sms_admin',
|
'inbound_sms_admin',
|
||||||
'inbox',
|
'inbox',
|
||||||
'inbox_download',
|
'inbox_download',
|
||||||
@@ -301,7 +302,6 @@ class HeaderNavigation(Navigation):
|
|||||||
'start_tour',
|
'start_tour',
|
||||||
'styleguide',
|
'styleguide',
|
||||||
'submit_request_to_go_live',
|
'submit_request_to_go_live',
|
||||||
'temp_service_history',
|
|
||||||
'template_history',
|
'template_history',
|
||||||
'template_usage',
|
'template_usage',
|
||||||
'trial_mode',
|
'trial_mode',
|
||||||
@@ -505,6 +505,7 @@ class MainNavigation(Navigation):
|
|||||||
'get_example_csv',
|
'get_example_csv',
|
||||||
'get_notifications_as_json',
|
'get_notifications_as_json',
|
||||||
'go_to_dashboard_after_tour',
|
'go_to_dashboard_after_tour',
|
||||||
|
'history',
|
||||||
'how_to_pay',
|
'how_to_pay',
|
||||||
'inbound_sms_admin',
|
'inbound_sms_admin',
|
||||||
'inbox_download',
|
'inbox_download',
|
||||||
@@ -577,7 +578,6 @@ class MainNavigation(Navigation):
|
|||||||
'styleguide',
|
'styleguide',
|
||||||
'support',
|
'support',
|
||||||
'suspend_service',
|
'suspend_service',
|
||||||
'temp_service_history',
|
|
||||||
'template_history',
|
'template_history',
|
||||||
'terms',
|
'terms',
|
||||||
'thanks',
|
'thanks',
|
||||||
@@ -729,6 +729,7 @@ class CaseworkNavigation(Navigation):
|
|||||||
'get_example_csv',
|
'get_example_csv',
|
||||||
'get_notifications_as_json',
|
'get_notifications_as_json',
|
||||||
'go_to_dashboard_after_tour',
|
'go_to_dashboard_after_tour',
|
||||||
|
'history',
|
||||||
'how_to_pay',
|
'how_to_pay',
|
||||||
'inbound_sms_admin',
|
'inbound_sms_admin',
|
||||||
'inbox_download',
|
'inbox_download',
|
||||||
@@ -854,7 +855,6 @@ class CaseworkNavigation(Navigation):
|
|||||||
'submit_request_to_go_live',
|
'submit_request_to_go_live',
|
||||||
'support',
|
'support',
|
||||||
'suspend_service',
|
'suspend_service',
|
||||||
'temp_service_history',
|
|
||||||
'template_history',
|
'template_history',
|
||||||
'template_usage',
|
'template_usage',
|
||||||
'terms',
|
'terms',
|
||||||
@@ -1016,6 +1016,7 @@ class OrgNavigation(Navigation):
|
|||||||
'get_example_csv',
|
'get_example_csv',
|
||||||
'get_notifications_as_json',
|
'get_notifications_as_json',
|
||||||
'go_to_dashboard_after_tour',
|
'go_to_dashboard_after_tour',
|
||||||
|
'history',
|
||||||
'how_to_pay',
|
'how_to_pay',
|
||||||
'inbound_sms_admin',
|
'inbound_sms_admin',
|
||||||
'inbox',
|
'inbox',
|
||||||
@@ -1137,7 +1138,6 @@ class OrgNavigation(Navigation):
|
|||||||
'submit_request_to_go_live',
|
'submit_request_to_go_live',
|
||||||
'support',
|
'support',
|
||||||
'suspend_service',
|
'suspend_service',
|
||||||
'temp_service_history',
|
|
||||||
'template_history',
|
'template_history',
|
||||||
'template_usage',
|
'template_usage',
|
||||||
'terms',
|
'terms',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% extends "withoutnav_template.html" %}
|
{% extends "withnav_template.html" %}
|
||||||
{% from "components/page-footer.html" import page_footer %}
|
{% from "components/page-header.html" import page_header %}
|
||||||
{% from "components/table.html" import list_table, field %}
|
{% from "components/table.html" import list_table, field %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block service_page_title %}
|
||||||
@@ -8,9 +8,7 @@ Service and API key history
|
|||||||
|
|
||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
<h1 class="heading-large">
|
{{ page_header("Service and API key history") }}
|
||||||
{{ "Service and API key history" }}
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
{% call(item, row_number) list_table(
|
{% call(item, row_number) list_table(
|
||||||
|
|||||||
8
tests/app/main/views/test_history.py
Normal file
8
tests/app/main/views/test_history.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from tests.conftest import SERVICE_ONE_ID
|
||||||
|
|
||||||
|
|
||||||
|
def test_history(
|
||||||
|
client_request,
|
||||||
|
mock_get_service_history,
|
||||||
|
):
|
||||||
|
client_request.get('main.history', service_id=SERVICE_ONE_ID)
|
||||||
@@ -3501,3 +3501,12 @@ def mock_get_service_and_organisation_counts(mocker):
|
|||||||
'organisations': 111,
|
'organisations': 111,
|
||||||
'services': 9999,
|
'services': 9999,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='function')
|
||||||
|
def mock_get_service_history(mocker):
|
||||||
|
return mocker.patch('app.service_api_client.get_service_history', return_value={'data': {
|
||||||
|
'service_history': [],
|
||||||
|
'api_key_history': [],
|
||||||
|
'events': [],
|
||||||
|
}})
|
||||||
|
|||||||
Reference in New Issue
Block a user