mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Only show the filters if they will have an effect
If you never create any API keys we shouldn’t give you the option to see API-related events – it will only confuse things. And since there’s (currently) only one type of event left once you take API key events out of the picture it doesn’t make sense to show the filters at all.
This commit is contained in:
@@ -4,17 +4,21 @@ from flask import render_template, request
|
|||||||
|
|
||||||
from app import current_service, format_date_numeric
|
from app import current_service, format_date_numeric
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.models.event import APIKeyEvents, ServiceEvents
|
from app.models.event import APIKeyEvent, APIKeyEvents, ServiceEvents
|
||||||
from app.utils import user_has_permissions
|
from app.utils import user_has_permissions
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<service_id>/history")
|
@main.route("/services/<service_id>/history")
|
||||||
@user_has_permissions('manage_service')
|
@user_has_permissions('manage_service')
|
||||||
def history(service_id):
|
def history(service_id):
|
||||||
|
|
||||||
|
events = _get_events(current_service.id, request.args.get('selected'))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/temp-history.html',
|
'views/temp-history.html',
|
||||||
days=_chunk_events_by_day(
|
days=_chunk_events_by_day(events),
|
||||||
_get_events(current_service.id, request.args.get('selected'))
|
show_navigation=request.args.get('selected') or any(
|
||||||
|
isinstance(event, APIKeyEvent) for event in events
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,19 @@
|
|||||||
|
|
||||||
{{ page_header("Audit events") }}
|
{{ page_header("Audit events") }}
|
||||||
|
|
||||||
{{ pill(
|
{% if show_navigation %}
|
||||||
[
|
<div class="bottom-gutter">
|
||||||
('All', None, url_for('main.history', service_id=current_service.id), None),
|
{{ pill(
|
||||||
('Service', 'service', url_for('main.history', service_id=current_service.id, selected='service'), None),
|
[
|
||||||
('API keys', 'api', url_for('main.history', service_id=current_service.id, selected='api'), None),
|
('All', None, url_for('main.history', service_id=current_service.id), None),
|
||||||
],
|
('Service settings', 'service', url_for('main.history', service_id=current_service.id, selected='service'), None),
|
||||||
request.args.get('selected'),
|
('API keys', 'api', url_for('main.history', service_id=current_service.id, selected='api'), None),
|
||||||
show_count=False
|
],
|
||||||
) }}
|
request.args.get('selected'),
|
||||||
|
show_count=False
|
||||||
|
) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for day, events in days %}
|
{% for day, events in days %}
|
||||||
<h2 class="heading-small top-gutter">
|
<h2 class="heading-small top-gutter">
|
||||||
|
|||||||
Reference in New Issue
Block a user