From 8754c03a00542db8071008253aa4ba623c07d080 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 15 Jan 2025 14:28:47 -0800 Subject: [PATCH 01/15] updating job status states --- app/main/views/dashboard.py | 3 ++- app/templates/views/dashboard/dashboard.html | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 8013acb9d..22f702095 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -75,6 +75,7 @@ def service_dashboard(service_id): "created_at": job["created_at"], "processing_finished": job.get("processing_finished"), "processing_started": job.get("processing_started"), + "scheduled_for": job.get("scheduled_for"), "notification_count": job["notification_count"], "created_by": job["created_by"], "template_name": job["template_name"], @@ -87,7 +88,7 @@ def service_dashboard(service_id): "views/dashboard/dashboard.html", updates_url=url_for(".service_dashboard_updates", service_id=service_id), partials=get_dashboard_partials(service_id), - jobs=jobs, + jobs=sorted(jobs, key=lambda job: job["created_at"], reverse=True)[:5], service_data_retention_days=service_data_retention_days, sms_sent=sms_sent, sms_allowance_remaining=sms_allowance_remaining, diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 04abe1afc..5e40d0319 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -113,7 +113,7 @@ {% if jobs %} - {% for job in jobs[:5] %} + {% for job in jobs %} {% set notification = job.notifications[0] %} @@ -122,9 +122,19 @@ {{ job.template_name }} - Sent on - {{ (job.processing_finished if job.processing_finished else job.processing_started - if job.processing_started else job.created_at)|format_datetime_table }} + + {% 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 %} + Created at {{job.created_at|format_datetime_table}} + {% endif %} + {% endif %} {{ job.created_by.name }} {{ job.notification_count }} From c6ed4a8661ccb296ae248c6e190640f46fa48eb5 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 12:05:14 -0800 Subject: [PATCH 02/15] changed pending state --- app/templates/views/dashboard/dashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 5e40d0319..21812a813 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -132,7 +132,7 @@ {% elif job.processing_started %} Sending since {{job.processing_started|format_datetime_table}} {% else %} - Created at {{job.created_at|format_datetime_table}} + Pending since {{job.created_at|format_datetime_table}} {% endif %} {% endif %} From dfe421b3614b5c6893e26da9800ff39282849a98 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 17:33:55 -0800 Subject: [PATCH 03/15] refactor code --- app/assets/javascripts/activityChart.js | 58 ++++++++++++---- app/main/views/dashboard.py | 28 ++------ app/templates/views/dashboard/dashboard.html | 69 +++++--------------- 3 files changed, 65 insertions(+), 90 deletions(-) diff --git a/app/assets/javascripts/activityChart.js b/app/assets/javascripts/activityChart.js index 62c1e6e3e..a3f615c65 100644 --- a/app/assets/javascripts/activityChart.js +++ b/app/assets/javascripts/activityChart.js @@ -1,7 +1,8 @@ (function (window) { if (document.getElementById('activityChartContainer')) { - + const tableContainer = document.getElementById('activityContainer'); + const currentUserName = tableContainer.getAttribute('data-currentUserName'); const COLORS = { delivered: '#0076d6', failed: '#fa9441', @@ -270,27 +271,58 @@ subTitle.textContent = `${selectedText} - last 7 days`; fetchData(selectedValue); - // Update ARIA live region const liveRegion = document.getElementById('aria-live-account'); liveRegion.textContent = `Data updated for ${selectedText} - last 7 days`; - // Switch tables based on dropdown selection - const selectedTable = selectedValue === "individual" ? "table1" : "table2"; - const tables = document.querySelectorAll('.table-overflow-x-auto'); - tables.forEach(function(table) { - table.classList.add('hidden'); // Hide all tables by adding the hidden class - table.classList.remove('visible'); // Ensure they are not visible - }); - const tableToShow = document.getElementById(selectedTable); - tableToShow.classList.remove('hidden'); // Remove hidden class - tableToShow.classList.add('visible'); // Add visible class + const tableHeading = document.querySelector('#tableActivity h2'); + const senderColumns = document.querySelectorAll('.sender-column'); + const allRows = document.querySelectorAll('#activity-table tbody tr'); + const caption = document.querySelector('#activity-table caption'); + + if (selectedValue === 'individual') { + + tableHeading.textContent = 'My activity'; + caption.textContent = `Table showing the sent jobs for ${currentUserName}`; + + senderColumns.forEach(col => { + col.style.display = 'none'; + }); + + allRows.forEach(row => row.style.display = 'none'); + + const userRows = Array.from(allRows).filter(row => { + const senderCell = row.querySelector('.sender-column'); + const rowSender = senderCell ? senderCell.textContent.trim() : ''; + return rowSender === currentUserName; + }); + + userRows.slice(0, 5).forEach(row => { + row.style.display = ''; + }); + } else { + + tableHeading.textContent = 'Service activity'; + caption.textContent = `Table showing the sent jobs for service`; + + senderColumns.forEach(col => { + col.style.display = ''; + }); + + allRows.forEach((row, index) => { + row.style.display = (index < 5) ? '' : 'none'; + }); + } }; document.addEventListener('DOMContentLoaded', function() { // Initialize activityChart chart and table with service data by default fetchData('service'); - // Add event listener to the dropdown + const allRows = Array.from(document.querySelectorAll('#activity-table tbody tr')); + allRows.forEach((row, index) => { + row.style.display = (index < 5) ? '' : 'none'; + }); + const dropdown = document.getElementById('options'); dropdown.addEventListener('change', handleDropdownChange); }); diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 22f702095..af081d645 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -62,36 +62,18 @@ def service_dashboard(service_id): job_response = job_api_client.get_jobs(service_id)["data"] service_data_retention_days = 7 - jobs = [ - { - "job_id": job["id"], - "time_left": get_time_left(job["created_at"]), - "download_link": url_for( - ".view_job_csv", service_id=current_service.id, job_id=job["id"] - ), - "view_job_link": url_for( - ".view_job", service_id=current_service.id, job_id=job["id"] - ), - "created_at": job["created_at"], - "processing_finished": job.get("processing_finished"), - "processing_started": job.get("processing_started"), - "scheduled_for": job.get("scheduled_for"), - "notification_count": job["notification_count"], - "created_by": job["created_by"], - "template_name": job["template_name"], - "original_file_name": job["original_file_name"], - } - for job in job_response - if job["job_status"] != "cancelled" - ] + filtered_jobs = [job for job in job_response if job["job_status"] != "cancelled"] + sorted_jobs = sorted(filtered_jobs, key=lambda job: job["created_at"], reverse=True) + return render_template( "views/dashboard/dashboard.html", updates_url=url_for(".service_dashboard_updates", service_id=service_id), partials=get_dashboard_partials(service_id), - jobs=sorted(jobs, key=lambda job: job["created_at"], reverse=True)[:5], + jobs=sorted_jobs, service_data_retention_days=service_data_retention_days, sms_sent=sms_sent, sms_allowance_remaining=sms_allowance_remaining, + service_id=service_id, ) diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 21812a813..cd2167dcf 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -56,69 +56,30 @@ {% if current_user.has_permissions('manage_service') %}{% endif %} -
- +
+
+

Service activity

+ + + -
-

Service activity

-
Table showing the sent jobs for {{current_service.name}}
- - - - - - + + + + + {% if jobs %} {% for job in jobs %} {% set notification = job.notifications[0] %} - + @@ -136,7 +97,7 @@ {% endif %} {% endif %} - + {% endfor %} From 79e8f02ec66204fd51ef51e398ab4543010dfb9d Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 18:17:27 -0800 Subject: [PATCH 04/15] 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
+
+
+
+
Table showing the sent jobs for this service
Job ID#TemplateJob statusSender# of RecipientsJob ID#TemplateJob statusSender# of Recipients
- - {{ job.job_id[:8] if job.job_id else 'Manually entered number' }} + + {{ job.id[:8] if job.id else 'Manually entered number' }} {{ job.template_name }}{{ job.created_by.name }}{{ job.created_by.name }} {{ job.notification_count }}
+
+
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') }} From 839bd0b3a97646d4ffd5402039d556448243cc69 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 18:20:32 -0800 Subject: [PATCH 05/15] remove service --- app/main/views/dashboard.py | 1 - app/templates/views/dashboard/activity-table.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index af081d645..812586a95 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -73,7 +73,6 @@ def service_dashboard(service_id): service_data_retention_days=service_data_retention_days, sms_sent=sms_sent, sms_allowance_remaining=sms_allowance_remaining, - service_id=service_id, ) diff --git a/app/templates/views/dashboard/activity-table.html b/app/templates/views/dashboard/activity-table.html index cbb7e0c87..7d4c4a07a 100644 --- a/app/templates/views/dashboard/activity-table.html +++ b/app/templates/views/dashboard/activity-table.html @@ -21,7 +21,7 @@ {% set notification = job.notifications[0] %} - + {{ job.id[:8] if job.id else 'Manually entered number' }} From 7422b6160a3cb8785fff2ac5e1ed5738a4e31af4 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 16 Jan 2025 18:22:13 -0800 Subject: [PATCH 06/15] Reformat --- .ds.baseline | 6 +++--- app/main/views/index.py | 8 +------- app/templates/views/dashboard/activity-table.html | 1 - tests/app/main/views/test_index.py | 4 +--- tests/app/main/views/test_register.py | 5 ++--- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.ds.baseline b/.ds.baseline index df4be33a6..d2e47c723 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -555,7 +555,7 @@ "filename": "tests/app/main/views/test_register.py", "hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", "is_verified": false, - "line_number": 200, + "line_number": 199, "is_secret": false }, { @@ -563,7 +563,7 @@ "filename": "tests/app/main/views/test_register.py", "hashed_secret": "bb5b7caa27d005d38039e3797c3ddb9bcd22c3c8", "is_verified": false, - "line_number": 273, + "line_number": 272, "is_secret": false } ], @@ -684,5 +684,5 @@ } ] }, - "generated_at": "2025-01-13T20:16:58Z" + "generated_at": "2025-01-17T02:22:09Z" } diff --git a/app/main/views/index.py b/app/main/views/index.py index e05e72e87..8b63d2bd8 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -32,11 +32,7 @@ def check_feature_flags(): @main.route("/test/feature-flags") def test_feature_flags(): return jsonify( - { - "FEATURE_ABOUT_PAGE_ENABLED": current_app.config[ - "FEATURE_ABOUT_PAGE_ENABLED" - ] - } + {"FEATURE_ABOUT_PAGE_ENABLED": current_app.config["FEATURE_ABOUT_PAGE_ENABLED"]} ) @@ -235,7 +231,6 @@ def contact(): return render_template( "views/contact.html", navigation_links=about_notify_nav(), - ) @@ -268,7 +263,6 @@ def join_notify(): return render_template( "views/join-notify.html", navigation_links=about_notify_nav(), - ) diff --git a/app/templates/views/dashboard/activity-table.html b/app/templates/views/dashboard/activity-table.html index 7d4c4a07a..eec134ebf 100644 --- a/app/templates/views/dashboard/activity-table.html +++ b/app/templates/views/dashboard/activity-table.html @@ -18,7 +18,6 @@ {% if jobs %} {% for job in jobs %} - {% set notification = job.notifications[0] %} diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index db166d21e..eaa913425 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -122,9 +122,7 @@ def test_static_pages(client_request, mock_get_organization_by_domain, view, moc session["user_id"] = None request( _expected_status=302, - _expected_redirect="/sign-in?next={}".format( - url_for("main.{}".format(view)) - ), + _expected_redirect="/sign-in?next={}".format(url_for("main.{}".format(view))), ) diff --git a/tests/app/main/views/test_register.py b/tests/app/main/views/test_register.py index 952aa8211..a55307a2b 100644 --- a/tests/app/main/views/test_register.py +++ b/tests/app/main/views/test_register.py @@ -144,9 +144,8 @@ def test_should_return_200_when_email_is_not_gov_uk( _expected_status=200, ) - assert ( - "Enter a public sector email address." - in normalize_spaces(page.select_one(".usa-error-message").text) + assert "Enter a public sector email address." in normalize_spaces( + page.select_one(".usa-error-message").text ) From 3f1058f9b60543681a0686690935439542ec3fa8 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Fri, 17 Jan 2025 17:03:22 -0800 Subject: [PATCH 07/15] jest testing --- tests/javascripts/activityChart.test.js | 61 ++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/tests/javascripts/activityChart.test.js b/tests/javascripts/activityChart.test.js index 8e3d406ea..427c93ac2 100644 --- a/tests/javascripts/activityChart.test.js +++ b/tests/javascripts/activityChart.test.js @@ -21,7 +21,7 @@ Object.defineProperty(HTMLElement.prototype, 'clientWidth', { beforeAll(done => { // Set up the DOM with the D3 script included document.body.innerHTML = ` -
+
+ + + + `; + + window.currentUserName = "Test User"; + + jest.spyOn(window, 'fetchData').mockImplementation(() => {}); + + const selectElement = document.getElementById('options'); + selectElement.value = 'individual'; + const event = { target: selectElement }; + + window.handleDropdownChange(event); + + expect(document.getElementById('table-heading').textContent).toBe('My activity'); + expect(document.getElementById('caption').textContent).toContain('Test User'); + + document.querySelectorAll('.sender-column').forEach(col => { + expect(col.style.display).toBe('none'); + }); + + const rows = Array.from(document.querySelectorAll('#activity-table tbody tr')); + const visibleRows = rows.filter(row => row.style.display !== 'none'); + expect(visibleRows.length).toBeLessThanOrEqual(5); + visibleRows.forEach(row => { + const sender = row.querySelector('.sender-column').textContent.trim(); + expect(sender).toBe('Test User'); + }); + + window.fetchData.mockRestore(); +}); From b6b110765a2e7b2443776d305f126499c9ed3cfb Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 20 Jan 2025 14:05:15 -0800 Subject: [PATCH 08/15] flake8 and fixing conditionals --- app/main/views/dashboard.py | 2 +- app/templates/views/dashboard/activity-table.html | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 812586a95..1f8cac573 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -14,7 +14,7 @@ from app import ( service_api_client, template_statistics_client, ) -from app.formatters import format_date_numeric, format_datetime_numeric, get_time_left +from app.formatters import format_date_numeric, format_datetime_numeric from app.main import main from app.main.views.user_profile import set_timezone from app.statistics_utils import get_formatted_percentage diff --git a/app/templates/views/dashboard/activity-table.html b/app/templates/views/dashboard/activity-table.html index eec134ebf..5739002e9 100644 --- a/app/templates/views/dashboard/activity-table.html +++ b/app/templates/views/dashboard/activity-table.html @@ -27,16 +27,13 @@ {{ 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}} + Scheduled for {{ job.scheduled_for|format_datetime_table }} + {% elif job.processing_finished and not job.statistics|selectattr('status', 'equalto', 'sending')|list %} + Sent on {{ job.processing_finished|format_datetime_table }} {% elif job.processing_started %} - Sending since {{job.processing_started|format_datetime_table}} + Sending since {{ job.processing_started|format_datetime_table }} {% else %} - Pending since {{job.created_at|format_datetime_table}} - {% endif %} + Pending since {{ job.created_at|format_datetime_table }} {% endif %} {{ job.created_by.name }} From 82230f9e8bc67bf05c30e43f3f02e8c3d74ca6e5 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 20 Jan 2025 14:34:11 -0800 Subject: [PATCH 09/15] fixed testing --- tests/app/main/views/test_dashboard.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 97cf42d68..461888c5c 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -657,9 +657,8 @@ def test_should_show_recent_templates_on_dashboard( ] assert "Total messages" in headers - table_rows = page.find_all("tbody")[0].find_all("tr") - - assert len(table_rows) == 0 + table_rows = page.find_all("tbody")[1].find_all("tr") + assert len(table_rows) == 2 @pytest.mark.parametrize( @@ -1943,7 +1942,6 @@ def test_service_dashboard_shows_batched_jobs( job_table_body = page.find("table", class_="job-table") rows = job_table_body.find_all("tbody")[0].find_all("tr") - - assert len(rows) == 0 + assert len(rows) == 1 assert job_table_body is not None From 7be18729935417c9ed255f7a4ed21ac6b1fe2179 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Mon, 20 Jan 2025 15:21:32 -0800 Subject: [PATCH 10/15] clean up templates --- .../views/dashboard/activity-chart.html | 19 -------- .../views/dashboard/activity-table.html | 20 +++++++++ app/templates/views/dashboard/dashboard.html | 44 +++++++++---------- 3 files changed, 40 insertions(+), 43 deletions(-) delete mode 100644 app/templates/views/dashboard/activity-chart.html diff --git a/app/templates/views/dashboard/activity-chart.html b/app/templates/views/dashboard/activity-chart.html deleted file mode 100644 index b65a7c786..000000000 --- a/app/templates/views/dashboard/activity-chart.html +++ /dev/null @@ -1,19 +0,0 @@ -

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 index 5739002e9..a40840033 100644 --- a/app/templates/views/dashboard/activity-table.html +++ b/app/templates/views/dashboard/activity-table.html @@ -1,3 +1,23 @@ +

Recent activity

+
+
+ + +
+
+
+
{{ current_service.name }} - last 7 days
+
+
+
+
+
+
+

Service activity

diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 92518ed9c..bd19585c3 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -6,42 +6,38 @@ {% from "components/ajax-block.html" import ajax_block %} {% block service_page_title %} - Dashboard + Dashboard {% endblock %} {% block maincolumn_content %} - + -
+
-

Dashboard

- {% if current_user.has_permissions('manage_templates') and not current_service.all_templates %} - {% include 'views/dashboard/write-first-messages.html' %} - {% endif %} +

Dashboard

+{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %} + {% include 'views/dashboard/write-first-messages.html' %} +{% endif %} - {{ ajax_block(partials, updates_url, 'upcoming') }} +{{ ajax_block(partials, updates_url, 'upcoming') }} -

{{ current_service.name }} Dashboard

+

{{ current_service.name }} Dashboard

- {{ ajax_block(partials, updates_url, 'inbox') }} +{{ ajax_block(partials, updates_url, 'inbox') }} -
-

Total messages

- -
-
-
+
+

Total messages

+ +
+
+
- {% include 'views/dashboard/activity-chart.html' %} +{% include 'views/dashboard/activity-table.html' %} -
+{% if current_user.has_permissions('manage_service') %}{% endif %} - {% include 'views/dashboard/activity-table.html' %} - - {% if current_user.has_permissions('manage_service') %}{% endif %} - - {{ ajax_block(partials, updates_url, 'template-statistics') }} -
+{{ ajax_block(partials, updates_url, 'template-statistics') }} +
{% endblock %} From ac79edf6133447f27c86f4da5b2bc0988f265c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sheev=20Dav=C3=A9?= Date: Tue, 21 Jan 2025 12:03:35 -0800 Subject: [PATCH 11/15] Update pull_request_template.md Added a11y checks to PR template --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a87db3fcd..7ffbbc290 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -20,3 +20,8 @@ Please enter a detailed description here. * Consideration 1 * Consideration 2 * Consideration ... + +## A11y Checks (if applicable) + +* Conduct automated tests through [AxeDevTools](https://www.deque.com/axe/devtools/) and [WAVE](https://wave.webaim.org/) +* Review the [Manual Checklist](https://docs.google.com/document/d/192bBXStebdXWtYhZQ73qaWMJhGcuSB1W6c9YBXhWZvc/edit?usp=sharing) From 084a5e37fc13f5a3e7390d1771c85e78548ca8be Mon Sep 17 00:00:00 2001 From: Beverly Nguyen <53159604+heyitsmebev@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:20:44 -0800 Subject: [PATCH 12/15] Revert "Send Message A11Y Audit - Unique IDs and also refactor error message on templates page" --- .../uswds/_uswds-theme-custom-styles.scss | 4 ---- app/main/views/templates.py | 1 - .../components/components/input/template.njk | 4 +--- app/templates/components/form.html | 1 + app/templates/components/textbox.html | 23 ++++++++++--------- app/templates/views/edit-sms-template.html | 7 ++---- app/templates/views/send-test.html | 4 ++-- app/templates/views/templates/template.html | 4 ++++ tests/app/main/views/test_send.py | 2 +- tests/app/main/views/test_tour.py | 2 +- 10 files changed, 24 insertions(+), 28 deletions(-) diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index 7fafb8276..0bb1aab7e 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -1024,7 +1024,3 @@ nav.nav { font-size: units(3); font-weight: bold; } - -.form-control-error { - border: 4px solid #b10e1e -} diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 3a7315db7..5c59e1e7c 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -645,7 +645,6 @@ def edit_service_template(service_id, template_id): return render_template( "views/edit-{}-template.html".format(template["template_type"]), form=form, - errors=form.errors if form.errors else None, template=template, heading_action="Edit", ) diff --git a/app/templates/components/components/input/template.njk b/app/templates/components/components/input/template.njk index 9e2cff08c..7f5634651 100644 --- a/app/templates/components/components/input/template.njk +++ b/app/templates/components/components/input/template.njk @@ -42,7 +42,5 @@ {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %} {%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %} {%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %} - {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%} - {%- if params.required %} required{% endif %} -/> + {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
diff --git a/app/templates/components/form.html b/app/templates/components/form.html index 5875a19a9..17cabc7f0 100644 --- a/app/templates/components/form.html +++ b/app/templates/components/form.html @@ -19,6 +19,7 @@ data-{{ key }}="{{ val }}" {% endif %} {% endfor %} + novalidate > {{ caller() }} diff --git a/app/templates/components/textbox.html b/app/templates/components/textbox.html index e8b6f813d..3e479cbce 100644 --- a/app/templates/components/textbox.html +++ b/app/templates/components/textbox.html @@ -13,13 +13,22 @@ safe_error_message=False, rows=8, extra_form_group_classes='', - placeholder='', - required=None + placeholder='' ) %}
+ {% if field.errors %} + + {% endif %}
{% endif %} - {% if field.errors %} - - Error: - {% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %} - - {% endif %} {% if highlight_placeholders or autosize %} @@ -56,8 +59,6 @@ data_highlight_placeholders='true' if highlight_placeholders else 'false', rows=rows|string, placeholder=placeholder, - aria_describedby=field.name+"-error", - required='required' if required else None, **kwargs ) }} {% if suffix %} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 728b92cd6..97eac73dc 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -29,11 +29,9 @@ {% call form_wrapper() %}
-