mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
moved table to dashboard
This commit is contained in:
@@ -13,6 +13,8 @@ from app import (
|
|||||||
current_service,
|
current_service,
|
||||||
service_api_client,
|
service_api_client,
|
||||||
template_statistics_client,
|
template_statistics_client,
|
||||||
|
format_datetime_short,
|
||||||
|
notification_api_client,
|
||||||
)
|
)
|
||||||
from app.formatters import format_date_numeric, format_datetime_numeric
|
from app.formatters import format_date_numeric, format_datetime_numeric
|
||||||
from app.main import main
|
from app.main import main
|
||||||
@@ -27,6 +29,8 @@ from app.utils.csv import Spreadsheet
|
|||||||
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
||||||
from app.utils.time import get_current_financial_year
|
from app.utils.time import get_current_financial_year
|
||||||
from app.utils.user import user_has_permissions
|
from app.utils.user import user_has_permissions
|
||||||
|
from app.main.views.jobs import get_notifications
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<uuid:service_id>/dashboard")
|
@main.route("/services/<uuid:service_id>/dashboard")
|
||||||
@@ -49,6 +53,7 @@ def service_dashboard(service_id):
|
|||||||
"views/dashboard/dashboard.html",
|
"views/dashboard/dashboard.html",
|
||||||
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
||||||
partials=get_dashboard_partials(service_id),
|
partials=get_dashboard_partials(service_id),
|
||||||
|
batched=get_notifications(service_id, message_type=None),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ def get_notifications(service_id, message_type, status_override=None): # noqa
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"service_data_retention_days": service_data_retention_days,
|
"service_data_retention_days": service_data_retention_days,
|
||||||
|
'batched_data': notifications['notifications'],
|
||||||
"counts": render_template(
|
"counts": render_template(
|
||||||
"views/activity/counts.html",
|
"views/activity/counts.html",
|
||||||
status=request.args.get("status"),
|
status=request.args.get("status"),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="ajax-block-container" id='pill-selected-item'>
|
<div class="ajax-block-container" id='pill-selected-item'>
|
||||||
<!-- Batched Job Table -->
|
<!-- Batched Job Table -->
|
||||||
{% if notifications %}
|
{% if notifications %}
|
||||||
<div class='dashboard-table'>
|
<div class='job-table'>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% call(item, row_number) list_table(
|
{% call(item, row_number) list_table(
|
||||||
notifications,
|
notifications,
|
||||||
@@ -13,15 +13,21 @@
|
|||||||
caption_visible=False,
|
caption_visible=False,
|
||||||
border_visible=True,
|
border_visible=True,
|
||||||
empty_message='No batched job messages found  (messages are kept for {} days)'.format(limit_days)|safe,
|
empty_message='No batched job messages found  (messages are kept for {} days)'.format(limit_days)|safe,
|
||||||
field_headings=['Batched Job', 'Download (CSV) Report'],
|
field_headings=['Template Name','Date/Time', 'Download (CSV) Report'],
|
||||||
field_headings_visible=False
|
field_headings_visible=False
|
||||||
) %}
|
) %}
|
||||||
{% if item.job.original_file_name %}
|
{% if item.job.original_file_name %}
|
||||||
{% call row_heading() %}
|
{% call row_heading() %}
|
||||||
<a class="usa-link" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name|replace('.csv', '') if item.job.id else '' }}</a>
|
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name|replace('.csv', '') if item.job.id else '' }}</a>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% call row_heading() %}
|
{% call row_heading() %}
|
||||||
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}.csv">{{ "Download Report" if item.job.original_file_name else '' }}</a>
|
{{ item.status|format_notification_status_as_time(
|
||||||
|
item.created_at|format_datetime_short,
|
||||||
|
(item.updated_at or item.created_at)|format_datetime_short
|
||||||
|
) }}
|
||||||
|
{% endcall %}
|
||||||
|
{% call row_heading() %}
|
||||||
|
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}.csv">{{ "Download" if item.job.original_file_name else '' }}</a>
|
||||||
<span>- available for {{ limit_days }} days</span>
|
<span>- available for {{ limit_days }} days</span>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "withnav_template.html" %}
|
{% extends "withnav_template.html" %}
|
||||||
|
|
||||||
{% from "components/table.html" import list_table, field, right_aligned_field_heading, hidden_field_heading %}
|
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading, row_heading, notification_status_field, notification_carrier_field, notification_carrier_message_field %}
|
||||||
{% from "components/ajax-block.html" import ajax_block %}
|
{% from "components/ajax-block.html" import ajax_block %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block service_page_title %}
|
||||||
@@ -29,6 +29,48 @@
|
|||||||
|
|
||||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||||
|
|
||||||
|
<h2 class="margin-top-4 margin-bottom-1">Batched Jobs</h2>
|
||||||
|
{% if batched %}
|
||||||
|
<div class='job-table'>
|
||||||
|
{% endif %}
|
||||||
|
{% call(item, row_number) list_table(
|
||||||
|
batched['batched_data'],
|
||||||
|
caption="Batched Jobs",
|
||||||
|
caption_visible=False,
|
||||||
|
border_visible=True,
|
||||||
|
empty_message='No batched job messages found  (messages are kept for {} days)'.format(limit_days)|safe,
|
||||||
|
field_headings=['Template Name','Date/Time', 'Download (CSV) Report'],
|
||||||
|
field_headings_visible=False
|
||||||
|
) %}
|
||||||
|
{% if item.job.original_file_name %}
|
||||||
|
{% call row_heading() %}
|
||||||
|
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}">{{ item.job.original_file_name|replace('.csv', '') if item.job.id else '' }}</a>
|
||||||
|
{% endcall %}
|
||||||
|
{% call row_heading() %}
|
||||||
|
{{ item.status|format_notification_status_as_time(
|
||||||
|
item.created_at|format_datetime_short,
|
||||||
|
(item.updated_at or item.created_at)|format_datetime_short
|
||||||
|
) }}
|
||||||
|
{% endcall %}
|
||||||
|
{% call row_heading() %}
|
||||||
|
<a class="usa-link file-list-filename" href="/services/{{ item.service }}/jobs/{{ item.job.id }}.csv">{{ "Download" if item.job.original_file_name else '' }}</a>
|
||||||
|
<span>- available for {{ service_data_retention_days }} days</span>
|
||||||
|
{% endcall %}
|
||||||
|
{% endif %}
|
||||||
|
{% endcall %}
|
||||||
|
{% if batched %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if show_pagination %}
|
||||||
|
{{ previous_next_navigation(prev_page, next_page) }}
|
||||||
|
{% elif next_page %}
|
||||||
|
<p class="table-show-more-link">
|
||||||
|
Only showing the first 50 messages
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<h2 class="margin-top-4 margin-bottom-1">Usage</h2>
|
<h2 class="margin-top-4 margin-bottom-1">Usage</h2>
|
||||||
<h3 class="margin-bottom-0">Daily</h3>
|
<h3 class="margin-bottom-0">Daily</h3>
|
||||||
<p class="margin-0">Across all services</p>
|
<p class="margin-0">Across all services</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user