mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-21 10:54:49 -05:00
Indicate template on scheduled jobs
We’ve removed the template on the jobs page, so you can no longer see which template a job is about to be sent with. This is removing information which might enable you to undo a costly mistake. I don’t think we need to bring back the whole template – giving its name, and a link to it meets the need just as well.
This commit is contained in:
@@ -350,6 +350,11 @@ def get_job_partials(job):
|
||||
notifications = notification_api_client.get_notifications_for_service(
|
||||
job['service'], job['id'], status=filter_args['status']
|
||||
)
|
||||
template = service_api_client.get_service_template(
|
||||
service_id=current_service['id'],
|
||||
template_id=job['template'],
|
||||
version=job['template_version']
|
||||
)['data']
|
||||
return {
|
||||
'counts': render_template(
|
||||
'partials/count.html',
|
||||
@@ -369,7 +374,9 @@ def get_job_partials(job):
|
||||
),
|
||||
help=get_help_argument(),
|
||||
time_left=get_time_left(job['created_at']),
|
||||
job=job
|
||||
job=job,
|
||||
template=template,
|
||||
template_version=job['template_version'],
|
||||
),
|
||||
'status': render_template(
|
||||
'partials/jobs/status.html',
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
{% if job.job_status == 'scheduled' %}
|
||||
|
||||
<p>
|
||||
Sending will start {{ job.scheduled_for|format_datetime_relative }}
|
||||
Sending
|
||||
<a href="{{ url_for('.view_template_version', service_id=current_service.id, template_id=template.id, version=template_version) }}">{{ template.name }}</a>
|
||||
{{ job.scheduled_for|format_datetime_relative }}
|
||||
</p>
|
||||
<div class="page-footer">
|
||||
<form method="post">
|
||||
|
||||
@@ -182,7 +182,7 @@ def job_json(
|
||||
if job_id is None:
|
||||
job_id = str(generate_uuid())
|
||||
if template_id is None:
|
||||
template_id = str(generate_uuid())
|
||||
template_id = "5d729fbd-239c-44ab-b498-75a985f3198f"
|
||||
if created_at is None:
|
||||
created_at = str(datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f%z'))
|
||||
data = {
|
||||
|
||||
@@ -8,6 +8,7 @@ from bs4 import BeautifulSoup
|
||||
|
||||
from app.main.views.jobs import get_time_left, get_status_filters
|
||||
from tests import notification_json
|
||||
from tests.app.test_utils import normalize_spaces
|
||||
from tests.conftest import SERVICE_ONE_ID
|
||||
from freezegun import freeze_time
|
||||
|
||||
@@ -161,7 +162,6 @@ def test_should_show_job_in_progress(
|
||||
@freeze_time("2016-01-01T00:00:00.061258")
|
||||
def test_should_show_scheduled_job(
|
||||
logged_in_client,
|
||||
service_one,
|
||||
active_user_with_permissions,
|
||||
mock_get_service_template,
|
||||
mock_get_scheduled_job,
|
||||
@@ -171,13 +171,21 @@ def test_should_show_scheduled_job(
|
||||
):
|
||||
response = logged_in_client.get(url_for(
|
||||
'main.view_job',
|
||||
service_id=service_one['id'],
|
||||
service_id=SERVICE_ONE_ID,
|
||||
job_id=fake_uuid
|
||||
))
|
||||
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.find('main').find_all('p')[1].text.strip() == 'Sending will start today at midnight'
|
||||
assert normalize_spaces(page.select('main p')[1].text) == (
|
||||
'Sending Two week reminder today at midnight'
|
||||
)
|
||||
assert page.select('main p a')[0]['href'] == url_for(
|
||||
'main.view_template_version',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_id='5d729fbd-239c-44ab-b498-75a985f3198f',
|
||||
version=1,
|
||||
)
|
||||
assert page.find('input', {'type': 'submit', 'value': 'Cancel sending'})
|
||||
|
||||
|
||||
@@ -254,6 +262,7 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
service_one,
|
||||
active_user_with_permissions,
|
||||
mock_get_notifications,
|
||||
mock_get_service_template,
|
||||
mock_get_job,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
|
||||
Reference in New Issue
Block a user