mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Merge pull request #2127 from alphagov/download-activity
Add the download activity link for notifications
This commit is contained in:
@@ -7,6 +7,7 @@ from datetime import datetime
|
|||||||
from flask import (
|
from flask import (
|
||||||
Response,
|
Response,
|
||||||
abort,
|
abort,
|
||||||
|
current_app,
|
||||||
jsonify,
|
jsonify,
|
||||||
render_template,
|
render_template,
|
||||||
request,
|
request,
|
||||||
@@ -178,7 +179,8 @@ def download_notifications_csv(service_id):
|
|||||||
page=request.args.get('page', 1),
|
page=request.args.get('page', 1),
|
||||||
page_size=5000,
|
page_size=5000,
|
||||||
format_for_csv=True,
|
format_for_csv=True,
|
||||||
template_type=filter_args.get('message_type')
|
template_type=filter_args.get('message_type'),
|
||||||
|
limit_days=current_app.config['ACTIVITY_STATS_LIMIT_DAYS'],
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
mimetype='text/csv',
|
mimetype='text/csv',
|
||||||
|
|||||||
@@ -47,6 +47,11 @@
|
|||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<p class="bottom-gutter">
|
||||||
|
<a href="{{ download_link }}" download="download" class="heading-small">Download this report</a>
|
||||||
|
 
|
||||||
|
Data available for 7 days
|
||||||
|
</p>
|
||||||
{{ ajax_block(
|
{{ ajax_block(
|
||||||
partials,
|
partials,
|
||||||
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
|
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
|
||||||
|
|||||||
+5
-6
@@ -149,13 +149,12 @@ def generate_notifications_csv(**kwargs):
|
|||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
values = [
|
values = [
|
||||||
notification['to'],
|
notification['recipient'],
|
||||||
notification['template']['name'],
|
notification['template_name'],
|
||||||
notification['template']['template_type'],
|
notification['template_type'],
|
||||||
notification.get('job_name', None),
|
notification['job_name'],
|
||||||
notification['status'],
|
notification['status'],
|
||||||
notification['created_at'],
|
notification['created_at']
|
||||||
notification['updated_at']
|
|
||||||
]
|
]
|
||||||
yield Spreadsheet.from_rows([map(str, values)]).as_csv_data
|
yield Spreadsheet.from_rows([map(str, values)]).as_csv_data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user