Add a second step for choosing networks

Only the test channel has the option to isolate messages to one network.

This commits makes the choices less confusing by only showing the
network choice to those who have selected the test channel.
This commit is contained in:
Chris Hill-Scott
2021-05-11 11:07:30 +01:00
parent f640767f3d
commit a0f54539cc
9 changed files with 284 additions and 31 deletions

View File

@@ -46,6 +46,8 @@ from app.main.forms import (
RenameServiceForm,
SearchByNameForm,
ServiceBroadcastAccountTypeForm,
ServiceBroadcastChannelForm,
ServiceBroadcastNetworkForm,
ServiceContactDetailsForm,
ServiceDataRetentionEditForm,
ServiceDataRetentionForm,
@@ -318,9 +320,38 @@ def service_set_permission(service_id, permission):
@main.route("/services/<uuid:service_id>/service-settings/broadcasts", methods=["GET", "POST"])
@user_is_platform_admin
def service_set_broadcast_account_type(service_id):
form = ServiceBroadcastAccountTypeForm(
account_type=(
def service_set_broadcast_channel(service_id):
form = ServiceBroadcastChannelForm(
channel=(
current_service.live,
current_service.broadcast_channel,
'all',
)
)
if form.validate_on_submit():
if form.channel.data == 'live-test':
return redirect(url_for(
'.service_set_broadcast_network',
service_id=current_service.id,
))
return redirect(url_for(
'.service_confirm_broadcast_account_type',
service_id=current_service.id,
account_type=form.channel.data,
))
return render_template(
'views/service-settings/service-set-broadcast-channel.html',
form=form,
)
@main.route("/services/<uuid:service_id>/service-settings/broadcasts/network", methods=["GET", "POST"])
@user_is_platform_admin
def service_set_broadcast_network(service_id):
form = ServiceBroadcastNetworkForm(
network=(
current_service.live,
current_service.broadcast_channel,
current_service.allowed_broadcast_provider
@@ -331,11 +362,11 @@ def service_set_broadcast_account_type(service_id):
return redirect(url_for(
'.service_confirm_broadcast_account_type',
service_id=current_service.id,
account_type=form.account_type.data,
account_type=form.network.data,
))
return render_template(
'views/service-settings/service-set-broadcast-account-type.html',
'views/service-settings/service-set-broadcast-network.html',
form=form,
)