mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
added download url and stat count in table
This commit is contained in:
@@ -464,7 +464,7 @@ td.table-empty-message {
|
|||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
td.time-sent {
|
td.time-sent {
|
||||||
width: 30%;
|
width: 14%;
|
||||||
}
|
}
|
||||||
td.sender {
|
td.sender {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
@@ -474,12 +474,20 @@ td.table-empty-message {
|
|||||||
width: 5%;
|
width: 5%;
|
||||||
}
|
}
|
||||||
td.report {
|
td.report {
|
||||||
width: 5%;
|
width: 2%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
td.delivered {
|
||||||
|
width: 2%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
td.failed {
|
||||||
|
width: 2%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
td.report img {
|
td.report img {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
th {
|
th {
|
||||||
padding: 0.5rem 1rem
|
padding: 0.5rem 1rem
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ from app.utils.user import user_has_permissions
|
|||||||
|
|
||||||
|
|
||||||
@main.route("/activity/services/<uuid:service_id>")
|
@main.route("/activity/services/<uuid:service_id>")
|
||||||
@user_has_permissions()
|
@user_has_permissions("view_activity")
|
||||||
def all_jobs_activity(service_id):
|
def all_jobs_activity(service_id):
|
||||||
service_data_retention_days = 7
|
service_data_retention_days = 7
|
||||||
page = get_page_from_request()
|
page = get_page_from_request()
|
||||||
jobs = job_api_client.get_page_of_jobs(service_id, page=page)
|
jobs = job_api_client.get_page_of_jobs(service_id, page=page)
|
||||||
all_jobs_dict = generate_job_dict(jobs)
|
all_jobs_dict = generate_job_dict(jobs)
|
||||||
prev_page, next_page, pagination = handle_pagination(jobs, service_id, page)
|
prev_page, next_page, pagination = handle_pagination(jobs, service_id, page)
|
||||||
|
message_type='sms',
|
||||||
return render_template(
|
return render_template(
|
||||||
"views/activity/all-activity.html",
|
"views/activity/all-activity.html",
|
||||||
all_jobs_dict=all_jobs_dict,
|
all_jobs_dict=all_jobs_dict,
|
||||||
@@ -28,6 +28,27 @@ def all_jobs_activity(service_id):
|
|||||||
next_page=next_page,
|
next_page=next_page,
|
||||||
prev_page=prev_page,
|
prev_page=prev_page,
|
||||||
pagination=pagination,
|
pagination=pagination,
|
||||||
|
download_link_one_day=url_for(
|
||||||
|
".download_notifications_csv",
|
||||||
|
service_id=current_service.id,
|
||||||
|
message_type=message_type,
|
||||||
|
status=request.args.get("status"),
|
||||||
|
number_of_days="one_day",
|
||||||
|
),
|
||||||
|
download_link_five_day=url_for(
|
||||||
|
".download_notifications_csv",
|
||||||
|
service_id=current_service.id,
|
||||||
|
message_type=message_type,
|
||||||
|
status=request.args.get("status"),
|
||||||
|
number_of_days="five_day",
|
||||||
|
),
|
||||||
|
download_link_seven_day=url_for(
|
||||||
|
".download_notifications_csv",
|
||||||
|
service_id=current_service.id,
|
||||||
|
message_type=message_type,
|
||||||
|
status=request.args.get("status"),
|
||||||
|
number_of_days="seven_day",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -75,6 +96,14 @@ def generate_job_dict(jobs):
|
|||||||
"processing_started": job["processing_started"],
|
"processing_started": job["processing_started"],
|
||||||
"created_by": job["created_by"],
|
"created_by": job["created_by"],
|
||||||
"template_name": job["template_name"],
|
"template_name": job["template_name"],
|
||||||
|
"delivered_count": next(
|
||||||
|
(stat["count"] for stat in job["statistics"] if stat["status"] == "delivered"),
|
||||||
|
None
|
||||||
|
),
|
||||||
|
"failed_count": next(
|
||||||
|
(stat["count"] for stat in job["statistics"] if stat["status"] == "failed"),
|
||||||
|
None
|
||||||
|
),
|
||||||
}
|
}
|
||||||
for job in jobs["data"]
|
for job in jobs["data"]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -84,6 +84,12 @@
|
|||||||
<th data-sortable scope="col" role="columnheader" class="table-field-heading">
|
<th data-sortable scope="col" role="columnheader" class="table-field-heading">
|
||||||
<span>Report</span>
|
<span>Report</span>
|
||||||
</th>
|
</th>
|
||||||
|
<th data-sortable scope="col" role="columnheader" class="table-field-heading">
|
||||||
|
<span>Delivered</span>
|
||||||
|
</th>
|
||||||
|
<th data-sortable scope="col" role="columnheader" class="table-field-heading">
|
||||||
|
<span>Failed</span>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -108,6 +114,8 @@
|
|||||||
<span>N/A</span>
|
<span>N/A</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="table-field delivered">{{ job.delivered_count if job.delivered_count is not none else '' }}</td>
|
||||||
|
<td class="table-field failed">{{ job.failed_count if job.failed_count is not none else '' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -121,6 +129,17 @@
|
|||||||
<p><b>Note: </b>Report data is only available for 7 days after your message has been sent</p>
|
<p><b>Note: </b>Report data is only available for 7 days after your message has been sent</p>
|
||||||
</div>
|
</div>
|
||||||
{{show_pagination}}
|
{{show_pagination}}
|
||||||
|
{% if current_user.has_permissions('view_activity') %}
|
||||||
|
<h2 class="line-height-sans-2 margin-bottom-0 margin-top-4">Download recent reports</h2>
|
||||||
|
<p class="font-body-sm">
|
||||||
|
<a href="{{ download_link_one_day }}" download="download" class="usa-link">Download all data last 24 hours (<abbr title="Comma separated values">CSV</abbr>)</a>
|
||||||
|
</p>
|
||||||
|
<p class="font-body-sm">
|
||||||
|
<a href="{{ download_link_five_day }}" download="download" class="usa-link">Download all data last 5 days (<abbr title="Comma separated values">CSV</abbr>)</a>
|
||||||
|
</p>
|
||||||
|
<p class="font-body-sm">
|
||||||
|
<a href="{{ download_link_seven_day }}" download="download" class="usa-link">Download all data last 7 days (<abbr title="Comma separated values">CSV</abbr>)</a>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user