Stop showing priorities for other provider types

This isn't used and showing priorities when we only have a single
provider or where they have no effect is unnecessarily confusing.
Removing the form makes it clearer that there's only one way to
adjust priorities for domestic SMS providers.

If we add another email or international SMS provider in future,
we would need to rewrite the form here anyway as the priorities
need to be adjusted in tandem, not individually.
This commit is contained in:
Ben Thorner
2022-04-06 12:53:12 +01:00
parent 25a26c0b4d
commit 8655ab7dea
6 changed files with 9 additions and 216 deletions

View File

@@ -1740,12 +1740,6 @@ class EstimateUsageForm(StripWhitespaceForm):
return super().validate(*args, **kwargs)
class AdminProviderForm(StripWhitespaceForm):
priority = GovukIntegerField(
'Priority', [validators.NumberRange(min=1, max=100, message="Must be between 1 and 100")]
)
class AdminProviderRatioForm(StripWhitespaceForm):
ratio = GovukRadiosField(choices=[

View File

@@ -6,7 +6,7 @@ from werkzeug.utils import redirect
from app import provider_client
from app.main import main
from app.main.forms import AdminProviderForm, AdminProviderRatioForm
from app.main.forms import AdminProviderRatioForm
from app.utils.user import user_is_platform_admin
PROVIDER_PRIORITY_MEANING_SWITCHOVER = datetime(2019, 11, 29, 11, 0).isoformat()
@@ -43,19 +43,6 @@ def add_monthly_traffic(domestic_sms_providers):
provider['monthly_traffic'] = round(percentage)
@main.route("/provider/<uuid:provider_id>/edit", methods=['GET', 'POST'])
@user_is_platform_admin
def edit_provider(provider_id):
provider = provider_client.get_provider_by_id(provider_id)['provider_details']
form = AdminProviderForm(active=provider['active'], priority=provider['priority'])
if form.validate_on_submit():
provider_client.update_provider(provider_id, form.priority.data)
return redirect(url_for('.view_providers'))
return render_template('views/providers/edit-provider.html', form=form, provider=provider)
@main.route("/provider/edit-sms-provider-ratio", methods=['GET', 'POST'])
@user_is_platform_admin
def edit_sms_provider_ratio():

View File

@@ -1,37 +0,0 @@
{% extends "withoutnav_template.html" %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block per_page_title %}
{{provider.display_name}}
{% endblock %}
{% block backLink %}
{{ govukBackLink({ "href": url_for('.view_providers') }) }}
{% endblock %}
{% block maincolumn_content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
{{ page_header(provider.display_name) }}
<p class="govuk-body">Update provider:</p>
<ul class="list-bullet">
<li>We only send from the highest priority provider</li>
</ul>
{% call form_wrapper() %}
{{ form.priority }}
{{ page_footer('Save') }}
{% endcall %}
</div>
</div>
{% endblock %}

View File

@@ -48,14 +48,12 @@ Providers
caption="Email providers",
caption_visible=False,
empty_message='No email providers',
field_headings=['Provider', 'Priority', 'Active', 'Last Updated', 'Updated By'],
field_headings=['Provider', 'Active', 'Last Updated', 'Updated By'],
field_headings_visible=True
) %}
{{ link_field(item.display_name, url_for('main.view_provider', provider_id=item.id)) }}
{{ text_field(item.priority) }}
{{ text_field(item.active) }}
{% if item.updated_at %}
@@ -65,9 +63,6 @@ Providers
{% endif %}
{{ optional_text_field(item.created_by_name, default='None') }}
{{ link_field('change', url_for('main.edit_provider', provider_id=item.id)) }}
{% endcall %}
<h2 class="heading-medium">International SMS Providers</h2>
@@ -77,14 +72,12 @@ Providers
caption="International SMS providers",
caption_visible=False,
empty_message='No international sms providers',
field_headings=['Provider', 'Priority', 'Active', 'Last Updated', 'Updated By'],
field_headings=['Provider', 'Active', 'Last Updated', 'Updated By'],
field_headings_visible=True
) %}
{{ link_field(item.display_name, url_for('main.view_provider', provider_id=item.id)) }}
{{ text_field(item.priority) }}
{{ text_field(item.active) }}
{% if item.updated_at %}