mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Merge pull request #427 from alphagov/update_for_db_rebase
Update for db rebase
This commit is contained in:
@@ -38,7 +38,7 @@ def add_service():
|
||||
email_from = email_safe(form.name.data)
|
||||
service_id = service_api_client.create_service(service_name=form.name.data,
|
||||
active=False,
|
||||
limit=current_app.config['DEFAULT_SERVICE_LIMIT'],
|
||||
message_limit=current_app.config['DEFAULT_SERVICE_LIMIT'],
|
||||
restricted=True,
|
||||
user_id=session['user_id'],
|
||||
email_from=email_from)
|
||||
|
||||
@@ -39,7 +39,7 @@ def create_api_key(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/api-keys/revoke/<int:key_id>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/api-keys/revoke/<key_id>", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_api_keys')
|
||||
def revoke_api_key(service_id, key_id):
|
||||
|
||||
@@ -77,11 +77,11 @@ def add_rates_to(delivery_statistics):
|
||||
|
||||
latest_stats.update({
|
||||
'emails_failure_rate': (
|
||||
"{0:.1f}".format((float(today['emails_error']) / today['emails_requested'] * 100))
|
||||
"{0:.1f}".format((float(today['emails_failed']) / today['emails_requested'] * 100))
|
||||
if today and today['emails_requested'] else 0
|
||||
),
|
||||
'sms_failure_rate': (
|
||||
"{0:.1f}".format((float(today['sms_error']) / today['sms_requested'] * 100))
|
||||
"{0:.1f}".format((float(today['sms_failed']) / today['sms_requested'] * 100))
|
||||
if today and today['sms_requested'] else 0
|
||||
)
|
||||
})
|
||||
|
||||
@@ -92,7 +92,7 @@ def choose_template(service_id, template_type):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/send/<int:template_id>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/send/<template_id>/csv", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('send_texts', 'send_emails', 'send_letters')
|
||||
def send_messages(service_id, template_id):
|
||||
|
||||
@@ -61,7 +61,7 @@ def service_name_change_confirm(service_id):
|
||||
current_service['id'],
|
||||
current_service['name'],
|
||||
current_service['active'],
|
||||
current_service['limit'],
|
||||
current_service['message_limit'],
|
||||
current_service['restricted'],
|
||||
current_service['users'],
|
||||
current_service['email_from'])
|
||||
@@ -123,7 +123,7 @@ def service_status_change_confirm(service_id):
|
||||
current_service['id'],
|
||||
current_service['name'],
|
||||
current_service['active'],
|
||||
current_service['limit'],
|
||||
current_service['message_limit'],
|
||||
current_service['restricted'],
|
||||
current_service['users'],
|
||||
current_service['email_from'])
|
||||
|
||||
@@ -48,7 +48,7 @@ def add_service_template(service_id, template_type):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/templates/<int:template_id>", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/templates/<template_id>", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_templates', admin_override=True)
|
||||
def edit_service_template(service_id, template_id):
|
||||
@@ -76,7 +76,7 @@ def edit_service_template(service_id, template_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/templates/<int:template_id>/delete", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/templates/<template_id>/delete", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@user_has_permissions('manage_templates', admin_override=True)
|
||||
def delete_service_template(service_id, template_id):
|
||||
|
||||
@@ -18,14 +18,14 @@ class ServiceAPIClient(NotificationsAPIClient):
|
||||
self.client_id = application.config['ADMIN_CLIENT_USER_NAME']
|
||||
self.secret = application.config['ADMIN_CLIENT_SECRET']
|
||||
|
||||
def create_service(self, service_name, active, limit, restricted, user_id, email_from):
|
||||
def create_service(self, service_name, active, message_limit, restricted, user_id, email_from):
|
||||
"""
|
||||
Create a service and return the json.
|
||||
"""
|
||||
data = {
|
||||
"name": service_name,
|
||||
"active": active,
|
||||
"limit": limit,
|
||||
"message_limit": message_limit,
|
||||
"user_id": user_id,
|
||||
"restricted": restricted,
|
||||
"email_from": email_from
|
||||
@@ -56,7 +56,7 @@ class ServiceAPIClient(NotificationsAPIClient):
|
||||
service_id,
|
||||
service_name,
|
||||
active,
|
||||
limit,
|
||||
message_limit,
|
||||
restricted,
|
||||
users,
|
||||
email_from):
|
||||
@@ -67,7 +67,7 @@ class ServiceAPIClient(NotificationsAPIClient):
|
||||
"id": service_id,
|
||||
"name": service_name,
|
||||
"active": active,
|
||||
"limit": limit,
|
||||
"message_limit": message_limit,
|
||||
"restricted": restricted,
|
||||
"users": users,
|
||||
"email_from": email_from
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
{{ api_key(secret, key_name) }}
|
||||
|
||||
{{ page_footer(
|
||||
secondary_link=url_for('.api_keys', service_id=service_id),
|
||||
secondary_link=url_for('.api_keys', service_id=current_service.id),
|
||||
secondary_link_text='Back to API keys'
|
||||
) }}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{{ big_number_with_status(
|
||||
statistics.get('emails_requested', 0),
|
||||
'email' if statistics.get('emails_requested') == 1 else 'emails',
|
||||
statistics.get('emails_error'),
|
||||
statistics.get('emails_failed'),
|
||||
statistics.get('emails_failure_rate', 0.0),
|
||||
statistics.get('emails_failure_rate', 0)|float > 3
|
||||
) }}
|
||||
@@ -17,7 +17,7 @@
|
||||
{{ big_number_with_status(
|
||||
statistics.get('sms_requested', 0),
|
||||
'text message' if statistics.get('sms_requested') == 1 else 'text messages',
|
||||
statistics.get('sms_error'),
|
||||
statistics.get('sms_failed'),
|
||||
statistics.get('sms_failure_rate', 0.0),
|
||||
statistics.get('sms_failure_rate', 0)|float > 3
|
||||
) }}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, type="email", page=1) }}">Email messages</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['sent', 'delivered'], page=1) }}">Successful messages</a> 
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['failed', 'complaint', 'bounce'], page=1) }}">Failed messages</a>
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['delivered'], page=1) }}">Successful messages</a> 
|
||||
<a href="{{ url_for(".view_notifications", service_id=current_service.id, status=['failed'], page=1) }}">Failed messages</a>
|
||||
</p>
|
||||
{% call(item, row_number) list_table(
|
||||
notifications,
|
||||
|
||||
Reference in New Issue
Block a user