From 1bad32bcdb6a0f76daa15d8735a046e25835d7d7 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Thu, 23 Jan 2020 15:18:36 -0500 Subject: [PATCH] Add success flash message --- atst/routes/applications/settings.py | 2 +- atst/utils/flash.py | 5 +++++ translations.yaml | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/atst/routes/applications/settings.py b/atst/routes/applications/settings.py index 137af0d7..b4e75fc1 100644 --- a/atst/routes/applications/settings.py +++ b/atst/routes/applications/settings.py @@ -528,13 +528,13 @@ def resend_invite(application_id, application_role_id): @applications_bp.route( "/environments//add_subscription", methods=["POST"] ) -# TODO: decide what perms are needed to create a subscription @user_can(Permissions.EDIT_ENVIRONMENT, message="create new environment subscription") def create_subscription(environment_id): environment = Environments.get(environment_id) try: app.csp.cloud.create_subscription(environment) + flash("environment_subscription_success", name=environment.displayname) except GeneralCSPException: flash("environment_subscription_failure") diff --git a/atst/utils/flash.py b/atst/utils/flash.py index 8caf7ed8..ea85f1ef 100644 --- a/atst/utils/flash.py +++ b/atst/utils/flash.py @@ -88,6 +88,11 @@ MESSAGES = { "message": "flash.environment.subscription_failure.message", "category": "error", }, + "environment_subscription_success": { + "title": "flash.environment.subscription_success.title", + "message": "flash.environment.subscription_success.message", + "category": "success", + }, "form_errors": { "title": "flash.form.errors.title", "message": "flash.form.errors.message", diff --git a/translations.yaml b/translations.yaml index 27e5805d..d9615c4d 100644 --- a/translations.yaml +++ b/translations.yaml @@ -131,6 +131,9 @@ flash: subscription_failure: title: Environment subscription error message: An unexpected problem occurred with your request, please try again. If the problem persists, contact an administrator. + subscription_success: + title: Success! + message: "A subscription has been added to {name} environment" form: errors: title: There were some errors