diff --git a/app/templates/partials/jobs/status.html b/app/templates/partials/jobs/status.html index 07a5fa6967..6572ea5fad 100644 --- a/app/templates/partials/jobs/status.html +++ b/app/templates/partials/jobs/status.html @@ -1,34 +1,52 @@ +{% from "components/table.html" import mapping_table, row, row_heading, text_field, link_field, with context %} +
-

- -

-
- {{ _('Sent by:') }} - {% if job.api_key %} - {{ _("API key '{}'").format(url_for('.api_keys', service_id=current_service.id), job.api_key.name) }} - {% else %} - {{ job.created_by.name }} - {% endif %} -
-
- {{ _('Started:') }} - -
-
- {% if job.api_key %} - {{ _('API request name:')}} - {% else %} - {{ _('Spreadsheet:') }} - {% endif %} - {{ job.original_file_name }} -
-
- - - {% if template_type == "letter" %} -

- {{ letter_print_day }} -

+
+ {% set caption = _("Scheduled messages") %} + + {% call mapping_table( + caption=caption, + field_headings_visible=False, + caption_visible=False, + font_size='table-font-small', + ) %} + + {% call row() %} + {% call row_heading(cell_width="sm:w-1/3") %} + {{ _('Sent by') }} + {% endcall %} + {% if job.api_key %} + {{ text_field(_("API key '{}'").format(url_for('.api_keys', service_id=current_service.id), job.api_key.name)) }} + {% else %} + {{ text_field(job.created_by.name) }} {% endif %} -

+ {% endcall %} + + {% call row() %} + {% call row_heading(cell_width="sm:w-1/3") %} + {{ _('Started') }} + {% endcall %} + {{ text_field(text=job.created_at, date_format="local-datetime-short") }} + {% endcall %} + + {% call row() %} + {% call row_heading(cell_width="sm:w-1/3") %} + {% if job.api_key %} + {{ _('API request name')}} + {% else %} + {{ _('Spreadsheet') }} + {% endif %} + {% endcall %} + {{ text_field(job.original_file_name) }} + {% endcall %} + + {% call row() %} + {% call row_heading(cell_width="sm:w-1/3") %} + {{ _('Template') }} + {% endcall %} + {{ link_field(template.name, url_for('.view_template', service_id=job.service, template_id=template.id)) }} + {% endcall %} + {% endcall %} + +
diff --git a/app/translations/csv/fr.csv b/app/translations/csv/fr.csv index 86e5e83525..0bb35cb814 100644 --- a/app/translations/csv/fr.csv +++ b/app/translations/csv/fr.csv @@ -1823,6 +1823,7 @@ "Try creating {} in a different application","Essayez de créer {} dans une application différente." "Sent by:","Envoyé par :" "Started:","Début :" +"Started","Début" "Spreadsheet:","Feuille de calcul :" "API request name:","Nom de la requête API :" "GC Notify disposed of the information in this report on ","Notification GC a supprimé les renseignements de ce rapport le " diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index e008280b04..4f2eb3b95a 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -186,7 +186,10 @@ def test_should_show_page_for_one_job( ) assert page.h1.text.strip() == "Delivery report" - assert " ".join(page.find("tbody").find("tr").text.split()) == ("6502532222 template content No Delivered 11:10:00.061258") + dashboard_table = page.find_all("table")[1] + assert " ".join(dashboard_table.find("tbody").find("tr").text.split()) == ( + "6502532222 template content No Delivered 11:10:00.061258" + ) assert page.find("div", {"data-key": "notifications"})["data-resource"] == url_for( "main.view_job_updates", service_id=SERVICE_ONE_ID, @@ -204,10 +207,10 @@ def test_should_show_page_for_one_job( assert csv_link.text == "Download this report" assert page.find("time", {"id": "time-left"}).text.split(" ")[0] == "2016-01-09" - assert normalize_spaces(page.select_one("tbody tr").text) == normalize_spaces( + assert normalize_spaces(dashboard_table.select_one("tbody tr").text) == normalize_spaces( "6502532222 " "template content " "No " "Delivered 11:10:00.061258" ) - assert page.select_one("tbody tr a")["href"] == url_for( + assert dashboard_table.select_one("tbody tr a")["href"] == url_for( "main.view_notification", service_id=SERVICE_ONE_ID, notification_id=sample_uuid(), @@ -434,15 +437,13 @@ def test_should_show_job_from_api( service_id=SERVICE_ONE_ID, job_id=fake_uuid, ) + job_info_table = page.find_all("table")[0] - assert ( - normalize_spaces(page.select("div[data-test-id='dr_header'] >div:nth-child(1)")[0].text) - == f"Sent by: API key '{JOB_API_KEY_NAME}'" - ) - assert ( - normalize_spaces(page.select("div[data-test-id='dr_header'] >div:nth-child(2)")[0].text) - == "Started: 2016-01-01T00:00:00.061258+0000" - ) + assert normalize_spaces(job_info_table.select("th")[0].text) == "Sent by" + assert normalize_spaces(job_info_table.select("td")[0].text) == f"API key '{JOB_API_KEY_NAME}'" + + assert normalize_spaces(job_info_table.select("th")[1].text) == "Started" + assert normalize_spaces(job_info_table.select("td")[1].text) == "2016-01-01T00:00:00.061258+0000" # TODO: This test could be migrated to Cypress instead @@ -579,6 +580,7 @@ def test_should_not_show_cancel_link_for_letter_job_if_too_late( @freeze_time("2019-06-20 15:32:00.000001") +@pytest.mark.skip(reason="feature not in use") @pytest.mark.parametrize(" job_status", ["finished", "in progress"]) def test_should_show_cancel_link_for_letter_job( client_request,