mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
Make data consistent from dashboard -> job
- adds a table of recent activity to the job page, which is shared by the dashboard page - uses the same filename and message template as the first job shown on the dashboard - sets the time of file uploads/message delivery/message sending to always match ‘just now’
This commit is contained in:
@@ -3,4 +3,6 @@ from flask import Blueprint
|
|||||||
main = Blueprint('main', __name__)
|
main = Blueprint('main', __name__)
|
||||||
|
|
||||||
|
|
||||||
from app.main.views import index, sign_in, register, two_factor, verify, sms, add_service, code_not_received, jobs
|
from app.main.views import (
|
||||||
|
index, sign_in, register, two_factor, verify, sms, add_service, code_not_received, jobs, dashboard
|
||||||
|
)
|
||||||
|
|||||||
62
app/main/views/_jobs.py
Normal file
62
app/main/views/_jobs.py
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
jobs = [
|
||||||
|
{
|
||||||
|
'job': 'Test message 1',
|
||||||
|
'file': 'dispatch_20151114.csv',
|
||||||
|
'time': 'Just now',
|
||||||
|
'status': 'Queued'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Mickey Mouse',
|
||||||
|
'file': 'dispatch_20151117.csv',
|
||||||
|
'time': '5 minutes ago',
|
||||||
|
'status': 'Delivered'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Asdfgg',
|
||||||
|
'file': 'remdinder_monday.csv',
|
||||||
|
'time': '30 minutes ago',
|
||||||
|
'status': 'Failed'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Test message 2',
|
||||||
|
'file': 'appointments_wed.csv',
|
||||||
|
'time': '2 hours ago',
|
||||||
|
'status': 'Delivered'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Reminder file',
|
||||||
|
'file': 'appointments_mon.csv',
|
||||||
|
'time': '11:44 Yesterday',
|
||||||
|
'status': 'Delivered'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Test message 1',
|
||||||
|
'file': 'dispatch_20151114.csv',
|
||||||
|
'time': '20 Jun 2015',
|
||||||
|
'status': 'Queued'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Mickey Mouse',
|
||||||
|
'file': 'dispatch_20151117.csv',
|
||||||
|
'time': '18 Jun 2015',
|
||||||
|
'status': 'Delivered'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Asdfgg',
|
||||||
|
'file': 'remdinder_monday.csv',
|
||||||
|
'time': '11 Jun 2015',
|
||||||
|
'status': 'Failed'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Test message 2',
|
||||||
|
'file': 'appointments_wed.csv',
|
||||||
|
'time': '11 Jun 2015',
|
||||||
|
'status': 'Delivered'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'job': 'Final reminder',
|
||||||
|
'file': 'appointments_mon.csv',
|
||||||
|
'time': '11 Jun 2015',
|
||||||
|
'status': 'Delivered'
|
||||||
|
}
|
||||||
|
]
|
||||||
12
app/main/views/dashboard.py
Normal file
12
app/main/views/dashboard.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from flask import render_template
|
||||||
|
|
||||||
|
from app.main import main
|
||||||
|
|
||||||
|
from ._jobs import jobs
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/dashboard")
|
||||||
|
def dashboard():
|
||||||
|
return render_template(
|
||||||
|
'views/dashboard.html', jobs=jobs
|
||||||
|
)
|
||||||
@@ -24,17 +24,6 @@ def verifymobile():
|
|||||||
return render_template('views/verify-mobile.html')
|
return render_template('views/verify-mobile.html')
|
||||||
|
|
||||||
|
|
||||||
@main.route("/text-not-received-2")
|
|
||||||
def textnotreceived2():
|
|
||||||
return render_template('views/text-not-received-2.html')
|
|
||||||
|
|
||||||
|
|
||||||
@main.route("/dashboard")
|
|
||||||
@login_required
|
|
||||||
def dashboard():
|
|
||||||
return render_template('views/dashboard.html')
|
|
||||||
|
|
||||||
|
|
||||||
@main.route("/send-email")
|
@main.route("/send-email")
|
||||||
def sendemail():
|
def sendemail():
|
||||||
return render_template('views/send-email.html')
|
return render_template('views/send-email.html')
|
||||||
@@ -75,11 +64,6 @@ def apikeys():
|
|||||||
return render_template('views/api-keys.html')
|
return render_template('views/api-keys.html')
|
||||||
|
|
||||||
|
|
||||||
@main.route("/verification-not-received")
|
|
||||||
def verificationnotreceived():
|
|
||||||
return render_template('views/verification-not-received.html')
|
|
||||||
|
|
||||||
|
|
||||||
@main.route("/manage-templates")
|
@main.route("/manage-templates")
|
||||||
def managetemplates():
|
def managetemplates():
|
||||||
return render_template('views/manage-templates.html')
|
return render_template('views/manage-templates.html')
|
||||||
|
|||||||
@@ -1,35 +1,38 @@
|
|||||||
|
import time
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
from app.main import main
|
from app.main import main
|
||||||
|
|
||||||
|
from ._jobs import jobs
|
||||||
|
|
||||||
|
now = time.strftime('%H:%M')
|
||||||
|
|
||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
'phone': '+44 7700 900 579',
|
'phone': '+44 7700 900 579',
|
||||||
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||||
'status': 'Delivered',
|
'status': 'Delivered',
|
||||||
'time': '13:42',
|
'time': now,
|
||||||
'id': '0'
|
'id': '0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'phone': '+44 7700 900 306',
|
'phone': '+44 7700 900 306',
|
||||||
'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||||
'status': 'Delivered',
|
'status': 'Delivered',
|
||||||
'time': '13:42',
|
'time': now,
|
||||||
'id': '1'
|
'id': '1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'phone': '+44 7700 900 454',
|
'phone': '+44 7700 900 454',
|
||||||
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||||
'status': 'Delivered',
|
'status': 'Delivered',
|
||||||
'time': '13:42',
|
'time': now,
|
||||||
'id': '2'
|
'id': '2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'phone': '+44 7700 900 522',
|
'phone': '+44 7700 900 522',
|
||||||
'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa
|
||||||
'status': 'Failed',
|
'status': 'Failed',
|
||||||
'time': '13:42',
|
'time': now,
|
||||||
'id': '3'
|
'id': '3'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -37,7 +40,10 @@ messages = [
|
|||||||
|
|
||||||
@main.route("/jobs")
|
@main.route("/jobs")
|
||||||
def showjobs():
|
def showjobs():
|
||||||
return render_template('views/jobs.html')
|
return render_template(
|
||||||
|
'views/jobs.html',
|
||||||
|
jobs=jobs
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@main.route("/jobs/job")
|
@main.route("/jobs/job")
|
||||||
@@ -55,8 +61,9 @@ def showjob():
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
cost='£0.00',
|
cost='£0.00',
|
||||||
uploaded_file_name='contact-demo.csv',
|
uploaded_file_name='dispatch_20151114.csv',
|
||||||
template_used='Reminder template',
|
uploaded_file_time=now,
|
||||||
|
template_used='Test message 1',
|
||||||
flash_message='We’ve started sending your notifications'
|
flash_message='We’ve started sending your notifications'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,9 +76,9 @@ def shownotification(notification_id):
|
|||||||
message for message in messages if message['id'] == notification_id
|
message for message in messages if message['id'] == notification_id
|
||||||
][0],
|
][0],
|
||||||
history=[
|
history=[
|
||||||
{'time': '13:42', 'status': 'Delivered'},
|
{'time': now, 'status': 'Delivered'},
|
||||||
{'time': '13:42', 'status': 'Received by handset'},
|
{'time': now, 'status': 'Received by handset'},
|
||||||
{'time': '13:42', 'status': 'Accepted by network'},
|
{'time': now, 'status': 'Accepted by network'},
|
||||||
{'time': '13:41', 'status': 'Sent'},
|
{'time': now, 'status': 'Sent'},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,55 +1,35 @@
|
|||||||
{% extends "withnav_template.html" %}
|
{% extends "withnav_template.html" %}
|
||||||
|
{% from "components/table.html" import table, field %}
|
||||||
|
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
GOV.UK Notify | Dashboard
|
GOV.UK Notify | Dashboard
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
<h1 class="heading-xlarge">Dashboard</h1>
|
<h1 class="heading-xlarge">Dashboard</h1>
|
||||||
|
|
||||||
<table>
|
{% call(item) table(
|
||||||
<thead>
|
jobs[:3],
|
||||||
<tr>
|
caption="Recent activity",
|
||||||
<th colspan="4">Recent activity</th>
|
field_headings=['Job', 'File', 'Time', 'Status']
|
||||||
</tr>
|
) %}
|
||||||
</thead>
|
{% call field() %}
|
||||||
<tbody>
|
<a href="{{ url_for('.showjob') }}">{{ item.file }}</a>
|
||||||
<tr>
|
{% endcall %}
|
||||||
<td><a href={{ url_for('.showjob') }}>Test message 1</a></td>
|
{% call field() %}
|
||||||
<td>dispatch_20151114.csv</td>
|
<a href="{{ url_for('.showjob') }}">{{ item.job }}</a>
|
||||||
<td>Just now</td>
|
{% endcall %}
|
||||||
<td>Queued</td>
|
{% call field() %}
|
||||||
</tr>
|
{{ item.time }}
|
||||||
<tr>
|
{% endcall %}
|
||||||
<td><a href={{ url_for('.showjob') }}>Mickey Mouse</a></td>
|
{% call field() %}
|
||||||
<td>dispatch_20151117.csv</td>
|
{{ item.status }}
|
||||||
<td>5 minutes ago</td>
|
{% endcall %}
|
||||||
<td>Delivered</td>
|
{% endcall %}
|
||||||
</tr>
|
<p>
|
||||||
<tr>
|
<a href={{ url_for('.showjobs') }}>See all notifications activity</a>
|
||||||
<td><a href={{ url_for('.showjob') }}>Asdfgg</a></td>
|
</p>
|
||||||
<td>remdinder_monday.csv</td>
|
|
||||||
<td>30 minutes ago</td>
|
|
||||||
<td>Failed</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href={{ url_for('.showjob') }}>Test message 2</a></td>
|
|
||||||
<td>appointments_wed.csv</td>
|
|
||||||
<td>2 hours ago</td>
|
|
||||||
<td>Delivered</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href={{ url_for('.showjob') }}>Reminder file</a></td>
|
|
||||||
<td>+447889887634</td>
|
|
||||||
<td>11:44 - 21 Nov 2015</td>
|
|
||||||
<td>Delivered</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<br/>
|
|
||||||
<p><a href={{ url_for('.showjobs') }}>See all notifications activity</a></p>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ GOV.UK Notify | Notifications activity
|
|||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
<h1 class="heading-large">
|
<h1 class="heading-large">
|
||||||
{{ uploaded_file_name }} sent with {{ template_used }}
|
{{ uploaded_file_name }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
{{ banner(flash_message) }}
|
{{ banner(flash_message) }}
|
||||||
@@ -36,7 +36,7 @@ GOV.UK Notify | Notifications activity
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
You uploaded contact-demo.csv today at 13:42
|
Sent with template <a href="{{ url_for('.edittemplate') }}">{{ template_used }}</a> at {{ uploaded_file_time }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% call(item) table(
|
{% call(item) table(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{% extends "withnav_template.html" %}
|
{% extends "withnav_template.html" %}
|
||||||
|
{% from "components/table.html" import table, field %}
|
||||||
|
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
GOV.UK Notify | Notifications activity
|
GOV.UK Notify | Notifications activity
|
||||||
@@ -8,11 +9,25 @@ GOV.UK Notify | Notifications activity
|
|||||||
|
|
||||||
<h1 class="heading-xlarge">Notifications activity</h1>
|
<h1 class="heading-xlarge">Notifications activity</h1>
|
||||||
|
|
||||||
<p>This page will be where we show the list of jobs that this service has processed</p>
|
{% call(item) table(
|
||||||
|
jobs,
|
||||||
<p>
|
caption="Recent activity",
|
||||||
<a href="jobs/job">view a particular notification job</a>
|
caption_visible=False,
|
||||||
</p>
|
field_headings=['Job', 'File', 'Time', 'Status']
|
||||||
|
) %}
|
||||||
|
{% call field() %}
|
||||||
|
<a href="{{ url_for('.showjob') }}">{{ item.file }}</a>
|
||||||
|
{% endcall %}
|
||||||
|
{% call field() %}
|
||||||
|
<a href="{{ url_for('.showjob') }}">{{ item.job }}</a>
|
||||||
|
{% endcall %}
|
||||||
|
{% call field() %}
|
||||||
|
{{ item.time }}
|
||||||
|
{% endcall %}
|
||||||
|
{% call field() %}
|
||||||
|
{{ item.status }}
|
||||||
|
{% endcall %}
|
||||||
|
{% endcall %}
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
6
tests/app/main/views/test_dashboard.py
Normal file
6
tests/app/main/views/test_dashboard.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
def test_should_show_recent_jobs_on_dashboard(notifications_admin):
|
||||||
|
response = notifications_admin.test_client().get('/dashboard')
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert 'Test message 1' in response.get_data(as_text=True)
|
||||||
|
assert 'Asdfgg' in response.get_data(as_text=True)
|
||||||
@@ -2,14 +2,16 @@ def test_should_return_list_of_all_jobs(notifications_admin):
|
|||||||
response = notifications_admin.test_client().get('/jobs')
|
response = notifications_admin.test_client().get('/jobs')
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert 'This page will be where we show the list of jobs that this service has processed' in response.get_data(as_text=True) # noqa
|
assert 'Test message 1' in response.get_data(as_text=True)
|
||||||
|
assert 'Final reminder' in response.get_data(as_text=True)
|
||||||
|
|
||||||
|
|
||||||
def test_should_show_page_for_one_job(notifications_admin):
|
def test_should_show_page_for_one_job(notifications_admin):
|
||||||
response = notifications_admin.test_client().get('/jobs/job')
|
response = notifications_admin.test_client().get('/jobs/job')
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert 'contact-demo.csv sent with Reminder template' in response.get_data(as_text=True)
|
assert 'dispatch_20151114.csv' in response.get_data(as_text=True)
|
||||||
|
assert 'Test message 1' in response.get_data(as_text=True)
|
||||||
|
|
||||||
|
|
||||||
def test_should_show_page_for_one_notification(notifications_admin):
|
def test_should_show_page_for_one_notification(notifications_admin):
|
||||||
|
|||||||
Reference in New Issue
Block a user