mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
update table css and format
This commit is contained in:
@@ -377,6 +377,15 @@ td.table-empty-message {
|
||||
}
|
||||
}
|
||||
|
||||
.job-table {
|
||||
.usa-table {
|
||||
thead th {
|
||||
background-color: #d9e8f6;
|
||||
color: #1b1b1b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#template-list {
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -29,7 +29,7 @@ from app.utils.csv import Spreadsheet
|
||||
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
||||
from app.utils.time import get_current_financial_year
|
||||
from app.utils.user import user_has_permissions
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
@main.route("/services/<uuid:service_id>/dashboard")
|
||||
@user_has_permissions("view_activity", "send_messages")
|
||||
@@ -47,55 +47,29 @@ def service_dashboard(service_id):
|
||||
if not current_user.has_permissions("view_activity"):
|
||||
return redirect(url_for("main.choose_template", service_id=service_id))
|
||||
|
||||
download_availability = []
|
||||
|
||||
notifications = notification_api_client.get_notifications_for_service(
|
||||
service_id=service_id,
|
||||
)["notifications"]
|
||||
|
||||
notificaton_job_ids = [
|
||||
notification["job"]["id"]
|
||||
for notification in notifications
|
||||
if "job" in notification
|
||||
]
|
||||
job_response = job_api_client.get_jobs(service_id)
|
||||
|
||||
jobs = []
|
||||
|
||||
for notificaton_job_id in notificaton_job_ids:
|
||||
job_data = job_api_client.get_job(service_id, notificaton_job_id)["data"]
|
||||
if job_data:
|
||||
jobs.append(job_data)
|
||||
service_data_retention_days = 7
|
||||
download_availability = []
|
||||
for job in jobs:
|
||||
message_type = job.get("template_type")
|
||||
if message_type is not None:
|
||||
service_data_retention_days = current_service.get_days_of_retention(
|
||||
message_type
|
||||
)
|
||||
time_left = get_time_left(job["created_at"])
|
||||
download_link = (
|
||||
url_for(
|
||||
".view_job_csv",
|
||||
service_id=current_service.id,
|
||||
job_id=job["id"],
|
||||
),
|
||||
)
|
||||
|
||||
download_availability.append(
|
||||
{
|
||||
jobs = []
|
||||
for job in job_response['data']:
|
||||
job_info = {
|
||||
"job_id": job["id"],
|
||||
"time_left": time_left,
|
||||
"download_link": download_link,
|
||||
"time_left": get_time_left(job["created_at"]),
|
||||
"download_link": url_for(".view_job_csv", service_id=current_service.id, job_id=job["id"]),
|
||||
"notification_count": job["notification_count"],
|
||||
}
|
||||
)
|
||||
}
|
||||
jobs.append(job_info)
|
||||
return render_template(
|
||||
"views/dashboard/dashboard.html",
|
||||
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
||||
partials=get_dashboard_partials(service_id),
|
||||
notifications=notifications,
|
||||
download_availability=download_availability,
|
||||
jobs=jobs,
|
||||
job_response = job_response,
|
||||
service_data_retention_days=service_data_retention_days,
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||
|
||||
<h2 class="margin-top-4 margin-bottom-1">Recent Batches</h2>
|
||||
|
||||
<div class='job-table'>
|
||||
{% call(item, row_number) list_table(
|
||||
notifications,
|
||||
@@ -38,10 +37,9 @@
|
||||
caption_visible=False,
|
||||
border_visible=True,
|
||||
empty_message='No batched job messages found  (messages are kept for {} days)'.format(service_data_retention_days)|safe,
|
||||
field_headings=['File Name','Template','Time Sent', 'Sender', '# of Recipeints'],
|
||||
field_headings=['File Name','Template','Time Sent', 'Sender', '# of Recipeints', "Report"],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
{{ download_availability }}
|
||||
{% if item.job.original_file_name and item.job.id and item.template %}
|
||||
{% call row_heading() %}
|
||||
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name if item.job.id else '' }}</a>
|
||||
@@ -58,11 +56,19 @@
|
||||
{% call row_heading() %}
|
||||
{{ item.created_by.name }}
|
||||
{% endcall %}
|
||||
{% set availability = jobs|selectattr('job_id', 'equalto', item.job.id)|first %}
|
||||
{% call row_heading() %}
|
||||
{% set availability = download_availability|selectattr('job_id', 'equalto', item.job.id)|first %}
|
||||
{% if availability %}
|
||||
{{ availability.notification_count}}
|
||||
{% endif %}
|
||||
{% if availability %}
|
||||
{{ availability.notification_count}}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% call row_heading() %}
|
||||
{% if availability and availability.time_left != "Data no longer available" %}
|
||||
<a class="usa-link file-list-filename" href="{{ availability.download_link[0] }}">{{ "Download" if item.job.original_file_name else '' }}</a>
|
||||
<span class="usa-hint">{{ availability.time_left }}</span>
|
||||
{% elif availability %}
|
||||
<span>{{ availability.time_left }}</span>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
|
||||
Reference in New Issue
Block a user