mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
Split the JSON responses into one key per section
Previously, the AJAX update for the dashboard was returning a big blob of JSON with one key. This commit splits it up to return: - one key for each section of the page - each containing a smaller chunk of HTML rendered from a partial The jobs page was already working this way (pretty much) but just needed a little tweaking to get it the same.
This commit is contained in:
@@ -57,11 +57,24 @@ def service_dashboard(service_id):
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def service_dashboard_updates(service_id):
|
||||
dashboard_statistics = get_dashboard_statistics_for_service(service_id)
|
||||
return jsonify(**{
|
||||
'today': render_template(
|
||||
'views/dashboard/today.html',
|
||||
**get_dashboard_statistics_for_service(service_id)
|
||||
)
|
||||
'totals': render_template(
|
||||
'views/dashboard/_totals.html',
|
||||
**dashboard_statistics
|
||||
),
|
||||
'template-statistics': render_template(
|
||||
'views/dashboard/template-statistics.html',
|
||||
**dashboard_statistics
|
||||
),
|
||||
'jobs': render_template(
|
||||
'views/dashboard/_jobs.html',
|
||||
**dashboard_statistics
|
||||
),
|
||||
'usage': render_template(
|
||||
'views/dashboard/_usage.html',
|
||||
**dashboard_statistics
|
||||
),
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user