From 79e8f02ec66204fd51ef51e398ab4543010dfb9d Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 18:17:27 -0800 Subject: [PATCH] refactor code partial --- .../views/dashboard/activity-chart.html | 19 +++++ .../views/dashboard/activity-table.html | 56 ++++++++++++++ app/templates/views/dashboard/dashboard.html | 77 +------------------ 3 files changed, 79 insertions(+), 73 deletions(-) create mode 100644 app/templates/views/dashboard/activity-chart.html create mode 100644 app/templates/views/dashboard/activity-table.html diff --git a/app/templates/views/dashboard/activity-chart.html b/app/templates/views/dashboard/activity-chart.html new file mode 100644 index 000000000..b65a7c786 --- /dev/null +++ b/app/templates/views/dashboard/activity-chart.html @@ -0,0 +1,19 @@ +

Recent activity

+
+
+ + +
+
+
+
{{ current_service.name }} - last 7 days
+
+
+
+
+
+
diff --git a/app/templates/views/dashboard/activity-table.html b/app/templates/views/dashboard/activity-table.html new file mode 100644 index 000000000..cbb7e0c87 --- /dev/null +++ b/app/templates/views/dashboard/activity-table.html @@ -0,0 +1,56 @@ +
+
+

Service activity

+ + + + + + + + + + + + + + + {% if jobs %} + {% for job in jobs %} + {% set notification = job.notifications[0] %} + + + + + + + + {% endfor %} + {% else %} + + + + {% endif %} + +
Table showing the sent jobs for {{current_service.name}}
Job ID#TemplateJob statusSender + # of Recipients
+ + {{ job.id[:8] if job.id else 'Manually entered number' }} + + {{ job.template_name }} + {% if job.scheduled_for and not job.processing_finished %} + Scheduled for + {{ job.scheduled_for|format_datetime_table }} + {% else %} + {% if job.processing_finished %} + Sent on {{job.processing_finished|format_datetime_table}} + {% elif job.processing_started %} + Sending since {{job.processing_started|format_datetime_table}} + {% else %} + Pending since {{job.created_at|format_datetime_table}} + {% endif %} + {% endif %} + {{ job.created_by.name }}{{ job.notification_count }}
No batched job messages found  (messages are + kept for {{ service_data_retention_days }} days).
+
+
diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index cd2167dcf..92518ed9c 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -33,83 +33,14 @@
-

Recent activity

-
-
- - -
-
-
-
{{ current_service.name }} - last 7 days
-
-
-
-
-
-
+ {% include 'views/dashboard/activity-chart.html' %} +
+ {% include 'views/dashboard/activity-table.html' %} + {% if current_user.has_permissions('manage_service') %}{% endif %} -
-
-

Service activity

- - - - - - - - - - - - - - - {% if jobs %} - {% for job in jobs %} - {% set notification = job.notifications[0] %} - - - - - - - - {% endfor %} - {% else %} - - - - {% endif %} - -
Table showing the sent jobs for {{current_service.name}}
Job ID#TemplateJob statusSender# of Recipients
- - {{ job.id[:8] if job.id else 'Manually entered number' }} - - {{ job.template_name }} - {% if job.scheduled_for and not job.processing_finished %} - Scheduled for - {{ job.scheduled_for|format_datetime_table }} - {% else %} - {% if job.processing_finished %} - Sent on {{job.processing_finished|format_datetime_table}} - {% elif job.processing_started %} - Sending since {{job.processing_started|format_datetime_table}} - {% else %} - Pending since {{job.created_at|format_datetime_table}} - {% endif %} - {% endif %} - {{ job.created_by.name }}{{ job.notification_count }}
No batched job messages found  (messages are kept for {{ service_data_retention_days }} days).
-
-
{{ ajax_block(partials, updates_url, 'template-statistics') }}