mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-01 04:09:46 -04:00
Combine current and pending broadcasts
Splitting the dashboard into multiple sections was confusing, and people sometimes mistook the headings as labels, especially when a section was empty. It just wasn’t clear what the hierarchy of the page was. This commit combines the current and pending broadcasts into one list on the dashboard. Previous broadcasts have already moved to their own page.
This commit is contained in:
@@ -62,16 +62,10 @@ def broadcast_dashboard_updates(service_id):
|
||||
def get_broadcast_dashboard_partials(service_id):
|
||||
broadcast_messages = BroadcastMessages(service_id)
|
||||
return dict(
|
||||
pending_approval_broadcasts=render_template(
|
||||
current_broadcasts=render_template(
|
||||
'views/broadcast/partials/dashboard-table.html',
|
||||
broadcasts=broadcast_messages.with_status('pending-approval'),
|
||||
empty_message='You do not have any alerts waiting for approval',
|
||||
view_broadcast_endpoint='.view_current_broadcast',
|
||||
),
|
||||
live_broadcasts=render_template(
|
||||
'views/broadcast/partials/dashboard-table.html',
|
||||
broadcasts=broadcast_messages.with_status('broadcasting'),
|
||||
empty_message='You do not have any live alerts at the moment',
|
||||
broadcasts=broadcast_messages.with_status('pending-approval', 'broadcasting'),
|
||||
empty_message='You do not have any current alerts',
|
||||
view_broadcast_endpoint='.view_current_broadcast',
|
||||
),
|
||||
)
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Dashboard
|
||||
Current alerts
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="govuk-visually-hidden">Dashboard</h1>
|
||||
|
||||
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
|
||||
<nav class="govuk-!-margin-top-2 govuk-!-margin-bottom-6">
|
||||
<a class="govuk-link govuk-link--no-visited-state pill-separate-item govuk-!-padding-top-4 govuk-!-padding-bottom-4 govuk-!-font-weight-bold" href="{{ url_for('.choose_template', service_id=current_service.id) }}">
|
||||
@@ -18,20 +16,12 @@
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<h2 class="heading-medium govuk-!-margin-bottom-2">Live alerts</h2>
|
||||
<h1 class="heading-medium govuk-!-margin-bottom-2">Current alerts</h1>
|
||||
|
||||
{{ ajax_block(
|
||||
partials,
|
||||
url_for('.broadcast_dashboard_updates', service_id=current_service.id),
|
||||
'live_broadcasts'
|
||||
) }}
|
||||
|
||||
<h2 class="heading-medium govuk-!-margin-bottom-2">Waiting for approval</h2>
|
||||
|
||||
{{ ajax_block(
|
||||
partials,
|
||||
url_for('.broadcast_dashboard_updates', service_id=current_service.id),
|
||||
'pending_approval_broadcasts'
|
||||
'current_broadcasts'
|
||||
) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -277,11 +277,13 @@ def test_empty_broadcast_dashboard(
|
||||
'.broadcast_dashboard',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
assert normalize_spaces(page.select_one('h1').text) == (
|
||||
'Current alerts'
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(row.text) for row in page.select('tbody tr .table-empty-message')
|
||||
] == [
|
||||
'You do not have any live alerts at the moment',
|
||||
'You do not have any alerts waiting for approval',
|
||||
'You do not have any current alerts',
|
||||
]
|
||||
|
||||
|
||||
@@ -298,23 +300,12 @@ def test_broadcast_dashboard(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
assert len(page.select('table')) == len(page.select('main h2')) == 2
|
||||
assert len(page.select('table')) == len(page.select('h1')) == 1
|
||||
|
||||
assert normalize_spaces(page.select('main h2')[0].text) == (
|
||||
'Live alerts'
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr')
|
||||
] == [
|
||||
'Example template This is a test England Scotland Live since today at 2:20am',
|
||||
]
|
||||
|
||||
assert normalize_spaces(page.select('main h2')[1].text) == (
|
||||
'Waiting for approval'
|
||||
)
|
||||
assert [
|
||||
normalize_spaces(row.text) for row in page.select('table')[1].select('tbody tr')
|
||||
] == [
|
||||
'Example template This is a test England Scotland Prepared by Test User',
|
||||
]
|
||||
|
||||
@@ -336,13 +327,10 @@ def test_broadcast_dashboard_json(
|
||||
|
||||
json_response = json.loads(response.get_data(as_text=True))
|
||||
|
||||
assert json_response.keys() == {
|
||||
'pending_approval_broadcasts',
|
||||
'live_broadcasts',
|
||||
}
|
||||
assert json_response.keys() == {'current_broadcasts'}
|
||||
|
||||
assert 'Prepared by Test User' in json_response['pending_approval_broadcasts']
|
||||
assert 'Live since today at 2:20am' in json_response['live_broadcasts']
|
||||
assert 'Prepared by Test User' in json_response['current_broadcasts']
|
||||
assert 'Live since today at 2:20am' in json_response['current_broadcasts']
|
||||
|
||||
|
||||
@freeze_time('2020-02-20 02:20')
|
||||
|
||||
Reference in New Issue
Block a user