mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-05 14:11:41 -04:00
Allow excluding services from live services count
Adds a front end for: https://github.com/alphagov/notifications-api/pull/2417 > Sometimes we have to make a few services for what really is one > service, for example GOV.UK Pay and GOV.UK Pay Direct Debit. We also > have our own test services which aren’t included in the count of live > services. We currently count these as one service by not including > them in the beta partners spreadsheet.
This commit is contained in:
@@ -933,9 +933,13 @@ class OnOffField(RadioField):
|
||||
|
||||
class ServiceOnOffSettingForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, name, *args, **kwargs):
|
||||
def __init__(self, name, *args, truthy='On', falsey='Off', **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.enabled.label.text = name
|
||||
self.enabled.choices = [
|
||||
(True, truthy),
|
||||
(False, falsey),
|
||||
]
|
||||
|
||||
enabled = OnOffField('Choices')
|
||||
|
||||
|
||||
@@ -277,6 +277,29 @@ def service_switch_live(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings/switch-count-as-live", methods=["GET", "POST"])
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def service_switch_count_as_live(service_id):
|
||||
|
||||
form = ServiceOnOffSettingForm(
|
||||
name="Count in list of live services",
|
||||
enabled=current_service.count_as_live,
|
||||
truthy='Yes',
|
||||
falsey='No',
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.update(count_as_live=form.enabled.data)
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
|
||||
return render_template(
|
||||
'views/service-settings/set-service-setting.html',
|
||||
title="Count in list of live services",
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/service-settings/permissions/<permission>", methods=["GET", "POST"])
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
|
||||
@@ -40,6 +40,7 @@ class Service():
|
||||
'volume_sms',
|
||||
'volume_letter',
|
||||
'consent_to_research',
|
||||
'count_as_live',
|
||||
}
|
||||
|
||||
TEMPLATE_TYPES = (
|
||||
|
||||
@@ -261,6 +261,7 @@ class HeaderNavigation(Navigation):
|
||||
'service_settings',
|
||||
'service_sms_senders',
|
||||
'service_switch_can_upload_document',
|
||||
'service_switch_count_as_live',
|
||||
'service_switch_live',
|
||||
'service_set_permission',
|
||||
'services_or_dashboard',
|
||||
@@ -506,6 +507,7 @@ class MainNavigation(Navigation):
|
||||
'service_delete_sms_sender',
|
||||
'service_letter_validation_preview',
|
||||
'service_switch_can_upload_document',
|
||||
'service_switch_count_as_live',
|
||||
'service_switch_live',
|
||||
'service_set_permission',
|
||||
'services_or_dashboard',
|
||||
@@ -749,6 +751,7 @@ class CaseworkNavigation(Navigation):
|
||||
'service_settings',
|
||||
'service_sms_senders',
|
||||
'service_switch_can_upload_document',
|
||||
'service_switch_count_as_live',
|
||||
'service_switch_live',
|
||||
'service_set_permission',
|
||||
'services_or_dashboard',
|
||||
@@ -999,6 +1002,7 @@ class OrgNavigation(Navigation):
|
||||
'service_settings',
|
||||
'service_sms_senders',
|
||||
'service_switch_can_upload_document',
|
||||
'service_switch_count_as_live',
|
||||
'service_switch_live',
|
||||
'service_set_permission',
|
||||
'services_or_dashboard',
|
||||
|
||||
@@ -88,6 +88,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
'volume_sms',
|
||||
'volume_letter',
|
||||
'consent_to_research',
|
||||
'count_as_live',
|
||||
}
|
||||
if disallowed_attributes:
|
||||
raise TypeError('Not allowed to update service attributes: {}'.format(
|
||||
|
||||
@@ -292,6 +292,12 @@
|
||||
{{ edit_field('Change', url_for('.service_switch_live', service_id=current_service.id)) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call row() %}
|
||||
{{ text_field('Count in list of live services')}}
|
||||
{{ text_field('Yes' if current_service.count_as_live else 'No') }}
|
||||
{{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id)) }}
|
||||
{% endcall %}
|
||||
|
||||
{% call row() %}
|
||||
{{ text_field('Organisation')}}
|
||||
{{ optional_text_field(current_service.organisation_name) }}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Send letters
|
||||
{{ title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
Reference in New Issue
Block a user